| 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/lm/__pycache__/ |
Upload File : |
�
T�c � �v � d dl mZ d dlmZ d dlmZmZ ej Z eedddd�� � Z de _
d � Zd
� ZdS )� )�partial)�chain)�
everygrams�pad_sequenceTz<s>z</s>)�pad_left�left_pad_symbol� pad_right�right_pad_symbolz�Pads both ends of a sentence to length specified by ngram order.
Following convention <s> pads the start of sentence </s> pads its end.
c �\ � t t t || �� � � � | �� � S )zpHelper with some useful defaults.
Applies pad_both_ends to sentence and follows it up with everygrams.
��n��max_len)r �list�
pad_both_ends)�order�sentences �7/usr/lib/python3/dist-packages/nltk/lm/preprocessing.py�padded_everygramsr s, � �
�d�=��U�;�;�;�<�<�e�L�L�L�L� c � � �� t t � �� � �� �fd�|D � � t t �|� � � � fS )a� Default preprocessing for a sequence of sentences.
Creates two iterators:
- sentences padded and turned into sequences of `nltk.util.everygrams`
- sentences padded as above and chained together for a flat stream of words
:param order: Largest ngram length produced by `everygrams`.
:param text: Text to iterate over. Expected to be an iterable of sentences.
:type text: Iterable[Iterable[str]]
:return: iterator over text as ngrams, iterator over text as vocabulary data
r c 3 �f �K � | ]+}t t �|� � � � �� � � V � �,dS )r N)r r )�.0�sentr �
padding_fns ��r � <genexpr>z,padded_everygram_pipeline.<locals>.<genexpr>1 sB �� � � �L�L�t��D���D�)�)�*�*�E� :� :� :�L�L�L�L�L�Lr )r r �flatten�map)r �textr s ` @r �padded_everygram_pipeliner "