403Webshell
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/lunr/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/lunr/__pycache__/stemmer.cpython-311.pyc
�

WIbZ7��n�dZddlmZGd�d��Ze��Zdd�Zejed��dS)	a�
Implementation of Porter Stemming Algorithm from
https://tartarus.org/martin/PorterStemmer/python.txt

Note: The Python implementation returns different results than the JS
version:
- Stemming "lay" returns "lai" in Python, but "lay" in JS
- Stemming "try" returns "try" in Python, but "tri" in JS


Porter Stemming Algorithm
This is the Porter stemming algorithm, ported to Python from the
version coded up in ANSI C by the author. It may be be regarded
as canonical, in that it follows the algorithm presented in

Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
no. 3, pp 130-137,

only differing from it at the points maked --DEPARTURE-- below.

See also http://www.tartarus.org/~martin/PorterStemmer

The algorithm as described in the paper could be exactly replicated
by adjusting the points of DEPARTURE, but this is barely necessary,
because (a) the points of DEPARTURE are definitely improvements, and
(b) no encoding of the Porter stemmer I have seen is anything like
as exact as this version, even with the points of DEPARTURE!

Vivake Gupta (v@nano.com)

Release 1: January 2001

Further adjustments by Santiago Bruno (bananabruno@gmail.com)
to allow word input not restricted to one word per line, leading
to:

release 2: July 2008
�)�Pipelinec�p�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zdd�ZdS)�
PorterStemmerc�>�d|_d|_d|_d|_dS)a�The main part of the stemming algorithm starts here.
        b is a buffer holding a word to be stemmed. The letters are in b[k0],
        b[k0+1] ... ending at b[k]. In fact k0 = 0 in this demo program. k is
        readjusted downwards as the stemming progresses. Zero termination is
        not in fact used in the algorithm.

        Note that only lower case sequences are stemmed. Forcing to lower case
        should be done before stem(...) is called.
        �rN)�b�k�k0�j��selfs �./usr/lib/python3/dist-packages/lunr/stemmer.py�__init__zPorterStemmer.__init__,s$����������������c�"�|j|dksD|j|dks3|j|dks"|j|dks|j|dkrdS|j|dkr&||jkrdS|�|dz
��SdS)	z(cons(i) is TRUE <=> b[i] is a consonant.�a�e�i�o�ur�y�)rr
�cons�r
rs  rrzPorterStemmer.cons<s���
�F�1�I�����v�a�y�C����v�a�y�C����v�a�y�C����v�a�y�C����1��6�!�9�����D�G�|�|��q��9�9�Q��U�+�+�+�+��qrc�<�d}|j}	||jkr|S|�|��sn|dz}�)|dz}		||jkr|S|�|��rn|dz}�)|dz}|dz}	||jkr|S|�|��sn|dz}�)|dz}�d)aFm() measures the number of consonant sequences between k0 and j.
        if c is a consonant sequence and v a vowel sequence, and <..>
        indicates arbitrary presence,

           <c><v>       gives 0
           <c>vc<v>     gives 1
           <c>vcvc<v>   gives 2
           <c>vcvcvc<v> gives 3
           ....
        rr)r
rr)r
�nrs   r�mzPorterStemmer.mMs���
���G��	��4�6�z�z����9�9�Q�<�<�
���A��A�	�
��E��	�
��t�v�:�:��H��9�9�Q�<�<�����E��
��A��A��A��A�
��t�v�:�:��H��y�y��|�|�����E��
��A��A�	rc�v�t|j|jdz��D]}|�|��sdS�dS)z2vowelinstem() is TRUE <=> k0,...j contains a vowelrr)�ranger
rrrs  r�vowelinstemzPorterStemmer.vowelinstemrsF���t�w����
�+�+�	�	�A��9�9�Q�<�<�
��q�q�
��qrc��||jdzkrdS|j||j|dz
krdS|�|��S)z:doublec(j) is TRUE <=> j,(j-1) contain a double consonant.rr)r
rr)r
rs  r�doubleczPorterStemmer.doublecysH�����!�����1��6�!�9���q�1�u�
�%�%��1��y�y��|�|�rc���||jdzksE|�|��r0|�|dz
��s|�|dz
��sdS|j|}|dks|dks|dkrdSdS)acvc(i) is TRUE <=> i-2,i-1,i has the form consonant - vowel - consonant
        and also if the second c is not w,x or y. this is used when trying to
        restore an e at the end of a short  e.g.

           cav(e), lov(e), hop(e), crim(e), but
           snow, box, tray.
        �rr�w�xr)r
