Inflection
Morphology Inflection
Loading...
Searching...
No Matches
Public Member Functions | List of all members
inflection::dialog::PronounConcept Class Reference

Provides a way to format a customizable pronoun for a given language. More...

#include <PronounConcept.hpp>

+ Inheritance diagram for inflection::dialog::PronounConcept:

Public Member Functions

::inflection::dialog::SpeakableStringgetFeatureValue (const SemanticFeature &feature) const override
 
bool isExists () const override
 
bool isCustomMatch () const
 
::inflection::dialog::SpeakableStringtoSpeakableString () const override
 
virtual ::inflection::dialog::SpeakableStringtoSpeakableString (const inflection::dialog::SemanticFeatureConceptBase &referencedConcept) const
 
::std::u16string toString () const override
 
PronounConceptclone () const override
 
bool operator== (const PronounConcept &o) const
 
 PronounConcept (const SemanticFeatureModel &model, const ::std::vector<::inflection::dialog::DisplayValue > &defaultDisplayData, const ::std::map< SemanticFeature, ::std::u16string > &defaultConstraints)
 
 PronounConcept (const SemanticFeatureModel &model, const ::std::map< SemanticFeature, ::std::u16string > &defaultConstraints)
 
 PronounConcept (const SemanticFeatureModel &model, std::u16string_view initialPronoun)
 
 PronounConcept (const PronounConcept &other)
 
 ~PronounConcept () override
 
- Public Member Functions inherited from inflection::dialog::SemanticFeatureConceptBase
virtual const SemanticFeatureModelgetModel () const
 
virtual const ::std::u16string * getConstraint (const SemanticFeature &feature) const
 
virtual bool hasConstraint (const SemanticFeature &feature) const
 
virtual void putConstraint (const SemanticFeature &feature, ::std::u16string_view featureValue)
 
virtual void putConstraintByName (::std::u16string_view featureName, ::std::u16string_view featureValue)
 
virtual void clearConstraint (const SemanticFeature &feature)
 
virtual void clearConstraintByName (::std::u16string_view featureName)
 
virtual void reset ()
 
virtual SpeakableStringgetFeatureValueByName (::std::u16string_view featureName) const
 
 SemanticFeatureConceptBase (const SemanticFeatureModel *model)
 
 SemanticFeatureConceptBase (const SemanticFeatureConceptBase &other)
 
 ~SemanticFeatureConceptBase () override
 
- Public Member Functions inherited from inflection::dialog::SpeakableConcept
 ~SpeakableConcept () override
 
- Public Member Functions inherited from inflection::Object
virtual ::std::u16string toString () const
 
virtual ~Object ()
 

Additional Inherited Members

- Protected Member Functions inherited from inflection::dialog::SemanticFeatureConceptBase
virtual const SemanticFeaturegetSpeakFeature () const
 
- Protected Attributes inherited from inflection::dialog::SemanticFeatureConceptBase
::std::map< SemanticFeature, ::std::u16string > constraints { }
 

Detailed Description

Provides a way to format a customizable pronoun for a given language.

Formatting a pronoun in various languages requires a lot of context. It may be known that the pronoun needs to be in the third person, and that the gender of the pronoun in the message, but the context in the sentence may affect the type of pronoun used or even be affected by the grammatical properties of a separate noun that the pronoun is possessing. For example, in Spanish, the phrase "your message" is "tu mensaje" where "your" is "tu" in Spanish. If there are multiple messages, then the phrase would be "tus mensajes". If you have a scenario where the pronoun depends on the properties of another word, then it's recommended that you use toSpeakableString(const SemanticFeatureConceptBase&) to provide that additional context beyond the constraints.

Definition at line 26 of file PronounConcept.hpp.

Constructor & Destructor Documentation

◆ PronounConcept() [1/4]

inflection::dialog::PronounConcept::PronounConcept ( const SemanticFeatureModel model,
const ::std::vector<::inflection::dialog::DisplayValue > &  defaultDisplayData,
const ::std::map< SemanticFeature, ::std::u16string > &  defaultConstraints 
)

Constructs a new PronounConcept based on custom pronouns. Any unspecified pronouns will use the language's default pronouns.

