| 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 : /usr/lib/python3/dist-packages/nltk/__pycache__/ |
Upload File : |
�
T�c�m � �| � d Z ddlZddlZddlmZmZmZ ddlmZ ddl m
Z
ddlmZ ddl
mZ ddlmZ dd lmZmZ dd
lmZ ddlmZ ddlmZ dd
lmZmZ edg d�� � Z G d� d� � Z G d� d� � Z G d� d� � Z G d� d� � Z! G d� de!� � Z"d� Z#e$dk r
e#� � g d�Z%dS )a
This module brings together a variety of NLTK functionality for
text analysis, and provides simple, interactive interfaces.
Functionality includes: concordancing, collocation discovery,
regular expression search over tokenized strings, and
distributional similarity.
� N)�Counter�defaultdict�
namedtuple)�reduce)�log)�BigramCollocationFinder)�MLE)�padded_everygram_pipeline)�BigramAssocMeasures� f_measure)�ConditionalFreqDist)�FreqDist)�
sent_tokenize)�LazyConcatenation� tokenwrap�ConcordanceLine)�left�query�right�offset�
left_print�right_print�linec �T � e Zd ZdZed� � � Zddd� fd�Zd� Zd� Zdd �Z d
d�Z
dS )�ContextIndexa
A bidirectional index between words and their 'contexts' in a text.
The context of a word is usually defined to be the words that occur
in a fixed window around the word; but other definitions may also
be used by providing a custom context function.
c � � |dk r| |dz
� � � nd}|t | � � dz
k r| |dz � � � nd}||fS )z;One left token and one right token, normalized to lowercaser � �*START*�*END*)�lower�len)�tokens�ir r s �+/usr/lib/python3/dist-packages/nltk/text.py�_default_contextzContextIndex._default_context. sf � � )*�Q���v�a�!�e�}�"�"�$�$�$�I��)*�c�&�k�k�A�o�)=�)=��q�1�u�
�#�#�%�%�%�7���e�}�� Nc � � | S �N� ��xs r$ �<lambda>zContextIndex.<lambda>5 s � �Q� r&