)\s*(.+)u([^#]*)(?:#.*)?t CCGLexiconcBs2eZdZdZdZdZdZRS(u Class representing a lexicon for CCG grammars. * `primitives`: The list of primitive categories for the lexicon * `families`: Families of categories * `entries`: A mapping of words to possible categories cCs.t||_||_||_||_dS(N(Rt_startt _primitivest _familiest_entries(tselftstartt primitivestfamiliestentries((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyt__init__5s  cCs |j|S(u@ Returns all the possible categories for a word (R (R tword((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyt categories<scCs|jS(u; Return the target category for the parser (R (R ((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyRCscCsd}t}xw|jD]l}|s/|d}n||d}t}x<|j|D]-}|sj|d}nt}|d|}qQWqW|S(uK String representation of the lexicon. Used for debugging. uu u => u | u%s(tTrueR tFalse(R tstringtfirsttidenttcat((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyt__str__Is  (t__name__t __module__t__doc__RRRR(((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyR,s    cCs|d}d}xf|dkrx|jd rx|jdr]t|\}}||}q||d}|d}qW|jdr|d|dfStd|ddS( ub Separate the contents matching the first set of brackets from the rest of the input. iu(uu)iuUnmatched bracket in string 'u'N(t startswitht matchBracketstAssertionError(Rtresttinsidetpart((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyR cs  cCs,|jdrt|Stj|jS(ub Separate the string for the next portion of the category from the rest of the string u((RR t NEXTPRIM_REtmatchtgroups(R((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyt nextCategoryws cCst|d|dS(u' Parse an application operator ii(R(tapp((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pytparseApplicationscCs|r|dd!jdSgS(u7 Parse the subscripts for a primitive category iiu,(tsplit(tsubscr((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pytparseSubscriptsscCs|ddkrE|ddkrE|dkr8t}n||fSn|d}||kr||\}}|dkr|}n|j||fg}||fS||krt|d}t|||fStd|ddS(u Parse a primitive category If the primitive is the special category 'var', replace it with the correct `CCGVar`. iuvariuString 'u-' is neither a family nor primitive category.N(tNoneRt substituteR-RR!(tchunksRRtvartcatstrRtcvartsubscrs((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pytparsePrimitiveCategorys          cCst|||dS(u' Drop the 'var' from the tuple i(taugParseCategory(tlineRR((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyt parseCategorysc CsAt|\}}|jdrFt|dd!|||\}}n*ttj|j|||\}}x|dkr6tj|j}t|dd!}|d}t|\}}|jdrt|dd!|||\} }n*ttj|j|||\} }t || |}qsW||fS(u{ Parse a string representing a category, and returns a tuple with (possibly) the CCG variable for the category u(iiuii( R(RR6R5tPRIM_RER&R'tAPP_RER*R( R7RRR1t cat_stringR"tresR)t directiontarg((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyR6s % %c Cs%g}i}tt}x|jD]}tj|jdj}|dkr\q%n|jdr|g|djjdD]}|j^q}q%t j|j\}}}t |||\} } |dkr| | f|| NP[sg]/N[sg] the => NP[pl]/N[pl] I => Pro me => Pro we => Pro us => Pro book => N[sg] books => N[pl] peach => N[sg] peaches => N[pl] policeman => N[sg] policemen => N[pl] boy => N[sg] boys => N[pl] sleep => IntransVsg sleep => IntransVpl eat => IntransVpl eat => TransVpl eats => IntransVsg eats => TransVsg see => TransVpl sees => TransVsg (#Rt __future__Rtret collectionsRt nltk.ccg.apiRRRRt nltk.compatRtnltk.internalsRtcompileR9R%R:tUNICODERCRAtobjectRR R(R*R-R5R8R.R6RHRItopenccg_tinytiny(((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/ccg/lexicon.pyt s0 "6     ! !)