The Grammar class A generic Grammar class that contains a multimap. It maps a Grammar Phrase to a vector of Grammar Phrases. This denotes the definition of the Grammar Phrase to other Grammar Phrases. There may be more than one definition for a Grammar Phrase.
More...
#include <grammar.h>
The Grammar class A generic Grammar class that contains a multimap. It maps a Grammar Phrase to a vector of Grammar Phrases. This denotes the definition of the Grammar Phrase to other Grammar Phrases. There may be more than one definition for a Grammar Phrase.
Grammar::addRule Adds the specified relationship by creating and adding a pair in the multimap.
- Parameters
-
| define | This is the LHS of the definition. This is what is being defined, i.e. the key |
| rule | This is the RHS. This is the definition, i.e. the value NOTE: This will take care of the empty sentence definition |
Grammar::getDefiner Returns the phrase whose definition is the same as the one specified.
- Parameters
-
- Returns
- the phrase that corresponds to the rule NOTE: If the phrase is G_INVALID, then the definer was not found
Grammar::getDefinition Returns the definitions of the specified phrase.
- Parameters
-
| define | the phrase whose definitions are desired |
- Returns
- a vector of grammarphrases NOTE: If the vector is empty, then there were no definitions found
Grammar::removeRule Removes the specified rule by finding and deleting it from the multimap.
- Parameters
-
| define | The phrase that is defined by the rule |
| rule | The definition itself NOTE: No need for finding the exact position in the map. Just create a copy of the definition and pass it in. |
| std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const Grammar & |
G |
|
) |
| |
|
friend |
operator << insertion operator. Writes out the Grammar Structure to the out stream
- Parameters
-
| out | the output stream |
| G | the Grammar Structure |
- Returns
- the output stream reference
| std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const Grammar & |
G |
|
) |
| |
|
friend |
operator << insertion operator. Writes out the Grammar Structure to the out stream
- Parameters
-
| out | the output stream |
| G | the Grammar Structure |
- Returns
- the output stream reference
The documentation for this class was generated from the following files:
- Grammatica/Grammar Structure/Grammar-with-Map/grammar.h
- Grammatica/Grammar Structure/Grammar-with-Map/grammar.cpp