| 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�c�M � �� � d Z ddlZddlmZ ddlmZmZ ddlmZ ddl m
Z
mZmZm
Z
ddlmZmZ 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 G d� de� � Z G d� de� � Zd d�Zedk r e� � dS dS )!a�
Classes and interfaces for associating probabilities with tree
structures that represent the internal organization of a text. The
probabilistic parser module defines ``BottomUpProbabilisticChartParser``.
``BottomUpProbabilisticChartParser`` is an abstract class that implements
a bottom-up chart parser for ``PCFG`` grammars. It maintains a queue of edges,
and adds them to the chart one at a time. The ordering of this queue
is based on the probabilities associated with the edges, allowing the
parser to expand more likely edges before less likely ones. Each
subclass implements a different queue ordering, producing different
search strategies. Currently the following subclasses are defined:
- ``InsideChartParser`` searches edges in decreasing order of
their trees' inside probabilities.
- ``RandomChartParser`` searches edges in random order.
- ``LongestChartParser`` searches edges in decreasing order of their
location's length.
The ``BottomUpProbabilisticChartParser`` constructor has an optional
argument beam_size. If non-zero, this controls the size of the beam
(aka the edge queue). This option is most useful with InsideChartParser.
� N)�reduce)�PCFG�Nonterminal)�ParserI)�AbstractChartRule�Chart�LeafEdge�TreeEdge)�ProbabilisticTree�Treec � � e Zd Zd� ZdS )�ProbabilisticLeafEdgec � � dS )Ng �?� ��selfs �3/usr/lib/python3/dist-packages/nltk/parse/pchart.py�probzProbabilisticLeafEdge.prob3 s � ��s� N)�__name__�
__module__�__qualname__r r r r r r 2 s# � � � � � �� � � � r r c �0 � e Zd Zd� Zd� Zed� � � ZdS )�ProbabilisticTreeEdgec �Z � t j | g|�R i |�� || _ | j |f| _ d S �N)r
�__init__�_prob�_comparison_key)r r �args�kwargss r r zProbabilisticTreeEdge.__init__8 s@ � ���$�0��0�0�0��0�0�0���
� $� 4�d�;����r c � � | j S r )r r s r r zProbabilisticTreeEdge.prob>