rr)r
r�chs   r�cvczPorterStemmer.cvc�s���
���1�����9�9�Q�<�<�
��y�y��Q����
��9�9�Q��U�#�#�
�
�1�
�V�A�Y��
��9�9��c�	�	�R�3�Y�Y��1��qrc��t|��}||dz
|j|jkrdS||j|jz
dzkrdS|j|j|z
dz|jdz�|krdS|j|z
|_dS)z3ends(s) is TRUE <=> k0,...k ends with the string s.rr)�lenrr	r
r�r
�s�lengths   r�endszPorterStemmer.ends�s����Q�����V�a�Z�=�D�F�4�6�N�*�*��1��T�V�d�g�%��)�*�*��1��6�$�&�6�/�A�%����
�2�3�q�8�8��1���&�����qrc��t|��}|jd|jdz�|z|j|j|zdzd�z|_|j|z|_dS)zJsetto(s) sets (j+1),...k to the characters in the string s, readjusting k.Nr)r*rrr	r+s   r�settozPorterStemmer.setto�sX���Q�������$�&�1�*��%��)�D�F�4�6�F�?�Q�3F�3H�3H�,I�I�����&�����rc�d�|���dkr|�|��dSdS)zr(s) is used further down.rN)rr0)r
r,s  r�rzPorterStemmer.r�s-���6�6�8�8�a�<�<��J�J�q�M�M�M�M�M��<rc��|j|jdkrx|�d��r|jdz
|_nS|�d��r|�d��n(|j|jdz
dkr|jdz
|_|�d��r+|���dkr|jdz
|_dSdS|�d	��s|�d
���rP|����r9|j|_|�d��r|�d��dS|�d
��r|�d��dS|�d��r|�d��dS|�|j��rF|jdz
|_|j|j}|dks|dks|dkr|jdz|_dSdS|���dkr5|�|j��r|�d��dSdSdSdSdS)a�step1ab() gets rid of plurals and -ed or -ing. e.g.

        caresses  ->  caress
        ponies    ->  poni
        ties      ->  ti
        caress    ->  caress
        cats      ->  cat

        feed      ->  feed
        agreed    ->  agree
        disabled  ->  disable

        matting   ->  mat
        mating    ->  mate
        meeting   ->  meet
        milling   ->  mill
        messing   ->  mess

        meetings  ->  meet
        r,�ssesr$�iesrr�eedr�ed�ing�at�ate�bl�ble�iz�ize�l�zrN)	rr	r.r0rr rr"r()r
r's  r�step1abzPorterStemmer.step1ab�s6��*�6�$�&�>�S� � ��y�y�� � �
$���!��������5�!�!�
$��
�
�3����������
�#�s�*�*���!�����9�9�U���	 ��v�v�x�x�!�|�|���!�������|��i�i��o�o�	 ����5�!1�!1�	 �t�7G�7G�7I�7I�	 ��V�D�F��y�y����
 ��
�
�5�!�!�!�!�!����4���

 ��
�
�5�!�!�!�!�!����4���
 ��
�
�5�!�!�!�!�!����d�f�%�%�
 ���!�����V�D�F�^����9�9��c�	�	�R�3�Y�Y�!�V�a�Z�D�F�F�F�.7�Y������Q���4�8�8�D�F�#3�#3���
