| 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 : |
�
T�cbU � � � d Z ddlmZ ddlmZmZmZmZ ddlm Z m
Z
mZmZm
Z
mZ ddlmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ G d� d e� � Z G d
� de� � Z! G d� d
e� � Z" G d� de� � Z# G d� de� � Z$ G d� de� � Z% G d� de� � Z& G d� de� � Z' G d� de� � Z( e� � e$� � e%� � e#� � gZ) e� � e(� � e&� � e#� � gZ* e� � e(� � e'� � e#� � gZ+ G d� de� � Z, G d� de,� � Z- G d� de,� � Z. G d � d!e,� � Z/ G d"� d#e!� � Z0d$� Z1d%d%d%d%d&e,d'fd(�Z2d)� Z3e4d*k rmdd+l5m6Z6 e2� � e7� � e6d,� � Z8 e,e8d-�.� � Z9d/Z:e:�; � � Z<e9�= e<� � Z>e>D ]Z? e7e?� � �d0S d0S )1z`
Extension of chart parsing implementation to handle grammars with
feature structures as nodes.
� )�perf_counter)�TYPE�
FeatStruct�find_variables�unify)�CFG�FeatStructNonterminal�Nonterminal�
Production�is_nonterminal�is_terminal)�BottomUpPredictCombineRule�BottomUpPredictRule�CachedTopDownPredictRule�Chart�ChartParser�EdgeI�EmptyPredictRule�FundamentalRule�LeafInitRule�SingleEdgeFundamentalRule�TopDownInitRule�TreeEdge)�logic)�Treec �` � � e Zd ZdZdd�Zed� � � Zd
d�Zd� Zd� Z d � Z
d
� Z� fd�Z� xZ
S )�FeatureTreeEdgea
A specialized tree edge that allows shared variable bindings
between nonterminals on the left-hand side and right-hand side.
Each ``FeatureTreeEdge`` contains a set of ``bindings``, i.e., a
dictionary mapping from variables to values. If the edge is not
complete, then these bindings are simply stored. However, if the
edge is complete, then the constructor applies these bindings to
every nonterminal in the edge whose symbol implements the
interface ``SubstituteBindingsI``.
r Nc �< � �� ��i �|t |� � k r)�r'� � |�� � }�� fd�|D � � }i �t j � ||||� � �� _ � j t
t �� � � � � � � f� _ dS )az
Construct a new edge. If the edge is incomplete (i.e., if
``dot<len(rhs)``), then store the bindings as-is. If the edge
is complete (i.e., if ``dot==len(rhs)``), then apply the
bindings to all nonterminals in ``lhs`` and ``rhs``, and then
clear the bindings. See ``TreeEdge`` for a description of
the other arguments.
Nc �<