+
    ÖÇÜhÂ	  ã                   óf   € ^ RI t ^ RIt^ RIHt R	R ltR tR tRtR
R lt]	R8X  d
   ]! 4        R# R# )é    N)ÚNonterminalc                óÚ   € V'       g   V P                  4       pVf$   \        P                  ! 4       ^,          ^,
          p\        W.V4      pV'       d   \        P
                  ! WC4      pV# )aQ  
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.
)ÚstartÚsysÚgetrecursionlimitÚ_generate_allÚ	itertoolsÚislice)Úgrammarr   ÚdepthÚnÚiters   &&&& Ú5/usr/lib/python3/dist-packages/nltk/parse/generate.pyÚgenerater      sU   € ÷ Ø—‘“ˆØ‚}ä×&Ò&Ó(¨AÕ-°Õ2ˆä˜ '¨5Ó1€DçÜ×Ò Ó(ˆà€Kó    c              #   óæ   "  € V'       dB    \        W^ ,          V4       F'  p\        WR,          V4       F  pW4,           x € K  	  K)  	  R# . x € R#   \         d   p\        R4      ThRp?ii ; i5i)r   :é   NNz}The grammar has rule(s) that yield infinite recursion!
Eventually use a lower 'depth', or a higher 'sys.setrecursionlimit()'.N)Ú_generate_oner   ÚRecursionErrorÚRuntimeError)r   Úitemsr   Úfrag1Úfrag2Úerrors   &&&   r   r   r   )   sq   é € ßð		Ü& w°aµ¸%Ö@�Ü*¨7¸"µI¸uÖE�EØ�-Ô'ó Fó Að Œøô ô 	äðHóð ðûð	üs(   ‚	A1Œ>A Á
A1ÁA.ÁA)Á)A.Á.A1c              #   óâ   "  € V^ 8”  db   \        V\        4      '       dE   V P                  VR7       F,  p\        WP	                  4       V^,
          4       Rj  x€L
  K.  	  R# V.x € R# R#  L5i)r   )ÚlhsN)Ú
isinstancer   Úproductionsr   Úrhs)r   Úitemr   Úprods   &&& r   r   r   9   s_   é € Øˆq„yÜ�dœK×(Ò(Ø×+Ñ+°Ð+Ö5�Ü(¨·(±(³*¸eÀa½iÓH×HÒHó 6ð �&ŒLñ ñ Iùs   ‚AA/ÁA-ÁA/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                 ó  € ^ RI Hp \        RV 3,          4       \        \        4       VP	                  \        4      p\        \        W R7      ^4       F(  w  r4\        RVRP                  V4      3,          4       K*  	  R# )r   )ÚCFGz3Generating the first %d sentences for demo grammar:)r   z%3d. %sÚ N)Únltk.grammarr#   ÚprintÚdemo_grammarÚ
fromstringÚ	enumerater   Újoin)ÚNr#   r   r   Úsents   &    r   Údemor-   M   s]   € Ý ä	Ð
?À1À$Õ
FÔGÜ	Œ,ÔØ�n‰nœ\Ó*€GÜœX gÔ3°QÖ7‰ˆÜˆi˜1˜cŸh™h t›nÐ-Õ-Ö.ó 8r   Ú__main__)NNN)é   )
r	   r   r%   r   r   r   r   r'   r-   Ú__name__© r   r   Ú<module>r2      s?   ðó Û 
å $ôò0ò ð€ô/ð ˆzÔÙ†Fñ r   