Class AugmentedGrammar

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byGrammar
              extended byAugmentedGrammar
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 Class Summary
 
Nested classes inherited from class java.util.HashMap
 
Nested classes inherited from class java.util.AbstractMap
 
Field Summary
 
Fields inherited from class Grammar
description
 
Fields inherited from class java.util.HashMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
AugmentedGrammar()
           
 
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 Grammar
dump, dump, getDescription, setDescription
 
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
 

Constructor Detail

AugmentedGrammar

public AugmentedGrammar()
Method Detail

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