Parameters
modelThe SemanticFeatureModel for the language
defaultDisplayDataThese are customized pronouns that override the default pronouns.
defaultConstraintsThe constraints to consider when a given constraint is undefined.

◆ PronounConcept() [2/4]

inflection::dialog::PronounConcept::PronounConcept ( const SemanticFeatureModel model,
const ::std::map< SemanticFeature, ::std::u16string > &  defaultConstraints 
)

Constructs a new PronounConcept with the default constraints. If you know the gender or person grammatical category values of the desired pronoun, it's recommended to provide them with defaultConstraints. A SemanticFeatureModel is required, as it will enforce the locale and provide the known constraints for the given language.

Parameters
modelThe SemanticFeatureModel for the language
defaultConstraintsThe constraints to consider when a given constraint is undefined.

◆ PronounConcept() [3/4]

inflection::dialog::PronounConcept::PronounConcept ( const SemanticFeatureModel model,
std::u16string_view  initialPronoun 
)

Constructs a new PronounConcept with the default constraints based on an existing pronoun from the language. For example, "I" will provide the default constraints "first", "singular" and "subjective" for English. If "her" was provided for initialPronoun in English, then the default constraints will be "third", "singular", "feminine", and "objective". If "her" was the in English, and then the constraints "possessive" and "independent" were added, then formatting this PronounConcept with toSpeakableString() will provide "hers". The "possessive" constraint would override the "objective" constraint.

A SemanticFeatureModel is required, as it will enforce the locale and provide the known constraints for the given language.

Parameters
modelThe SemanticFeatureModel for the language
initialPronounThe language specific pronoun to start inflecting the pronoun.
Exceptions
IllegalArgumentExceptionThrown when the pronoun is not a known pronoun for the given language.

◆ PronounConcept() [4/4]

inflection::dialog::PronounConcept::PronounConcept ( const PronounConcept other)

The copy constructor

◆ ~PronounConcept()

inflection::dialog::PronounConcept::~PronounConcept ( )
override

The destructor

Member Function Documentation

◆ clone()

PronounConcept * inflection::dialog::PronounConcept::clone ( ) const
overridevirtual

Create a clone of this object. This is helpful if you need to preserve the constraints of the current object.

Implements inflection::dialog::SemanticFeatureConceptBase.

◆ getFeatureValue()

::inflection::dialog::SpeakableString * inflection::dialog::PronounConcept::getFeatureValue ( const SemanticFeature feature) const
overridevirtual

Returns the requested semantic feature. For example, you can request the gender semantic feature in some languages.

Implements inflection::dialog::SemanticFeatureConceptBase.

◆ isCustomMatch()

bool inflection::dialog::PronounConcept::isCustomMatch ( ) const

Returns true if the given constraints match a custom pronoun specified in the constructor.

◆ isExists()

bool inflection::dialog::PronounConcept::isExists ( ) const
overridevirtual

Returns true if a value exists for the given constraints

Implements inflection::dialog::SemanticFeatureConceptBase.

◆ operator==()

bool inflection::dialog::PronounConcept::operator== ( const PronounConcept o) const

Returns true when both objects refer to the same model, have the same semantic value, have the same constraints and the same defaultToSemantic value.

◆ toSpeakableString() [1/2]

::inflection::dialog::SpeakableString * inflection::dialog::PronounConcept::toSpeakableString ( ) const
overridevirtual

Returns the requested value for the provided constraints.

Returns
null when the constrained values is an empty set.

Implements inflection::dialog::SpeakableConcept.

◆ toSpeakableString() [2/2]

virtual ::inflection::dialog::SpeakableString * inflection::dialog::PronounConcept::toSpeakableString ( const inflection::dialog::SemanticFeatureConceptBase referencedConcept) const

Returns the requested value for the provided constraints in addition to the constraints and semantic feature values of the referenced concept. It's important to note that some pronouns are derived from both person being referenced and the object being referenced.

Parameters
referencedConceptThis concept provides additional semantic feature values based of the referenced concept.
Returns
null when the constrained values is an empty set.

◆ toString()

::std::u16string inflection::dialog::PronounConcept::toString ( ) const
override

Return a debuggable formatted string of this PronounConcept.


The documentation for this class was generated from the following file: