All Downloads are FREE. Search and download functionalities are using the official Maven repository.

simplenlg.features.LexicalFeature Maven / Gradle / Ivy

The newest version!
/*
 * 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;

import simplenlg.framework.ElementCategory;
import simplenlg.framework.LexicalCategory;
import simplenlg.framework.PhraseCategory;

/**
 * 

* This class defines a list of constant values used by SimpleNLG lexicons. 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 nameThis is the name that will appear in the element's feature list as * produced by the toString() method or by calling * getAllFeatureNames
Expected typeAs 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 byDefines where the feature is created. In addition, all features can be * added specifically by users
Used byDefines which processors use the feature.
Applies toDefines which structural, syntactical or lexical elements this feature is * applied to.
DefaultAny 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 LexicalFeature { /** *

* This feature is used to map an acronym element to the full forms of the * acronym. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameacronymOf
Expected typeList
Created byLexicons that support acronyms should set this feature.
Used byNo processors currently use this feature.
Applies toAny lexical item.
Defaultnull
*/ public static final String ACRONYM_OF = "acronym_of"; /** *

* This feature is used to map a word to its acronyms. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameacronyms
Expected typeList
Created byLexicons that support acronyms should set this feature.
Used byNo processors currently use this feature.
Applies toAny lexical item.
Defaultnull
*/ public static final String ACRONYMS = "acronyms"; /* *

This feature is used to list all the possible inflectional variants * of a word. For example, the word fish can be both uncount * (plural: fish) and reg (plural: fishes).

* * * *
Feature name infl
Expected typeList
Created * by Lexicons that support inflectional variants should set * this feature.
Used by No processors * currently use this feature.
Applies toAny lexical item.
Defaultnull
*/ // public static final String INFLECTIONS = "infl"; /** *

* This feature is used to specify, for a given word, what its default * inflectional variant is, if more than one is possible. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namedefault_infl
Expected typeInflection
Created byLexicons that support multiple inflectional variants should set this * feature.
Used by{@link simplenlg.morphology.english.MorphologyProcessor}.
Applies toNouns and verbs.
Defaultnull
*/ public static final String DEFAULT_INFL = "default_infl"; /** *

* This feature is used to specify the spelling variants of a word. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namespell_vars
Expected typeList
Created byLexicons that support multiple spelling variants should set this * feature.
Used byNo processors currently use this feature.
Applies toAny lexical item.
Defaultnull
*/ public static final String SPELL_VARS = "spell_vars"; /** *

* This feature is used to specify the default spelling variant of a word, * if it has more than one. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namedefault_spell
Expected typeString
Created byLexicons that support multiple spelling variants should set this * feature.
Used by{@link simplenlg.morphology.english.MorphologyProcessor}
Applies toAny lexical item.
Defaultnull
*/ public static final String DEFAULT_SPELL = "default_spell"; /** *

* This feature is used to define the base form for phrases and words. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namebaseForm
Expected typeString
Created byThe lexicon accessor also creates the feature when looking up words * in the lexicon. Sometimes the phrase factory sets this feature as well, * as an approximate realisation for debuggin purposes
Used byThe morphology processor uses the base form in its simple rules for * determining word inflection. The morphology processor and syntax * processor also use the base form for lexicon look ups if the base word * has not been set. Base forms on phrases are purely to aid debugging.
Applies toPhrases and words.
Defaultnull
*/ public static final String BASE_FORM = "base_form"; /** *

* This feature is used for determining the position of adjectives. Setting * this value to true means that the adjective can occupy the * classifying position. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameclassifying
Expected typeBoolean
Created byAny lexicon that supports adjective positioning.
Used byThe syntax processor to determine the ordering of adjectives.
Applies toAdjectives within noun phrases.
DefaultBoolean.FALSE
*/ public static final String CLASSIFYING = "classifying"; /** *

* This feature is used for determining the position of adjectives. Setting * this value to true means that the adjective can occupy the * colour position. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namecolour
Expected typeBoolean
Created byAny lexicon that supports adjective positioning.
Used byThe syntax processor to determine the ordering of adjectives.
Applies toAdjectives within noun phrases.
DefaultBoolean.FALSE
*/ public static final String COLOUR = "colour"; /** *

* This feature gives the comparative form for adjectives and adverbs. For * example, dizzier is the comparative form of dizzy, * fatter is the comparative form of fat and * earlier is the comparative form of early. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namecomparative
Expected typeString
Created byCan be created automatically by the lexicon or added manually by * users.
Used byThe morphology processor uses this information to correctly inflect * words.
Applies toAdjectives and adverbs only.
Defaultnull
*/ public static final String COMPARATIVE = "comparative"; /** *

* This feature determines if a verb is ditransitive, meaning that it can * have a subject, direct object and indirect object. For example in the * phrase he gave Mary ten pounds, the verb give has three * components: the subject is the person doing the giving (he), the * direct object is the object being passed (ten pounds) and the * indirect object is the recipient (Mary). *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameditransitive
Expected typeBoolean
Created byThe feature is set by the lexicon if it supports the recording of the * transitive nature of verbs.
Used byThe ditransitive value is currently not used.
Applies toVerbs only.
DefaultBoolean.FALSE
*/ public static final String DITRANSITIVE = "ditransitive"; /** *

* This feature determines whether a noun is masculine, feminine or neuter * in nature. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namegender
Expected typeGender
Created byThe phrase factory creates the gender of pronouns when creating * phrases and on all nouns within a noun phrase.
Used byThe syntax processor ensures that the head noun in a noun phrase has * a gender matching that applied to the phrase as a whole. The morphology * processor uses gender to determine the appropriate form for pronouns and * for setting the form of some verbs.
Applies toSpecifically it applies to nouns and pronouns but the feature is also * written to noun phrases and verbs.
DefaultGender.NEUTER
*/ public static final String GENDER = "gender"; /** *

* This flag determines if an adverb is an intensifier, such as * very. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameintensifier
Expected typeBoolean
Created byThe information is read from Lexicons that support this feature.
Used byCurrently not used.
Applies toAdverbs only.
DefaultBoolean.FALSE.
*/ public static final String INTENSIFIER = "intensifier"; /** *

* This flag highlights a verb that can only take a subject and no objects. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameintransitive
Expected typeBoolean
Created byThe information is read from Lexicons that support this feature.
Used byCurrently not used.
Applies toVerbs only.
DefaultBoolean.FALSE.
*/ public static final String INTRANSITIVE = "intransitive"; /* *

This feature represents non-countable nouns such as mud, * sand and water.

* * * * *
Feature name nonCount
Expected type Boolean
Created by Supporting lexicons.
Used by The morphology processor will not pluralise * non-countable nouns.
Applies to Nouns * only.
DefaultBoolean.FALSE.
*/ // public static final String NON_COUNT = "nonCount"; /** *

