Ë
    \›¾jL  ã                   ó\   — d Z ddlZddlmZmZ ddlmZmZ d„ Zd„ Z	d„ Z
edk(  r e
«        yy)	zÖInvokes the Java tokensregex on a document

This operates tokensregex on docs processed with stanza models.

https://nlp.stanford.edu/software/tokensregex.html

A minimal example is the main method of this module.
é    N)ÚTokensRegexRequestÚTokensRegexResponse)Úsend_requestÚadd_sentencec                 ó$   — t        | t        d«      S )Nz;edu.stanford.nlp.ling.tokensregex.ProcessTokensRegexRequest)r   r   )Úrequests    úc/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/stanza/server/tokensregex.pyÚsend_tokensregex_requestr
      s   € Ü˜Ô!4ØUóWð Wó    c                 ó<  — t        «       }|D ]  }|j                  j                  |«       Œ |j                  }| j                  |_        d}| j
                  D ]8  }t        |j                  ||«       |t        d„ |j                  D «       «      z   }Œ: t        |«      S )Nr   c              3   óF   K  — | ]  }t        |j                  «      –— Œ y ­w)N)ÚlenÚwords)Ú.0Útokens     r	   ú	<genexpr>zprocess_doc.<locals>.<genexpr>   s   è ø€ Ò%T¸5¤c¨%¯+©+×&6Ñ%Tùs   ‚!)r   ÚpatternÚappendÚdocÚtextÚ	sentencesr   ÚsentenceÚsumÚtokensr
   )r   Úpatternsr   r   Úrequest_docÚ
num_tokensr   s          r	   Úprocess_docr      s”   € Ü Ó"€GØò (ˆØ�‰×Ñ˜wÕ'ð(ð —+‘+€KØ—x‘x€KÔØ€JØ—M‘Mò UˆÜ�[×)Ñ)¨8°ZÔ@Ø¤#Ñ%TÀHÇOÁOÔ%TÓ"TÑT‰
ðUô $ GÓ,Ð,r   c                  ón   — t        j                  dd¬«      }  | d«      }t        t        |dd«      «       y )NÚenÚtokenize)Ú
processorsz0Uro ruined modern.  Fortunately, Wotc banned himÚhimÚruined)ÚstanzaÚPipelineÚprintr   )Únlpr   s     r	   Úmainr)   !   s5   € ô �/‰/˜$Ø%/ô1€Cñ Ð@Ó
A€CÜ	Œ+�c˜5 (Ó
+Õ,r   Ú__main__)Ú__doc__r%   Ústanza.protobufr   r   Ú$stanza.server.java_protobuf_requestsr   r   r
   r   r)   Ú__name__© r   r	   ú<module>r0      s9   ðñó ç Cß KòWò-ò-ð ˆzÒÙ…Fð r   