| 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/lunr/__pycache__/ |
Upload File : |
�
WIb\
� �R � d dl mZ d dlmZ d dlmZ d dlmZ d dl m
Z
d d�Z d
d�ZdS )� )� languages)�Builder)�stemmer)�trimmer)�stop_word_filterNc � � |pt |� � }|� | � � |D ]:}t |t � � r |j di |�� �%|� |� � �;|D ]W}t |t
t f� � r$|� |d |d �� � �B|� |� � �X|� � � S )a A convenience function to configure and construct a lunr.Index.
Args:
ref (str): The key in the documents to be used a the reference.
fields (list): A list of strings defining fields in the documents to
index. Optionally a list of dictionaries with three keys:
`field_name` defining the document's field, `boost` an integer
defining a boost to be applied to the field, and `extractor`
a callable taking the document as a single argument and returning
a string located in the document in a particular way.
documents (list): The list of dictonaries representing the documents
to index. Optionally a 2-tuple of dicts, the first one being
the document and the second the associated attributes to it.
languages (str or list, optional): The languages to use if using
NLTK language support, ignored if NLTK is not available.
Returns:
Index: The populated Index ready to search against.
r � )�
attributes� ) �get_default_builder�ref�
isinstance�dict�field�tuple�list�add�build)r
�fields� documentsr �builderr �documents �//usr/lib/python3/dist-packages/lunr/__main__.py�lunrr s� � �( �7�,�Y�7�7�G��K�K������ !� !���e�T�"�"� !��G�M�"�"�E�"�"�"�"��M�M�%� � � � �� "� "���h���
�.�.� "��K�K�������K�<�<�<�<��K�K��!�!�!�!��=�=�?�?�� c �L � | ��t j r�t | t � � r| g} t | � � t t j � � z
}|ret
d� d� |� � d� t j � � � � � � � � � �t j
| � � }nXt � � }|j �
t t t � � |j �
t � � |S )zmCreates a new pre-configured instance of Builder.
Useful as a starting point to tweak the defaults.
NzEThe specified languages {} are not supported, please choose one of {}z, )�lang�LANGUAGE_SUPPORTr �str�set�SUPPORTED_LANGUAGES�RuntimeError�format�join�keys�get_nltk_builderr �pipeliner r r r �search_pipeline)r �unsupported_languagesr s r r r - s� � �
���!6���i��%�%� $�"��I� #�I����T�5M�1N�1N� N�� � ��*�*0�&��I�I�3�4�4��I�I�d�6�;�;�=�=�>�>�+� +�� �
� �'� �2�2����)�)������W�&6��@�@�@���#�#�G�,�,�,��Nr )NN)N)r r r �lunr.builderr �lunr.stemmerr �lunr.trimmerr �lunr.stop_word_filterr r r r r �<module>r. s� �� "� "� "� "� "� "� � � � � � � � � � � � � � � � � � � 2� 2� 2� 2� 2� 2�"� "� "� "�J� � � � � r