class documentation
class TestGrammar(object): (source)
Constructor: TestGrammar(grammar, suite, accept, reject)
Unit tests for CFG.
Method | __init__ |
Undocumented |
Method | run |
grammatical (accept) and |
Instance Variable | cp |
Undocumented |
Instance Variable | suite |
Undocumented |
Instance Variable | test |
Undocumented |
Instance Variable | _accept |
Undocumented |
Instance Variable | _reject |
Undocumented |
- Sentences in the test suite are divided into two classes:
- grammatical (accept) and
- ungrammatical (reject).
If a sentence should parse accordng to the grammar, the value of trees will be a non-empty list. If a sentence should be rejected according to the grammar, then the value of trees will be None.