§
    íóÉjÇ  ã                   ó„   — d dl Z d dlZd dlmZ dZ G d„ d¦  «        Zdd„Zd„ Zd„ Zd	Z	dd„Z
edk    r e
¦   «          dS dS )é    N)ÚNonterminali@B c                   ó"   — e Zd ZdZdZd„ Zd„ ZdS )Ú_GenerationBudgetzßCounts derivation-expansion steps and aborts runaway generation.

    The whole enumeration shares one budget, so it bounds total work however
    the caller consumes the iterator (one ``next()`` or a full ``list()``).
    ©Ú	remainingÚlimitc                 ó"   — || _         || _        d S )Nr   )Úselfr   s     úv/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/nltk/parse/generate.pyÚ__init__z_GenerationBudget.__init__$   s   € ØˆŒØˆŒ
ˆ
ˆ
ó    c                 ój   — | xj         dz  c_         | j         dk     rt          d| j        z  ¦  «        ‚d S )Né   r   a'  Refusing to generate further: a recursive grammar can derive an exponential number of sentences, and generation exceeded the limit of %d derivation-expansion steps (CWE-400). Pass a smaller 'depth' or 'n', remove cyclic/self-embedding rules, or raise nltk.parse.generate.MAX_GENERATE_OPERATIONS.)r   Ú
ValueErrorr   )r
   s    r   Úspendz_GenerationBudget.spend(   sN   € ØˆŒ˜!ÑˆŒØŒ>˜AÒÐÝðEð HLÄzñ	Rñô ð ð Ðr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   © r   r   r   r      sC   € € € € € ðð ð '€Iðð ð ð	ð 	ð 	ð 	ð 	r   r   c                 óä   — |s|                       ¦   «         }|€t          j        ¦   «         dz  dz
  }t          t          ¦  «        }t          | |g||¦  «        }|�t          j        ||¦  «        }|S )a=  
    Generates an iterator of all sentences from a CFG.

    :param grammar: The Grammar used to generate sentences.
    :param start: The Nonterminal from which to start generate sentences.
    :param depth: The maximal depth of the generated tree.
    :param n: The maximum number of sentences to return.
    :return: An iterator of lists of terminal tokens.
    :raise ValueError: if generation exceeds ``MAX_GENERATE_OPERATIONS``
        derivation-expansion steps, which a recursive grammar reaches with
        the default ``depth`` and no ``n`` limit (CWE-400).
    Né   )ÚstartÚsysÚgetrecursionlimitr   ÚMAX_GENERATE_OPERATIONSÚ_generate_allÚ	itertoolsÚislice)Úgrammarr   ÚdepthÚnÚbudgetÚiters         r   Úgenerater&   4   sw   € ð ð  Ø—’‘”ˆØ€}åÔ&Ñ(Ô(¨AÑ-°Ñ2ˆåÕ6Ñ7Ô7€FÝ˜ 5 '¨5°&Ñ9Ô9€Dð 	€}ÝÔ  aÑ(Ô(ˆà€Kr   c              #   ó  K  — |rx	 t          | |d         ||¦  «        D ]:}t          | |dd …         ||¦  «        D ]}|                     ¦   «          ||z   V — ŒŒ;d S # t          $ r}t	          d¦  «        |‚d }~ww xY wg V — d S )Nr   r   z}The grammar has rule(s) that yield infinite recursion!
Eventually use a lower 'depth', or a higher 'sys.setrecursionlimit()'.)Ú_generate_oner   r   ÚRecursionErrorÚRuntimeError)r!   Úitemsr"   r$   Úfrag1Úfrag2Úerrors          r   r   r   R   s×   è è € Øð ð	Ý& w°°a´¸%ÀÑHÔHð (ð (�Ý*¨7°E¸!¸"¸"´I¸uÀfÑMÔMð (ð (�Eð —L’L‘N”N�NØ %™-Ð'Ð'Ð'Ð'ð(ð(ð (øõ ð 	ð 	ð 	åðHñô ð ðøøøøð	øøøð ˆˆˆˆˆs   †AA Á
A:Á%A5Á5A:c              #   ó  K  — |                      ¦   «          |dk    rdt          |t          ¦  «        rH|                      |¬¦  «        D ]/}t	          | |                     ¦   «         |dz
  |¦  «        E d {V —† Œ0d S |gV — d S d S )Nr   )Úlhsr   )r   Ú
isinstancer   Úproductionsr   Úrhs)r!   Úitemr"   r$   Úprods        r   r(   r(   h   s«   è è € ð ‡L‚L�N„N€NØˆq‚y€yÝ�d�KÑ(Ô(ð 	Ø×+Ò+°Ð+Ñ5Ô5ð Qð Q�Ý(¨°$·(²(±*´*¸eÀa¹iÈÑPÔPÐPÐPÐPÐPÐPÐPÐPÐPðQð Qð �&ˆLˆLˆLˆLˆLð €yr   zš
  S -> NP VP
  NP -> Det N
  PP -> P NP
  VP -> 'slept' | 'saw' NP | 'walked' PP
  Det -> 'the' | 'a'
  N -> 'man' | 'park' | 'dog'
  P -> 'in' | 'with'
é   c                 ó,  — ddl m} t          d| fz  ¦  «         t          t          ¦  «         |                     t          ¦  «        }t          t          || ¬¦  «        d¦  «        D ],\  }}t          d|d                     |¦  «        fz  ¦  «         Œ-d S )Nr   )ÚCFGz3Generating the first %d sentences for demo grammar:)r#   r   z%3d. %sú )Únltk.grammarr8   ÚprintÚdemo_grammarÚ
fromstringÚ	enumerater&   Újoin)ÚNr8   r!   r#   Úsents        r   ÚdemorB      s¢   € Ø Ð Ð Ð Ð Ð å	Ð
?À1À$Ñ
FÑGÔGÐGÝ	�,ÑÔÐØ�nŠn�\Ñ*Ô*€GÝ�X g°Ð3Ñ3Ô3°QÑ7Ô7ð /ð /‰ˆˆ4Ýˆi˜1˜cŸhšh t™nœnÐ-Ñ-Ñ.Ô.Ð.Ð.ð/ð /r   Ú__main__)NNN)r6   )r   r   r:   r   r   r   r&   r   r(   r<   rB   r   r   r   r   ú<module>rD      sÏ   ðð Ð Ð Ð Ø 
€
€
€
à $Ð $Ð $Ð $Ð $Ð $ð $Ð ðð ð ð ð ñ ô ð ð2ð ð ð ð<ð ð ð,	ð 	ð 	ð€ð/ð /ð /ð /ð ˆzÒÐØ€D�F„F€F€F€Fð Ðr   