+
    ÖÇÜhµ)  ã                   ó¢   € ^ RI Ht ^ RIHt  R.t ^ RIHt ^ RIHt R t	R	 tR
 t ! R R]4      tR tR#   ]
 d   t]3R lt	 RtAL(RtAii ; i)é    )ÚParserI)ÚTreeÚBllipParser)ÚRerankingParser©Úget_unified_model_parametersc                  ó   € R # ©N© r   ó    Ú2/usr/lib/python3/dist-packages/nltk/parse/bllip.pyÚ_ensure_bllip_import_or_errorr   Z   s   € Ùr   c                 ó&   € \        R V ,          4      h)z&Couldn't import bllipparser module: %s)ÚImportError)Úies   &r   r   r   _   s   € ÜÐBÀRÕGÓHÐHr   Nc                 ó    €  \        V 4       F  w  rVP                  R 4       K  	  R#   \         d   p\        RX RX: R24      ThRp?ii ; i)ÚasciizToken z (zH) is non-ASCII. BLLIP Parser currently doesn't support non-ASCII inputs.N)Ú	enumerateÚencodeÚUnicodeEncodeErrorÚ
ValueError)ÚwordsÚiÚwordÚes   &   r   Ú_ensure_asciir   c   s]   € ðÜ  Ö'‰GˆAØ�K‰K˜Ö ó (øäô ÜØ�Q�C�r˜$™ð ":ð :ó
ð ð	ûðús   ‚%) ©A´AÁAc                 óT   € \         P                  ! \        V P                  4      4      # r
   )r   Ú
fromstringÚstrÚ	ptb_parse)Úscored_parses   &r   Ú_scored_parse_to_nltk_treer"   n   s   € Ü�?Š?œ3˜|×5Ñ5Ó6Ó7Ð7r   c                   óN   a € ] tR t^rt o RtRR ltR tR t]R	R l4       t	Rt
V tR# )
r   zÁ
Interface for parsing with BLLIP Parser. BllipParser objects can be
constructed with the ``BllipParser.from_unified_model_dir`` class
method or manually using the ``BllipParser`` constructor.
Nc                ó
  € \        4        T;'       g    / pT;'       g    / p\        4       V n        V P                  P                  ! V3/ VB  V'       d-   V'       d#   V P                  P                  ! RRVRV/VB  R# R# R# )a0  
Load a BLLIP Parser model from scratch. You'll typically want to
use the ``from_unified_model_dir()`` class method to construct
this object.

:param parser_model: Path to parser model directory
:type parser_model: str

:param reranker_features: Path the reranker model's features file
:type reranker_features: str

:param reranker_weights: Path the reranker model's weights file
:type reranker_weights: str

:param parser_options: optional dictionary of parser options, see
    ``bllipparser.RerankingParser.RerankingParser.load_parser_options()``
    for more information.
:type parser_options: dict(str)

:param reranker_options: optional
    dictionary of reranker options, see
    ``bllipparser.RerankingParser.RerankingParser.load_reranker_model()``
    for more information.
:type reranker_options: dict(str)
Úfeatures_filenameÚweights_filenameNr   )r   r   ÚrrpÚload_parser_modelÚload_reranker_model)ÚselfÚparser_modelÚreranker_featuresÚreranker_weightsÚparser_optionsÚreranker_optionss   &&&&&&r   Ú__init__ÚBllipParser.__init__y   s�   € ôB 	&Ô'à'×-Ð-¨2ˆØ+×1Ð1¨rÐä"Ó$ˆŒØ�‰×"Ò" <ÑB°>ÒBß×!1Ø�H‰H×(Ò(ñ Ø"3ðà!1ðð #ôñ "2Ñr   c              #  ó†   "  € \        V4       V P                  P                  V4      pV F  p\        V4      x € K  	  R# 5i)aW  
Use BLLIP Parser to parse a sentence. Takes a sentence as a list
of words; it will be automatically tagged with this BLLIP Parser
instance's tagger.

:return: An iterator that generates parse trees for the sentence
    from most likely to least likely.

:param sentence: The sentence to be parsed
:type sentence: list(str)
:rtype: iter(Tree)
N)r   r'   Úparser"   )r*   ÚsentenceÚ
nbest_listr!   s   &&  r   r3   ÚBllipParser.parse¨   s6   é € ô 	�hÔØ—X‘X—^‘^ HÓ-ˆ
Û&ˆLÜ,¨\Ó:Ô:ó 'ùs   ‚?Ac              #  óò   "  € . p/ p\        V4       F#  w  pw  rVVP                  V4       Vf   K  WcV&   K%  	  \        V4       V P                  P	                  W#4      pV F  p\        V4      x € K  	  R# 5i)a@  
Use BLLIP to parse a sentence. Takes a sentence as a list of
(word, tag) tuples; the sentence must have already been tokenized
and tagged. BLLIP will attempt to use the tags provided but may
use others if it can't come up with a complete parse subject
to those constraints. You may also specify a tag as ``None``
to leave a token's tag unconstrained.

