+
    ÖÇÜhÙ  ã                   ó8   € R t ^ RIHt ^ RIHt  ! R R]4      tR# )a(  
Multi-Word Expression Tokenizer

A ``MWETokenizer`` takes a string which has already been divided into tokens and
retokenizes it, merging multi-word expressions into single tokens, using a lexicon
of MWEs:


    >>> from nltk.tokenize import MWETokenizer

    >>> tokenizer = MWETokenizer([('a', 'little'), ('a', 'little', 'bit'), ('a', 'lot')])
    >>> tokenizer.add_mwe(('in', 'spite', 'of'))

    >>> tokenizer.tokenize('Testing testing testing one two three'.split())
    ['Testing', 'testing', 'testing', 'one', 'two', 'three']

    >>> tokenizer.tokenize('This is a test in spite'.split())
    ['This', 'is', 'a', 'test', 'in', 'spite']

    >>> tokenizer.tokenize('In a little or a little bit or a lot in spite of'.split())
    ['In', 'a_little', 'or', 'a_little_bit', 'or', 'a_lot', 'in_spite_of']

)Ú
TokenizerI)ÚTriec                   ó:   a € ] tR t^#t o RtRR ltR tR tRtV t	R# )ÚMWETokenizerz`A tokenizer that processes tokenized text and merges multi-word expressions
into single tokens.
Nc                óF   € V'       g   . p\        V4      V n        W n        R# )ae  Initialize the multi-word tokenizer with a list of expressions and a
separator

:type mwes: list(list(str))
:param mwes: A sequence of multi-word expressions to be merged, where
    each MWE is a sequence of strings.
:type separator: str
:param separator: String that should be inserted between words in a multi-word
    expression token. (Default is '_')

N)r   Ú_mwesÚ
_separator)ÚselfÚmwesÚ	separators   &&&Ú3/usr/lib/python3/dist-packages/nltk/tokenize/mwe.pyÚ__init__ÚMWETokenizer.__init__(   s   € ÷ ØˆDÜ˜$“ZˆŒ
Ø#Žó    c                ó<   € V P                   P                  V4       R# )a.  Add a multi-word expression to the lexicon (stored as a word trie)

We use ``util.Trie`` to represent the trie. Its form is a dict of dicts.
The key True marks the end of a valid MWE.

:param mwe: The multi-word expression we're adding into the word trie
:type mwe: tuple(str) or list(str)

:Example:

>>> tokenizer = MWETokenizer()
>>> tokenizer.add_mwe(('a', 'b'))
>>> tokenizer.add_mwe(('a', 'b', 'c'))
>>> tokenizer.add_mwe(('a', 'x'))
>>> expected = {'a': {'x': {True: None}, 'b': {True: None, 'c': {True: None}}}}
>>> tokenizer._mwes == expected
True

N)r   Úinsert)r	   Úmwes   &&r   Úadd_mweÚMWETokenizer.add_mwe9   s   € ð( 	�
‰
×Ñ˜#Ör   c                ó@  € ^ p\        V4      p. pW#8  Ed   W,          V P                  9   dÎ   TpV P                  pRpWS8  dA   W,          V9   d4   WaV,          ,          pV^,           p\        P                  V9   g   KB  TpKF  VR8”  d   Tp\        P                  V9   g   VR8”  d1   VP	                  V P
                  P                  WV 4      4       TpKÉ  VP	                  W,          4       V^,          pKë  VP	                  W,          4       V^,          pEK  V# )a]  

:param text: A list containing tokenized text
:type text: list(str)
:return: A list of the tokenized text with multi-words merged together
:rtype: list(str)

:Example:

>>> tokenizer = MWETokenizer([('hors', "d'oeuvre")], separator='+')
>>> tokenizer.tokenize("An hors d'oeuvre tonight, sir?".split())
['An', "hors+d'oeuvre", 'tonight,', 'sir?']

éÿÿÿÿ)Úlenr   r   ÚLEAFÚappendr   Újoin)r	   ÚtextÚiÚnÚresultÚjÚtrieÚ
last_matchs   &&      r   ÚtokenizeÚMWETokenizer.tokenizeO   sæ   € ð ˆÜ�‹IˆØˆà�eØ�w˜$Ÿ*™*Ô$à�Ø—z‘z�Ø�
Ø”e ¥¨4¤Ø Q¥�=�DØ˜A��AÜ—y‘y DÖ(Ø%&š
à! B”Ø&˜ä—y‘y DÔ(¨J¸¬OàŸ™ d§o¡o×&:Ñ&:¸4À!¸9Ó&EÔFØšð Ÿ™ d¥gÔ.Ø˜Q�šà—‘˜d�gÔ&Ø�Q•“Øˆr   )r   r   )NÚ_)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r"   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   #   s   ø‡ € ñô$ò"÷,-ð -r   r   N)r)   Únltk.tokenize.apir   Ú	nltk.utilr   r   © r   r   Ú<module>r0      s    ðñõ. )Ý ôY�:ö Yr   