JL iJddlZddlZddlmZGddejZy)N)CFGceZdZdZdZy)ChomskyNormalFormForCFGTestctjd}|j|j|j|j |j d}|j |j|j|j tjd}|j|j|j|j |j }|j |j|j |j y)Nz S -> NP VP PP -> P NP NP -> Det N | NP PP P VP -> V NP | VP PP VP -> Det Det -> 'a' | 'the' N -> 'dog' | 'cat' V -> 'chased' | 'sat' P -> 'on' | 'in' Tflexiblez S -> NP VP NP -> VP N P VP -> P N -> 'dog' | 'cat' P -> 'on' | 'in' )r fromstring assertFalseis_flexible_chomsky_normal_formis_chomsky_normal_formchomsky_normal_form assertTrue)selfgrammargrammar2s e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/nltk/test/unit/test_cfg2chomsky.py test_simplez'ChomskyNormalFormForCFGTest.test_simples..    @@BC 779:--t-< ??AB 779:>>   AACD 88:;//1 @@BC 779:c^tjjd}|j|j |j|j |j d}|j|j |j|j y)Nz grammars/large_grammars/atis.cfgTr)nltkdataloadr r r r r)rrs r test_complexz(ChomskyNormalFormForCFGTest.test_complex+s))..!CD @@BC 779:--t-< ??AB 779:rN)__name__ __module__ __qualname__rrrrrrs !;F;rr)unittestr nltk.grammarrTestCaserrrrr!s  *;("3"3*;r