Natural Language Processing  0.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
cfgzero.h
1 #ifndef CFGZERO_H
2 #define CFGZERO_H
3 #include "grammar.h"
4 /* HOW THE GRAPH WORKS
5  * Each Node represents either the left or right sides of the definition
6  * The first Label of the edge indicates which phrase in the node is the source of the edge
7  * The second label indicates the destination phrase in the connected node
8  * (Ex: For the very first definition, we have S->NP+VP.
9  * Let's say the next definition is NP->D+NN.
10  * Then there will be an edge from the NPVP node to the DNN node.
11  * To indicate the source and the destination, the edge label will say NP:ALL
12  * to indicate that the edge is from NP specifically (not VP) and goes to the entirety of the node.
13  * Now for a definition like NP->D+NN, NN->N+NN, NN->N, there is some recursion in the definition,
14  * i.e. NP->D+(N+(N+(...))). So to indicate the source and destination for the edges, we write
15  * From NPVP to DNN, A:NP,B:Default; From DNN to NNN, A:NN,B:Default; From DNN to N, A:NN,B:Default;
16  * From NNN to DNN, A:NN,B:NN; (Default will be represented as ALL)
17  */
18 
19 
23 class CFGZero:public Grammar{
24 private:
25  void createCFG();
26 public:
27  CFGZero();
28 };
29 /* The Simplest Context-Free Grammar defined in the Book: L0
30  * Sentence -> Noun Phrase + Verb Phrase
31  * Noun Phrase -> Pronoun
32  * Noun Phrase -> Proper Noun
33  * Noun Phrase -> Determiner + Nominal
34  * Nominal -> Noun + Nominal
35  * Nominal -> Noun
36  * Verb Phrase -> Verb
37  * Verb Phrase -> Verb + Noun Phrase
38  * Verb Phrase -> Verb + Noun Phrase + Preposition Phrase
39  * Verb Phrase -> Verb + Preposition Phrase
40  * Preposition Phrase -> Preposition + Noun Phrase
41  *
42  * Follow beginning at Sentence and substitute each part on the Right Hand Side
43  * With their respective definitions.
44  * Once you get down to the lowest level (The Part of Speech Level) you are done
45  * After that you can link each part of speech that appears in the tree with their
46  * respective word
47  *
48  * For Imperatives (Commands), there are additional definitions:
49  * Sentence -> Verb Phrase
50  *
51  * For more advanced structures, there will be adjectives and adverbs to describe
52  * Along with quantifiers to provide features for the words (ie ten, many, the color red)
53  */
54 #endif // CFGZERO_H
CFGZero()
CFGZero::CFGZero Constructor. Calls createCFG()
Definition: cfgzero.cpp:14
The CFGZero class a child of Grammar. IT is the Context Free Grammar Structure of Order Zero...
Definition: cfgzero.h:23
The Grammar class A generic Grammar class that contains a multimap. It maps a Grammar Phrase to a vec...
Definition: grammar.h:24