:return: An iterator that generates parse trees for the sentence
    from most likely to least likely.

:param sentence: Input sentence to parse as (word, tag) pairs
:type sentence: list(tuple(str, str))
:rtype: iter(Tree)
N)r   Úappendr   r'   Úparse_taggedr"   )	r*   Úword_and_tag_pairsr   Útag_mapr   r   Útagr5   r!   s	   &&       r   Útagged_parseÚBllipParser.tagged_parseº   sr   é € ð  ˆØˆÜ'Ð(:Ö;‰NˆA‰{�Ø�L‰L˜ÔØŒØ ˜“
ñ <ô
 	�eÔØ—X‘X×*Ñ*¨5Ó:ˆ
Û&ˆLÜ,¨\Ó:Ô:ó 'ùs   ‚*A7±AA7c                ó8   € \        V4      w  pppV ! VVVVV4      # )a�  
Create a ``BllipParser`` object from a unified parsing model
directory. Unified parsing model directories are a standardized
way of storing BLLIP parser and reranker models together on disk.
See ``bllipparser.RerankingParser.get_unified_model_parameters()``
for more information about unified model directories.

:return: A ``BllipParser`` object using the parser and reranker
    models in the model directory.

:param model_dir: Path to the unified model directory.
:type model_dir: str
:param parser_options: optional dictionary of parser options, see
    ``bllipparser.RerankingParser.RerankingParser.load_parser_options()``
    for more information.
:type parser_options: dict(str)
:param reranker_options: optional dictionary of reranker options, see
    ``bllipparser.RerankingParser.RerankingParser.load_reranker_model()``
    for more information.
:type reranker_options: dict(str)
:rtype: BllipParser
r   )ÚclsÚ	model_dirr.   r/   Úparser_model_dirÚreranker_features_filenameÚreranker_weights_filenames   &&&&   r   Úfrom_unified_model_dirÚ"BllipParser.from_unified_model_dirÖ   s6   € ô< )¨Ó3ñ		
ØØ&Ø%áØØ&Ø%ØØó
ð 	
r   )r'   )NNNNN)NN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r0   r3   r=   ÚclassmethodrE   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   r   s.   ø‡ € ñô-ò^;ò$;ð8 ó$
ó ö$
r   c            	     ó  € ^ RI Hp  V ! R4      P                  p\        R4       \        P                  V4      p\        R4       RP                  4       pRP                  4       pRP                  4       pW4V3 FJ  p\        RR	P                  V4      ,          4        \        VP                  V4      4      p\        V4       KL  	  \        VP                  V4      4       F  w  r‰\        RW‰3,          4       K  	  \        R\        VP                  RR.4      4      4       \        R\        VP                  RR.4      4      4       \        R\        VP                  RR.4      4      4       R#   \         d    \        R
4        EK  i ; i)z8This assumes the Python module bllipparser is installed.)Úfindzmodels/bllip_wsj_no_auxzLoading BLLIP Parsing models...zDone.z#British left waffles on Falklands .z"I saw the man with the telescope .z	# ! ? : -zSentence: %rÚ z(parse failed)zparse %d:
%szforcing 'tree' to be 'NN':Nz.forcing 'A' to be 'DT' and 'tree' to be 'NNP':zforcing 'A' to be 'NNP':)ÚAN)ÚtreeÚNN)rS   ÚDT)rT   ÚNNP)rS   rW   )rT   N)Ú	nltk.datarQ   ÚpathÚprintr   rE   ÚsplitÚjoinÚnextr3   ÚStopIterationr   r=   )
rQ   rA   ÚbllipÚ	sentence1Ú	sentence2Úfail1r4   rT   r   r3   s
             r   Údemorc   þ   s]  € õ áÐ.Ó/×4Ñ4€Iä	Ð
+Ô,ä×.Ñ.¨yÓ9€EÜ	ˆ'„Nà5×;Ñ;Ó=€IØ4×:Ñ:Ó<€Ià×ÑÓ€EØ¨5Ó1ˆÜˆn˜sŸx™x¨Ó1Õ1Ô2ð	$Ü˜Ÿ™ HÓ-Ó.ˆDÜ�$ŽKñ	 2ô ˜eŸk™k¨)Ó4Ö5‰ˆÜˆo  
Õ*Ö+ñ 6ô 
Ø$ÜˆU×Ñ ¨nÐ =Ó>Ó?ôô 
Ø8ÜˆU×Ñ ¨oÐ >Ó?Ó@ôô 
Ø"ÜˆU×Ñ ¨~Ð >Ó?Ó@öøô% ô 	$ÜÐ"×#Ð#ð	$ús   Â%E0Å0FÆ
F)Únltk.parse.apir   Ú	nltk.treer   Ú__all__Úbllipparserr   Úbllipparser.RerankingParserr   r   r   r   r   r"   r   rc   r   r   r   Ú<module>ri      sp   ðõ #Ý ðDðL ˆ/€ð
IÝ+ÝHòòò8ôI
�'ô I
ôX-øðC ô Ià)+÷ Iñ IûðIús   ’7 ·A¾A	Á	A