mò )á¸Ec@skdZdkZdklZdklZdklZdkZdk l Z dk l Z dk lZdklZd klZd klZd klZd e fd „ƒYZd „Zdfd„ƒYZeiddeƒdfd„ƒYZeiddeƒeidddƒdfd„ƒYZeiddeƒdefd„ƒYZeiddeƒdS(sCLexicon. $Id: Lexicon.py 40218 2005-11-18 14:39:19Z andreasjung $ N(sIOBTree(sOIBTree(sLength(s Persistent(s implements(s get_stopdict(s QueryError(selement_factory(sILexicontLexiconcBs–tZeZeeƒd„Zd„Zd„Zd„Z d„Z d„Z d„Z d„Z d „Zd „Zd „Zd „Zd „Zd„ZRS(NcGs1tƒ|_tƒ|_tƒ|_||_dS(N( tOIBTreetselft_widstIOBTreet_wordstLengthtlengthtpipelinet _pipeline(RR((t;/data/zmath/zope/lib/python/Products/ZCTextIndex/Lexicon.pyt__init__)s   cCs t|iƒS(s1Return the number of unique terms in the lexicon.N(tlenRR(R((R R4scCs |iiƒS(N(RRtkeys(R((R twords9scCs |iiƒS(N(RRR (R((R twids<scCs |iiƒS(N(RRtitems(R((R R?scCsxt|ƒ}x |iD]}|i|ƒ}qWt|idƒpt |iƒƒ|_n|ii ƒt |i |ƒS(Ntchange( t _text2listttexttlastRR telementtprocessthasattrRRt _p_deactivatetmapt_getWordIdCreate(RRRR((R tsourceToWordIdsBs   cCsft|ƒ}x |iD]}|i|ƒ}qWg}x*|D]"}|i |i i |dƒƒq<W|S(Ni( RRRRR RRRtwordtappendRtget(RRRRRR((R t termToWordIdsPs   cCsEt|ƒ}x2|iD]'}t|d|iƒ}||ƒ}qW|S(Nt processGlob(RRRRR RtgetattrR(RRRRR((R t parseTermsYs   cCsd|jp d|jS(Nt*t?(R(RR((R tisGlob`scCs |i|S(N(RRtwid(RR&((R tget_wordcscCs|ii|dƒS(Ni(RRRR(RR((R tget_widfsc Csrd}x5|o-|ddjo||d7}|d}q W|p/|ii|dƒ}|o |gSqtgSn|ptd|ƒ‚n|}xW|D]O}|djo|d7}qœ|djo|d 7}qœ|t i |ƒ7}qœW|d 7}t i |ƒ} |ii |ƒ}g}xK|D]C}|i|ƒpPn| i|ƒo|i|i|ƒq'q'W|S( Ntis*?is.pattern %r shouldn't start with glob characterR#s.*R$t.t$(tprefixtpatternRRRR&t QueryErrortpattctretescapetcompiletprogR Rtkeyt startswithtmatchR( RR-R0R&R/R R,R5RR4((R t globToWordIdsis>    cCsM|ii|ƒ}|djo*|iƒ}||i|<||i|tZeƒiƒZx$edƒD]Zdeeeƒt interfacesRRRBtregisterFactoryRIR9RMRT(R@RBRPRRRAR.R]RMRbR1RR[RRRTRIR>((R R$sB            y