simplenlg.features.InternalFeature Maven / Gradle / Ivy
Show all versions of SimpleNLG Show documentation
/*
* The contents of this file are subject to the Mozilla Public License
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* https://www.mozilla.org/en-US/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is "Simplenlg".
*
* The Initial Developer of the Original Code is Ehud Reiter, Albert Gatt and Dave Westwater.
* Portions created by Ehud Reiter, Albert Gatt and Dave Westwater are Copyright (C) 2010-11 The University of Aberdeen. All Rights Reserved.
*
* Contributor(s): Ehud Reiter, Albert Gatt, Dave Westwater, Roman Kutlak, Margaret Mitchell, and Saad Mahamood.
*/
package simplenlg.features;
/**
*
* This class defines a list of features internally used within the SimpleNLG
* system.
* Note that there are three feature classes in SimpleNLG.
*
* -
Feature
: features typically set up developers invoking SimpleNLG
* -
LexicalFeature
: features typically set up the SimpleNLG lexicon
* -
InternalFeature
: features typically used internally by SimpleNLG
*
*
* Elements in the system can, in theory, take any kind of feature. Some
* features will only be expected by certain processors, however.
* Developers can define their own features but should
* choose names that do not conflict with those presented here.
*
*
* The details for each feature are supplied in a table. The entries are:
*
*
*
* Feature name
* This is the name that will appear in the element's feature list as
* produced by the toString()
method or by calling
* getAllFeatureNames
*
*
* Expected type
* As features are represented as a Map
connecting a
* String
and an Object
then, in theory, a feature can
* take any object as a value. This table entry defines the type that the
* SimpleNLG system expects.
*
*
* Created by
* Defines where the feature is created. In addition, all features can be
* added specifically by users
*
*
* Used by
* Defines which processors use the feature.
*
*
* Applies to
* Defines which structural, syntactical or lexical elements this feature is
* applied to.
*
*
* Default
* Any default values attributed to the feature are given here.
*
*
*
*
* @author E. Reiter and D. Westwater, University of Aberdeen.
* @version 4.0
*/
@SuppressWarnings("nls")
public abstract class InternalFeature {
/**
*
* This feature determines if the element is an acronym.
*
*
*
* Feature name
* isAcronym
*
*
* Expected type
* Boolean
*
*
* Created by
* The phrase factory creates the feature on noun phrases. The syntax
* processor creates the feature on nouns.
*
*
* Used by
* No processors currently use this feature. It is expected to be used
* by the orthography processor.
*
*
* Applies to
* Nouns and noun phrases.
*
*
* Default
* Boolean.FALSE
*
*
*/
public static final String ACRONYM = "acronym";
/**
*
* This feature is used to reference the base word element as created by the
* lexicon.
*
*
*
* Feature name
* baseWord
*
*
* Expected type
* WordElement
*
*
* Created by
* Currently initially set by the syntax processor but should be done by
* the phrase factory with the syntax and morphology processors only setting
* this if the it doesn't already exist.
*
*
* Used by
* The syntax processor refers to the base word when determining
* adjective ordering. The morphology processor also needs the base word for
* performing morphology on the lexical items.
*
*
* Applies to
* InflectedWordElement
s of any category.
*
*
* Default
* null
*
*
*/
public static final String BASE_WORD = "base_word";
/**
*
* This feature determines the status of a sentence.
*
*
*
* Feature name
* clauseStatus
*
*
* Expected type
* ClauseStatus
*
*
* Created by
* The phrase factory creates this feature when creating sentences.
*
*
* Used by
* The syntax processor refers to the clause status when deciding
* whether to add the complementiser or not. Only subordinate clauses will
* have the complementiser added.
*
*
* Applies to
* Clauses.
*
*
* Default
* ClauseStatus.MATRIX
*
*
*/
public static final String CLAUSE_STATUS = "clause_status";
/**
*
* This feature refers to the list of complements for the phrase.
*
*
*
* Feature name
* complements
*
*
* Expected type
* List<NLGElement>
*
*
* Created by
* The phrase factory has the functionality for taking complements when
* creating prepositional phrases or sentences. Complements can also be
* added to other types of phrases by the user.
*
*
* Used by
* The syntax processor realises the complements in the correct
* syntactical order when realising phrases.
*
*
* Applies to
* Phrases of any type.
*
*
* Default
* ClauseStatus.MATRIX
*
*
*/
public static final String COMPLEMENTS = "complements";
/**
*
* This feature refers to the list of components in a
* ListElement
.
*
*
*
* Feature name
* components
*
*
* Expected type
* List<NLGElements>
*
*
* Created by
* The syntax processor creates ListElement
s with
* components. This is done as part of the normal realisation of phrases
* into a list of words. Components can be added by the user.
*
*
* Used by
* The syntax and morphology processors both access the components
* feature when realising ListElement
s.
*
*
* Applies to
* ListElement
s.
*
*
* Default
* null
*
*
*/
public static final String COMPONENTS = "components";
/**
*
* This feature is the list of coordinated phrases in a
* CoordinatedPhraseElement
.
*
*
*
* Feature name
* coordinates
*
*
* Expected type
* List<NLGElements>
*
*
* Created by
* CoordinatedPhraseElement
has convenience methods for
* adding the coordinate phrases to a particular.
*
*
* Used by
* The syntax processors creates the structure of coordinated phrases
* and adds in the conjoining word where appropriate.
*
*
* Applies to
* CoordinatedPhraseElements
s only.
*
*
* Default
* null
*
*
*/
public static final String COORDINATES = "coordinates";
/**
*
* This feature defines the role each element plays in the structure of the
* text. For example, the phrase John played football has
* John as the subject, play as the base verb and
* football as the complement.
*
*
*
* Feature name
* discourseFunction
*
*
* Expected type
* DiscourseFunction
*
*
* Created by
* The syntax processor defines the function of each word as it parses
* phrases.
*
*
* Used by
* The morphology processor uses the function when checking pronoun
* inflections.
*
*
* Applies to
* Any NLGElement but typically words.
*
*
* Default
* null
*
*
*/
public static final String DISCOURSE_FUNCTION = "discourse_function";
public static final String NON_MORPH = "non_morph";
/**
*
* This feature tracks any front modifiers in sentences. Front modifiers are
* placed after the cue phrase but before the subject.
*
*
*
* Feature name
* frontModifiers
*
*
* Expected type
* NLGElement
*
*
* Created by
* Front modifiers need to be manually added by users.
*
*
* Used by
* The syntax processor realises front modifiers in their correct place
* within the structure of the sentence.
*
*
* Applies to
* Sentences.
*
*
* Default
* null
*
*
*/
public static final String FRONT_MODIFIERS = "front_modifiers";
/**
*
* This feature points to the head element in a phrase. The head element is
* deemed to be the subject in a noun phrase, the verb in a verb phrase, the
* adjective in an adjective phrase, the adverb in an adverb phrase or the
* preposition in a preposition phrase. The PhraseElement
has a
* convenience method for getting and setting the head feature.
*
*
*
* Feature name
* phraseHead
*
*
* Expected type
* NLGElement
*
*
* Created by
* The phrase factory sets an appropriate head when constructing
* phrases.
*
*
* Used by
* The syntax processor uses the head element when constructing the
* correct syntax for the text. The head element is also important for
* determining the main verb in a verb group.
*
*
* Applies to
* Phrases.
*
*
* Default
* The value is set to an appropriate element by the phrase factory.
*
*
*/
public static final String HEAD = "head";
/**
*
* This flag is used to determine if the modal should be included in the
* verb phrase.
*
*
*
* Feature name
* ignoreModal
*
*
* Expected type
* Boolean
*
*
* Created by
* The syntax processor sets this flag when dealing with interrogatives.
*
*
*
* Used by
* The syntax processor will ignore modals on certain interrogatives.
*
*
* Applies to
* Coordinated phrases and verb phrases.
*
*
* Default
* Boolean.FALSE
*
*
*/
public static final String IGNORE_MODAL = "ignore_modal";
/**
*
* This flag determines if the sentence is interrogative or not.
*
*
*
* Feature name
* isInterrogative
*
*
* Expected type
* Boolean
*
*
* Created by
* The syntax processor sets this feature on sentences if a contained
* phrase is interrogative.
*
*
* Used by
* Orthography processor uses this to add a question mark instead of a
* period at the end of interrogative sentences.
*
*
* Applies to
* Sentences only.
*
*
* Default
* Boolean.FALSE
.
*
*
*/
public static final String INTERROGATIVE = "interrogative";
/**
*
* This feature represents the list of post-modifier elements.
* Post-modifiers are added to the end of phrases and coordinated phrases.
*
*
*
* Feature name
* postModifiers
*
*
* Expected type
* List<NLGElement>
*
*
* Created by
* The user specifies the post-modifiers. Convenience methods are added.
*
*
*
* Used by
* The syntax processor correctly adds the post-modifiers into the
* structure of the text.
*
*
* Applies to
* Clauses, phrases and coordinated phrases.
*
*
* Default
* null
.
*
*
*/
public static final String POSTMODIFIERS = "postmodifiers";
/**
*
* This feature represents the list of premodifier elements. Premodifiers
* are added to phrases before the head of the phrase, and to coordinated
* phrases before the coordinates.
*
*
*
* Feature name
* preModifiers
*
*
* Expected type
* List<NLGElement>
*
*
* Created by
* The user specifies the premodifiers. Convenience methods are added.
*
*
* Used by
* The syntax processor correctly adds the premodifiers into the
* structure of the text.
*
*
* Applies to
* Clauses, phrases and coordinated phrases.
*
*
* Default
* null
.
*
*
*/
public static final String PREMODIFIERS = "premodifiers";
/**
*
* This flag is used to define whether a noun phrase has had its specifier
* raised. It is used in conjunction with the RAISE_SECIFIER
* feature.
*
*
*
* Feature name
* isRaised
*
*
* Expected type
* Boolean
*
*
* Created by
* The syntax processor sets this flag on noun phrases when processing
* coordinated phrases whose specifier has been raised.
*
*
* Used by
* The syntax processor to correctly add or remove specifiers.
*
*
* Applies to
* Noun phrases only.
*
*
* Default
* Boolean.FALSE
*
*
*/
public static final String RAISED = "raised";
/**
*
* This flag determines if auxiliary verbs should be realised in coordinated
* verb phrases.
*
*
*
* Feature name
* isRealiseAuxiliary
*
*
* Expected type
* Boolean
*
*
* Created by
* The syntax processor sets this flag on verb phrases when processing
* coordinated phrases which has had the AGGREGATE_AUXILIARY
* feature set.
*
*
* Used by
* The syntax processor to correctly add or ignore auxiliary verbs in
* verb phrases.
*
*
* Applies to
* Verb phrases only.
*
*
* Default
* Boolean.FALSE
*
*
*/
public static final String REALISE_AUXILIARY = "realise_auxiliary";
/**
*
* This feature contains the specifier for a noun phrase. For example
* the and my.
*
*
*
* Feature name
* specifier
*
*
* Expected type
* NLGElement
or String
*
*
* Created by
* Specifiers are added to noun phrases when they are constructed by the
* phrase factory.
*
*
* Used by
* The syntax processor places specifiers before the main subject in a
* noun phrase.
*
*
* Applies to
* Noun phrases only.
*
*
* Default
* null
*
*
*/
public static final String SPECIFIER = "specifier";
/**
*
* This feature represents the list of subjects in a clause.
*
*
*
* Feature name
* subjects
*
*
* Expected type
* List<NLGElement>
*
*
* Created by
* Subjects are added to clauses through the phrase factory.
*
*
* Used by
* The syntax processor realises all subjects in the correct place.
*
*
* Applies to
* Clauses only.
*
*
* Default
* null
.
*
*
*/
public static final String SUBJECTS = "subjects";
/**
*
* This feature represents the verb phrase in a clause.
*
*
*
* Feature name
* verbPhrase
*
*
* Expected type
* NLGElement
, typically a PhraseElement
, but
* can also be a String
*
*
* Created by
* The verb phrase is added to clauses through the phrase factory.
*
*
* Used by
* The syntax processor realises the verb phrase in the correct place.
*
*
* Applies to
* Clauses only.
*
*
* Default
* null
.
*
*
*/
public static final String VERB_PHRASE = "verb_phrase";
/**
* The constructor is never needed.
*/
private InternalFeature() {
// do nothing
}
}