public class NPPhraseSpec extends PhraseElement
This class defines a noun phrase. It is essentially a wrapper around the
PhraseElement class, with methods for setting common
constituents such as specifier. For example, the setNoun method
in this class sets the head of the element to be the specified noun
From an API perspective, this class is a simplified version of the
NPPhraseSpec class in simplenlg V3. It provides an alternative way for
creating syntactic structures, compared to directly manipulating a V4
PhraseElement.
Methods are provided for setting and getting the following constituents:
NOTE: The setModifier method will attempt to automatically determine whether a modifier should be expressed as a PreModifier, or PostModifier
NOTE: Specifiers are currently pretty basic, this needs more development
Features (such as number) must be accessed via the setFeature
and getFeature methods (inherited from NLGElement).
Features which are often set on NPPhraseSpec include
NPPhraseSpec are produced by the createNounPhrase
method of a PhraseFactory
features| Constructor and Description |
|---|
NPPhraseSpec(NLGFactory phraseFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addModifier(Object modifier)
Add a modifier to an NP Use heuristics to decide where it goes
|
NLGElement |
getDeterminer()
getDeterminer - Convenience method for when a person tries to get a
determiner (e.g.
|
NLGElement |
getNoun() |
NLGElement |
getSpecifier() |
void |
setDeterminer(Object determiner)
setDeterminer - Convenience method for when a person tries to set
a determiner (e.g.
|
void |
setHead(Object newHead)
Sets the head, or main component, of this current phrase.
|
void |
setNoun(Object noun)
sets the noun (head) of a noun phrase
|
void |
setSpecifier(Object specifier)
sets the specifier of a noun phrase.
|
addComplement, addComplement, addFrontModifier, addFrontModifier, addPostModifier, addPostModifier, addPreModifier, addPreModifier, clearComplements, getChildren, getFrontModifiers, getHead, getPostModifiers, getPreModifiers, printTree, setComplement, setComplement, setFrontModifier, setFrontModifier, setPostModifier, setPostModifier, setPreModifier, setPreModifierclearAllFeatures, equals, equals, getAllFeatureNames, getAllFeatures, getCategory, getFactory, getFeature, getFeatureAsBoolean, getFeatureAsDouble, getFeatureAsElement, getFeatureAsElementList, getFeatureAsFloat, getFeatureAsInteger, getFeatureAsList, getFeatureAsLong, getFeatureAsString, getFeatureAsStringList, getParent, getRealisation, getTense, hasFeature, isA, isNegated, isPlural, removeFeature, setCategory, setFactory, setFeature, setFeature, setFeature, setFeature, setFeature, setFeature, setNegated, setParent, setPlural, setRealisation, setTense, toStringpublic NPPhraseSpec(NLGFactory phraseFactory)
public void setHead(Object newHead)
PhraseElementStrings are converted to
StringElements. If null is passed in as the new
head then the head feature is removed.setHead in class PhraseElementnewHead - the new value for the head of this phrase.public void setNoun(Object noun)
public NLGElement getNoun()
public void setDeterminer(Object determiner)
setDeterminer in class PhraseElementdeterminer - the new determiner for the phrase.public NLGElement getDeterminer()
public void setSpecifier(Object specifier)
public NLGElement getSpecifier()
public void addModifier(Object modifier)
addModifier in class PhraseElementCopyright © 2020. All Rights Reserved.