public class VPPhraseSpec extends PhraseElement
This class defines a verb phrase. It is essentially
a wrapper around the PhraseElement class, with methods
for setting common constituents such as Objects.
For example, the setVerb method in this class sets
the head of the element to be the specified verb
From an API perspective, this class is a simplified version of the SPhraseSpec
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: If there is a complex verb group, a preModifer set at the VP level appears before the verb, while a preModifier set at the clause level appears before the verb group. Eg "Mary unfortunately will eat the apple" ("unfortunately" is clause preModifier) "Mary will happily eat the apple" ("happily" is VP preModifier)
NOTE: The setModifier method will attempt to automatically determine whether a modifier should be expressed as a PreModifier or PostModifier
Features (such as negated) must be accessed via the setFeature and
getFeature methods (inherited from NLGElement).
Features which are often set on VPPhraseSpec include
VPPhraseSpec are produced by the createVerbPhrase
method of a PhraseFactory
features| Constructor and Description |
|---|
VPPhraseSpec(NLGFactory phraseFactory)
create an empty clause
|
| Modifier and Type | Method and Description |
|---|---|
void |
addModifier(Object modifier)
Add a modifier to a verb phrase
Use heuristics to decide where it goes
|
NLGElement |
getIndirectObject()
Returns the indirect object of a clause (assumes there is only one)
|
NLGElement |
getObject()
Returns the direct object of a clause (assumes there is only one)
|
NLGElement |
getVerb() |
void |
setIndirectObject(Object indirectObject)
Set the indirect object of a clause (assumes this is the only direct indirect object)
|
void |
setObject(Object object)
Sets the direct object of a clause (assumes this is the only direct object)
|
void |
setVerb(Object verb)
sets the verb (head) of a verb phrase.
|
addComplement, addComplement, addFrontModifier, addFrontModifier, addPostModifier, addPostModifier, addPreModifier, addPreModifier, clearComplements, getChildren, getFrontModifiers, getHead, getPostModifiers, getPreModifiers, printTree, setComplement, setComplement, setDeterminer, setFrontModifier, setFrontModifier, setHead, 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 VPPhraseSpec(NLGFactory phraseFactory)
public void setVerb(Object verb)
public NLGElement getVerb()
public void setObject(Object object)
public NLGElement getObject()
public void setIndirectObject(Object indirectObject)
public NLGElement getIndirectObject()
public void addModifier(Object modifier)
addModifier in class PhraseElementCopyright © 2020. All Rights Reserved.