* This feature gives the past tense form of a verb. For example, the past * tense of eat is ate, the past tense of walk is * walked. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namepast
Expected typeString
Created byAll supporting lexicons but can be set by the user for irregular * cases.
Used byThe morphology processor uses this feature to correctly inflect * verbs. This feature will be looked at first before any reference to * lexicons or morphology rules.
Applies toVerbs and verb phrases only.
Defaultnull.
*/ public static final String PAST = "past"; /** *

* This feature gives the past participle tense form of a verb. For many * verbs the past participle is exactly the same as the past tense, for * example, the verbs talk, walk and say have * past tense and past participles of talked, walked and * said. Contrast this with the verbs do, eat and * sing. The past tense of these verbs is did, * ate and sang respectively. while the respective past * participles are done, eaten and sung *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namepastParticiple
Expected typeString
Created byAll supporting lexicons but can be set by the user for irregular * cases.
Used byThe morphology processor uses this feature to correctly inflect * verbs. This feature will be looked at first before any reference to * lexicons or morphology rules.
Applies toVerbs and verb phrases only.
Defaultnull.
*/ public static final String PAST_PARTICIPLE = "pastParticiple"; /** *

* This feature gives the plural form of a noun. For example, the plural of * dog is dogs and the plural of sheep is * sheep. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameplural
Expected typeString
Created byAll supporting lexicons but can be set by the user for irregular * cases.
Used byThe morphology processor uses this feature to correctly inflect * plural nouns. This feature will be looked at first before any reference * to lexicons or morphology rules.
Applies toNouns only.
Defaultnull.
*/ public static final String PLURAL = "plural"; /** *

* This flag is set on adjectives that can also be used as a predicate. For * example happy. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namepredicative
Expected typeBoolean
Created byAny supporting lexicon.
Used byCurrently not used.
Applies toAdjectives only.
DefaultBoolean.FALSE.
*/ public static final String PREDICATIVE = "predicative"; /** *

* This feature gives the present participle form of a verb. For example, * the present participle form of eat is eating and the * present participle form of walk is walking. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namepresentParticiple
Expected typeString
Created byAll supporting lexicons but can be set by the user for irregular * cases.
Used byThe morphology processor uses this feature to correctly inflect * verbs. This feature will be looked at first before any reference to * lexicons or morphology rules.
Applies toVerbs only.
Defaultnull.
*/ public static final String PRESENT_PARTICIPLE = "presentParticiple"; /** *

* This feature gives the present third person singular form of a verb. For * example, the present participle form of eat is eats as * in the dog eats. Another example is ran being the * present third person singular form of run as in * John ran home. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namepresent3s
Expected typeString
Created byAll supporting lexicons but can be set by the user for irregular * cases.
Used byThe morphology processor uses this feature to correctly inflect * verbs. This feature will be looked at first before any reference to * lexicons or morphology rules.
Applies toVerbs only.
Defaultnull.
*/ public static final String PRESENT3S = "present3s"; /** *

* This flag is used to determine whether a noun is a proper noun, such as a * person's name. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameproper
Expected typeBoolean
Created byCan be set by supporting lexicons or by the user.
Used byThe morphology processor will not pluralise proper nouns.
Applies toNouns only.
DefaultBoolean.FALSE.
*/ public static final String PROPER = "proper"; /** *

* This feature is used for determining the position of adjectives. Setting * this value to true means that the adjective can occupy the * qualitative position. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namequalitative
Expected typeBoolean
Created byAny lexicon that supports adjective positioning.
Used byThe syntax processor to determine the ordering of adjectives.
Applies toAdjectives within noun phrases.
DefaultBoolean.FALSE
*/ public static final String QUALITATIVE = "qualitative"; /** *

* This flag is set if a pronoun is written in the reflexive form. For * example, myself, yourself, ourselves. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameisReflexive
Expected typeBoolean
Created byThe phrase factory will recognise personal pronouns in reflexive * form.
Used byThe morphology processor will correctly inflect reflexive pronouns.
Applies toPronouns only.
DefaultBoolean.FALSE
*/ public static final String REFLEXIVE = "reflexive"; /** *

* This feature is used to define whether an adverb can be used as a clause * modifier, which are normally applied at the beginning of clauses. For * example, unfortunately. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namesentenceModifier
Expected typeBoolean
Created byAny lexicon that supports this feature.
Used bygeneric addModifier methods, to decide where to put an adverb
Applies toAdverbs only.
DefaultBoolean.FALSE
*/ public static final String SENTENCE_MODIFIER = "sentence_modifier"; /** *

* This feature gives the superlative form for adjectives and adverbs. For * example, fattest is the superlative form of fat and * earliest is the superlative form of early. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature namesuperlative
Expected typeString
Created byCan be created automatically by the lexicon or added manually by * users.
Used byThe morphology processor uses this information to correctly inflect * words.
Applies toAdjectives and adverbs only.
Defaultnull
*/ public static final String SUPERLATIVE = "superlative"; /** *

* This flag highlights a verb that can only take a subject and an object. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nametransitive
Expected typeBoolean
Created byAny lexicon supporting this feature.
Used byCurrently not used.
Applies toVerbs only.
DefaultBoolean.FALSE.
*/ public static final String TRANSITIVE = "transitive"; /** *

* This feature is used to define whether an adverb can be used as a verb * modifier, which are normally added in a phrase before the verb itself. * For example, quickly. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameverbModifier
Expected typeBoolean
Created byAny lexicon that supports this feature.
Used bygeneric addModifier methods, to decide where to put an adverb.
Applies toAdverbs only.
DefaultBoolean.FALSE
*/ public static final String VERB_MODIFIER = "verb_modifier"; /** *

* This feature determines if the pronoun is an expletive or not. Expletive * pronouns are usually it or there in sentences such as:
* It is raining now.
* There are ten desks in the room. *

* * * * * * * * * * * * * * * * * * * * * * * * * *
Feature nameisExpletive
Expected typeBoolean
Created byThe feature needs to be set by the user.
Used byThe syntax processor uses the expletive on verb phrases for * determining the correct number agreement.
Applies toCertain pronouns when used as subjects of verb phrases.
DefaultBoolean.FALSE
*/ public static final String EXPLETIVE_SUBJECT = "expletive_subject"; /** * The constructor is never needed. */ private LexicalFeature() { // do nothing } /** * Return those features related to a word's inflection, depending on its * category, that is, the constants for * PAST, PAST_PARTICIPLE, PLURAl, PRESENT_PARTICIPLE, PRESENT3S, COMPARATIVE * or SUPERLATIVE. * * @param cat the category * @return the inflectional feature names */ public static String[] getInflectionalFeatures(ElementCategory cat) { if(PhraseCategory.NOUN_PHRASE.equals(cat) || LexicalCategory.NOUN.equals(cat)) return new String[]{PLURAL}; else if(PhraseCategory.VERB_PHRASE.equals(cat) || LexicalCategory.VERB.equals(cat)) return new String[]{PAST, PAST_PARTICIPLE, PRESENT_PARTICIPLE, PRESENT3S}; else if(PhraseCategory.ADJECTIVE_PHRASE.equals(cat) || LexicalCategory.ADJECTIVE.equals(cat)) return new String[]{COMPARATIVE, SUPERLATIVE}; else return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy