U
    e¾  ć                   @   s2   d dl Z d dlZd dlmZ G dd de jZdS )é    N)ŚCFGc                   @   s   e Zd Zdd Zdd ZdS )ŚChomskyNormalFormForCFGTestc                 C   s   t  d”}|  | ” ” |  | ” ” |jdd}|  | ” ” |  | ” ” t  d”}|  | ” ” |  | ” ” | ” }|  | ” ” |  | ” ” d S )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'
        T©Śflexiblez
          S -> NP VP
          NP -> VP N P
          VP -> P
          N -> 'dog' | 'cat'
          P -> 'on' | 'in'
        )r   Ś
fromstringŚassertFalseŚis_flexible_chomsky_normal_formŚis_chomsky_normal_formŚchomsky_normal_formŚ
assertTrue)ŚselfŚgrammarZgrammar2© r   ś`/var/www/html/assets/scripts/venv/lib/python3.8/site-packages/nltk/test/unit/test_cfg2chomsky.pyŚtest_simple   s     ’’	z'ChomskyNormalFormForCFGTest.test_simplec                 C   sT   t j d”}|  | ” ” |  | ” ” |jdd}|  | ” ” |  | ” ” d S )Nz grammars/large_grammars/atis.cfgTr   )ŚnltkŚdataŚloadr   r   r	   r
   r   )r   r   r   r   r   Śtest_complex+   s    z(ChomskyNormalFormForCFGTest.test_complexN)Ś__name__Ś
__module__Ś__qualname__r   r   r   r   r   r   r      s   #r   )Zunittestr   Znltk.grammarr   ZTestCaser   r   r   r   r   Ś<module>   s   