Inflection
Morphology Inflection
|
Provides a way to format a customizable pronoun for a given language. More...
#include <PronounConcept.hpp>
Public Member Functions | |
::inflection::dialog::SpeakableString * | getFeatureValue (const SemanticFeature &feature) const override |
bool | isExists () const override |
bool | isCustomMatch () const |
::inflection::dialog::SpeakableString * | toSpeakableString () const override |
virtual ::inflection::dialog::SpeakableString * | toSpeakableString (const inflection::dialog::SemanticFeatureConceptBase &referencedConcept) const |
::std::u16string | toString () const override |
PronounConcept * | clone () 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 | |
![]() | |
virtual const SemanticFeatureModel * | getModel () 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 SpeakableString * | getFeatureValueByName (::std::u16string_view featureName) const |
SemanticFeatureConceptBase (const SemanticFeatureModel *model) | |
SemanticFeatureConceptBase (const SemanticFeatureConceptBase &other) | |
~SemanticFeatureConceptBase () override | |
![]() | |
~SpeakableConcept () override | |
![]() | |
virtual ::std::u16string | toString () const |
virtual | ~Object () |
Additional Inherited Members | |
![]() | |
virtual const SemanticFeature * | getSpeakFeature () const |
![]() | |
::std::map< SemanticFeature, ::std::u16string > | constraints { } |
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.
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.
model | The SemanticFeatureModel for the language |
defaultDisplayData | These are customized pronouns that override the default pronouns. |
defaultConstraints | The constraints to consider when a given constraint is undefined. |
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.
model | The SemanticFeatureModel for the language |
defaultConstraints | The constraints to consider when a given constraint is undefined. |
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.
model | The SemanticFeatureModel for the language |
initialPronoun | The language specific pronoun to start inflecting the pronoun. |
IllegalArgumentException | Thrown when the pronoun is not a known pronoun for the given language. |
inflection::dialog::PronounConcept::PronounConcept | ( | const PronounConcept & | other | ) |
The copy constructor
|
override |
The destructor
|
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.
|
overridevirtual |
Returns the requested semantic feature. For example, you can request the gender semantic feature in some languages.
Implements inflection::dialog::SemanticFeatureConceptBase.
bool inflection::dialog::PronounConcept::isCustomMatch | ( | ) | const |
Returns true if the given constraints match a custom pronoun specified in the constructor.
|
overridevirtual |
Returns true if a value exists for the given constraints
Implements inflection::dialog::SemanticFeatureConceptBase.
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.
|
overridevirtual |
Returns the requested value for the provided constraints.
Implements inflection::dialog::SpeakableConcept.
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.
referencedConcept | This concept provides additional semantic feature values based of the referenced concept. |
|
override |
Return a debuggable formatted string of this PronounConcept.