
    Ng                         d dl mZ ddZdS )    )wordnetNengc                     t          |           |t          j        ||          }rfd|D             }|sdS t          fd|D                       \  }}|S )a  Return a synset for an ambiguous word in a context.

    :param iter context_sentence: The context sentence where the ambiguous word
         occurs, passed as an iterable of words.
    :param str ambiguous_word: The ambiguous word that requires WSD.
    :param str pos: A specified Part-of-Speech (POS).
    :param iter synsets: Possible synsets of the ambiguous word.
    :param str lang: WordNet language.
    :return: ``lesk_sense`` The Synset() object with the highest signature overlaps.

    This function is an implementation of the original Lesk algorithm (1986) [1].

    Usage example::

        >>> lesk(['I', 'went', 'to', 'the', 'bank', 'to', 'deposit', 'money', '.'], 'bank', 'n')
        Synset('savings_bank.n.02')

    [1] Lesk, Michael. "Automatic sense disambiguation using machine
    readable dictionaries: how to tell a pine cone from an ice cream
    cone." Proceedings of the 5th Annual International Conference on
    Systems Documentation. ACM, 1986.
    https://dl.acm.org/citation.cfm?id=318728
    N)langc                 ^    g | ])}t          |                                          k    '|*S  )strpos).0ssr
   s     D/var/www/html/ai-engine/env/lib/python3.11/site-packages/nltk/wsd.py
<listcomp>zlesk.<locals>.<listcomp>+   s1    @@@"3rvvxx==C+?+?2+?+?+?    c              3      K   | ]L}t                              |                                                                                    |fV  Md S )N)lenintersection
definitionsplit)r   r   contexts     r   	<genexpr>zlesk.<locals>.<genexpr>0   sc        EGW!!"--//"7"7"9"9::	;	;R@     r   )setr   synsetsmax)context_sentenceambiguous_wordr
   r   r   _senser   s     `    @r   leskr      s    2 "##G/.t<<<
 A@@@@@@@ t    KR    HAu Lr   )NNr   )nltk.corpusr   r   r   r   r   <module>r       s7          ' ' ' ' ' 'r   