JL iN $ddlmZGddZy)) defaultdictc:eZdZdZd dZdZd dZd dZdZdZ y) MinimalSeta Find contexts where more than one possible target value can appear. E.g. if targets are word-initial letters, and contexts are the remainders of words, then we would like to find cases like "fat" vs "cat", and "training" vs "draining". If targets are parts-of-speech and contexts are words, then we would like to find cases like wind (noun) 'air in rapid motion', vs wind (verb) 'coil, wrap'. Nct|_t|_tt|_i|_|r|D]\}}}|j |||yy)z Create a new minimal set. :param parameters: The (context, target, display) tuples for the item :type parameters: list(tuple(str, str, str)) N)set_targets _contextsr_seen _displaysadd)self parameterscontexttargetdisplays Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/nltk/misc/minimalset.py__init__zMinimalSet.__init__sW  %  ,6 3(&'2 3 c|j|j||jj||jj|||j||f<y)a Add a new item to the minimal set, having the specified context, target, and display form. :param context: The context in which the item of interest appears :type context: str :param target: The item of interest :type target: str :param display: The information to be reported for each item :type display: str N)r r r rr )r rrrs rr zMinimalSet.add&sV 7' 7# &!-4()rcx|jDcgc] }t|j||k\s|"c}Scc}w)z Determine which contexts occurred with enough distinct targets. :param minimum: the minimum number of distinct target forms :type minimum: int :rtype: list )r lenr )r minimumcs rcontextszMinimalSet.contexts<s0 >>KaSA-?7-JKKKs 77cH||f|jvr|j||fS|SN)r )r rrdefaults rrzMinimalSet.displayFs, V  .>>7F"34 4Nrcxg}|jD](}|j||}|s|j|*|Sr)rrappend)r rresultrxs r display_allzMinimalSet.display_allLs@mm !F Wf-A a  ! rc|jSr)r)r s rtargetszMinimalSet.targetsTs }}rr))) __name__ __module__ __qualname____doc__rr rrr"r$rrrr s&3 4,L rrN) collectionsrrr+rrr-s$JJr