�
�3������	 �	 �	 �	 ����rc���|�d��rJ|���r8|jd|j�dz|j|jdzd�z|_dSdSdS)zGstep1c() turns terminal y to i when there is another vowel in the stem.rNrr)r.r rr	rs r�step1czPorterStemmer.step1c�st���9�9�S�>�>�	C�d�.�.�0�0�	C��V�H�d�f�H�%��+�d�f�T�V�a�Z�\�\�.B�B�D�F�F�F�	C�	C�	C�	Crc���|j|jdz
dkrZ|�d��r|�d��d+S|�d��r|�d��d+Sd+S|j|jdz
dkrZ|�d��r|�d	��d+S|�d
��r|�d��d+Sd+S|j|jdz
dkr.|�d
��r|�d��d+Sd+S|j|jdz
dkr�|�d��r|�d��d+S|�d��r|�d��d+S|�d��r|�d��d+S|�d��r|�d��d+S|�d��r|�d��d+Sd+S|j|jdz
dkr�|�d��r|�d��d+S|�d��r|�d��d+S|�d��r|�d��d+Sd+S|j|jdz
dkr�|�d��r|�d��d+S|�d��r|�d ��d+S|�d!��r|�d"��d+S|�d#��r|�d��d+Sd+S|j|jdz
d$kr�|�d%��r|�d��d+S|�d&��r|�d ��d+S|�d'��r|�d��d+Sd+S|j|jdz
d(kr,|�d)��r|�d*��d+Sd+Sd+S),z�step2() maps double suffices to single ones.
        so -ization ( = -ize plus -ation) maps to -ize etc. note that the
        string before the suffix must give m() > 0.
        rr�ationalr:�tional�tion�c�enci�ence�anci�ancer�izerr>r?�blir<�alli�al�entli�ent�eli�ousli�ousr�ization�ation�atorr,�alism�iveness�ive�fulness�ful�ousness�t�aliti�iviti�biliti�g�logi�logN�rr	r.r2rs r�step2zPorterStemmer.step2�sQ��
