| 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/ccg/__pycache__/ |
Upload File : |
�
T�cc5 � �~ � d Z ddlZddlT ddlmZmZmZmZmZmZm Z m
Z
mZ ddlm
Z
mZ ddlT ddlmZ ddlmZmZmZ ddlT ddlmZ G d � d
e� � Z G d� de� � Z G d
� de� � Z G d� de� � Z G d� de� � Z ee� � ee� � gZ ee � � ee� � ee� � gZ ee
� � ee� � gZ e� � e� � gZ!eez e z e!z Z" G d� de� � Z# G d� de� � Z$d� Z%d� Z&d� Z' ed� � Z(d� Z)e*dk r e)� � dS dS )aB
The lexicon is constructed by calling
``lexicon.fromstring(<lexicon string>)``.
In order to construct a parser, you also need a rule set.
The standard English rules are provided in chart as
``chart.DefaultRuleSet``.
The parser can then be constructed by calling, for example:
``parser = chart.CCGChartParser(<lexicon>, <ruleset>)``
Parsing is then performed by running
``parser.parse(<sentence>.split())``.
While this returns a list of trees, the default representation
of the produced trees is not very enlightening, particularly
given that it uses the same tree class as the CFG parsers.
It is probably better to call:
``chart.printCCGDerivation(<parse tree extracted from list>)``
which should print a nice representation of the derivation.
This entire process is shown far more clearly in the demonstration:
python chart.py
� N)�*) �BackwardApplication�
BackwardBx�BackwardComposition�
BackwardSx� BackwardT�ForwardApplication�ForwardComposition�ForwardSubstitution�ForwardT)�Token�
fromstring)�ParserI)�AbstractChartRule�Chart�EdgeI)�Treec �\ � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� ZdS )�CCGEdgec �D � || _ || _ || _ |||f| _ d S �N)�_span�_categ�_rule�_comparison_key)�self�span�categ�rules �0/usr/lib/python3/dist-packages/nltk/ccg/chart.py�__init__zCCGEdge.__init__; s, � ���
������
� $�e�T�2����� c � � | j S r �r �r s r �lhszCCGEdge.lhsB �
� ��{�r"