Class AugmentedGrammar
java.lang.Object
java.util.AbstractMap
java.util.HashMap
Grammar
AugmentedGrammar
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- Direct Known Subclasses:
- HeadFeaturedGrammar
- public class AugmentedGrammar
- extends Grammar
An AugmentedGrammar is one whose rules are AugmentedGrammarRules (ie,
whose rules have constituents that are AugmentedConstituents).
The main difference from a basic Grammar is that the rules returned
by getRulesForConstituent() need to unify their rhs with the given
constituent (rather than just matching syntactic category) and they
need to be copied and the unifying substitution applied.
- See Also:
- Serialized Form
Nested classes inherited from class java.util.HashMap |
|
Nested classes inherited from class java.util.AbstractMap |
|
Fields inherited from class java.util.HashMap |
|
Fields inherited from class java.util.AbstractMap |
|
Method Summary |
void |
add(GrammarRule rule)
Adds the given AugmentedGrammarRule to this AugmentedGrammar. |
java.util.List |
getRulesForConstituent(Constituent constit)
Retrieve the List of GrammarRules whose first rhs constituent
unifies with the given AugmentedConstituent (and which have the
unifying subsitution applied). |
void |
readFile(java.lang.String filename)
Read the given filename and augment this AugmentedGrammar. |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
AugmentedGrammar
public AugmentedGrammar()
add
public void add(GrammarRule rule)
- Adds the given AugmentedGrammarRule to this AugmentedGrammar.
We override our parent's method for this operation in order to
ensure that only AugmentedGrammarRules are added to AugmentedGrammars.
We will throw a ClassCastException if the given object is not
a AugmentedGrammarRule. This is better than having it come up later
when we try to use the rule.
- Overrides:
add
in class Grammar
getRulesForConstituent
public java.util.List getRulesForConstituent(Constituent constit)
- Retrieve the List of GrammarRules whose first rhs constituent
unifies with the given AugmentedConstituent (and which have the
unifying subsitution applied).
- Overrides:
getRulesForConstituent
in class Grammar
readFile
public void readFile(java.lang.String filename)
throws java.io.IOException
- Read the given filename and augment this AugmentedGrammar.
- Overrides:
readFile
in class Grammar
- Throws:
java.io.IOException
- See Also:
AugmentedGrammarFileHandler