�6�$�&�1�*���$�$��y�y��#�#�
����u�
�
�
�
�
����8�$�$�
����v������
�
�
�V�D�F�Q�J�
�3�
&�
&��y�y�� � �
����v���������6�"�"�
����v������
�
�
�V�D�F�Q�J�
�3�
&�
&��y�y�� � �
����u�
�
�
�
�
�
�
�
�V�D�F�Q�J�
�3�
&�
&��y�y����
����u�
�
�
�
�
����6�"�"�
����t���������7�#�#�
����u�
�
�
�
�
����5�!�!�
����s���������7�#�#�
����u�
�
�
�
�
�
�
�
�V�D�F�Q�J�
�3�
&�
&��y�y��#�#�
����u�
�
�
�
�
����7�#�#�
����u�
�
�
�
�
����6�"�"�
����u�
�
�
�
�
�
�
�
�V�D�F�Q�J�
�3�
&�
&��y�y��!�!�
����t���������9�%�%�
����u�
�
�
�
�
����9�%�%�
����u�
�
�
�
�
����9�%�%�
����u�
�
�
�
�
�
�
�
�V�D�F�Q�J�
�3�
&�
&��y�y��!�!�
����t���������7�#�#�
����u�
�
�
�
�
����8�$�$�
����u�
�
�
�
�
�
�
�
�V�D�F�Q�J�
�3�
&�
&��y�y�� � �
����u�
�
�
�
�
�'�
&�
�
rc�.�|j|jdkr�|�d��r|�d��dS|�d��r|�d��dS|�d��r|�d��dSdS|j|jdkr.|�d	��r|�d��dSdS|j|jd
krZ|�d��r|�d��dS|�d��r|�d��dSdS|j|jd
kr,|�d��r|�d��dSdSdS)zDstep3() dels with -ic-, -full, -ness etc. similar strategy to step2.r�icate�ic�ativer�alizerPr�icitir?�icalr]r,�nessNrfrs r�step3zPorterStemmer.step3s����6�$�&�>�S� � ��y�y��!�!�
����t���������7�#�#�
����r�
�
�
�
�
����7�#�#�
����t������
�
�
�V�D�F�^�s�
"�
"��y�y��!�!�
����t������
�
�
�V�D�F�^�s�
"�
"��y�y�� � �
����t���������5�!�!�
����r�
�
�
�
�
�
�
�
�V�D�F�^�s�
"�
"��y�y�� � �
����r�
�
�
�
�
�#�
"�
�
rc��|j|jdz
dkr|�d��r�n�dS|j|jdz
dkr0|�d��r�n�|�d��r�n�dS|j|jdz
dkr|�d	��r�nvdS|j|jdz
d
kr|�d��r�nDdS|j|jdz
dkr0|�d
��r�n|�d��r�n�dS|j|jdz
dkr^|�d��r�n�|�d��r�n�|�d��r�n�|�d��r�n�dS|j|jdz
dkr\|�d��r.|j|jdks|j|jdkr�n&|�d��r�ndS|j|jdz
dkr|�d��rn�dS|j|jdz
dkr.|�d��rn�|�d��rn�dS|j|jdz
dkr|�d��rnfdS|j|jdz
dkr|�d��rn5dS|j|jdz
d kr|�d!��rndSdS|���dkr|j|_dSdS)"z:step4() takes off -ant, -ence etc., in context <c>vcvc<v>.rrrPNrHrLrJr�errrjr?�able�ibler�ant�ement�mentrRr�ionr,r_�ou�ismr:�itirrU�vr[r@r>)rr	r.rrrs r�step4zPorterStemmer.step40s\���6�$�&�1�*���$�$��y�y����
����
�V�D�F�Q�J�
�3�
&�
&��y�y�� � �
�����6�"�"�
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
����
�V�D�F�Q�J�
�3�
&�
&��y�y�� � �
�����6�"�"�
����
�V�D�F�Q�J�
�3�
&�
&��y�y����	
�����7�#�#�
�����6�"�"�
�����5�!�!�
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
�T�V�D�F�^�s�%:�%:�d�f�T�V�n�PS�>S�>S�����4���
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
�����5�!�!�
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
����
�V�D�F�Q�J�
�3�
&�
&��y�y����
�����F��6�6�8�8�a�<�<��V�D�F�F�F��<rc��|j|_|j|jdkrL|���}|dks#|dkr,|�|jdz
��s|jdz
|_|j|jdkrC|�|j��r+|���dkr|jdz
|_dSdSdSdS)zYstep5() removes a final -e if m() > 1, and changes -ll to -l if
        m() > 1.
        rrr?N)r	rrrr(r")r
rs  r�step5zPorterStemmer.step5�s��������6�$�&�>�S� � ������A��1�u�u��a��������!��(<�(<����!�����6�$�&�>�S� � �T�\�\�$�&�%9�%9� �d�f�f�h�h��l�l��V�a�Z�D�F�F�F�!� � � �l�lrNc��d}t|��dz
}||_||_||_|j|jdzkr|jS|���|���|���|���|���|�	��|j|j|jdz�S)a�In stem(p,i,j), p is a char pointer, and the string to be stemmed
        is from p[i] to p[j] inclusive. Typically i is zero and j is the
        offset to the last character of a string, (p[j+1] == ''). The
        stemmer adjusts the characters p[i] ... p[j] and returns the new
        end-point of the string, k. Stemming never increases word length, so
        i <= k <= j. To turn the stemmer into a module, declare 'stem' as
        extern, and delete the remainder of this file.
        rr)
r*rr	r
rArCrgrpr}r)r
�p�metadatarrs     r�stemzPorterStemmer.stem�s���
����F�F�Q�J������������6�T�W�q�[� � ��6�M�	
���������
�
�
��
�
�����
�
�����
�
�����
�
�����v�d�g����
�*�+�+r)N)�__name__�
__module__�__qualname__rrrr r"r(r.r0r2rArCrgrpr}rr��rrrr+s��������� ���"#�#�#�J���������(
�
�
�!�!�!����
- �- �- �^C�C�C�
8�8�8�v���*P�P�P�d
 �
 �
 �,�,�,�,�,�,rrNc�@�|�tj��S)a"Wrapper around the PorterStemmer for inclusion in pipeline.

    Args:
        language (str): ISO-639-1 code of the language.
        token (lunr.Token): The token to stem.
        i (int): The index of the token in a set.
        tokens (list): A list of tokens representing the set.
    )�update�porter_stemmerr�)�tokenr�tokenss   r�stemmerr��s���<�<��+�,�,�,rr�)NN)�__doc__�
lunr.pipelinerrr�r��register_functionr�rr�<module>r�s���%�%�N#�"�"�"�"�"�B,�B,�B,�B,�B,�B,�B,�B,�J�����	-�	-�	-�	-����7�I�.�.�.�.�.r

Youez - 2016 - github.com/yon3zu
LinuXploit