Inflection
Morphology Inflection
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
inflection::dialog::SemanticFeatureModel Class Referencefinal

A semantic model that contains display data for semantic values and provides feature functions for deriving missing data. More...

#include <SemanticFeatureModel.hpp>

+ Inheritance diagram for inflection::dialog::SemanticFeatureModel:

Public Member Functions

::std::set< inflection::dialog::SemanticValuegetKnownSemanticValues () const
 
const SemanticFeatureModel_DisplayDatagetDisplayData (const SemanticValue &semantic) const
 
const SemanticFeaturegetFeature (::std::u16string_view name) const
 
::std::pair<::inflection::dialog::SemanticFeature *, ::std::u16string > getFeatureAlias (::std::u16string_view name) const
 
const util::ULocalegetLocale () const
 
const DefaultFeatureFunction * getDefaultFeatureFunction (const SemanticFeature &feature) const
 
void putDefaultFeatureFunction (const SemanticFeature &feature, DefaultFeatureFunction *function)
 
void putDefaultFeatureFunctionByName (::std::u16string_view feature, DefaultFeatureFunction *function)
 
const DefaultDisplayFunction * getDefaultDisplayFunction () const
 
void setDefaultDisplayFunction (DefaultDisplayFunction *defaultDisplayFunction)
 
 SemanticFeatureModel (const ::inflection::util::ULocale &locale)
 
 SemanticFeatureModel (const ::inflection::util::ULocale &locale, const ::std::map< SemanticValue, SemanticFeatureModel_DisplayData > &semanticValueMap)
 
 ~SemanticFeatureModel () override
 
- Public Member Functions inherited from inflection::Object
virtual ::std::u16string toString () const
 
virtual ~Object ()
 

Static Public Attributes

static constexpr auto SPEAK = u"speak"
 

Detailed Description

A semantic model that contains display data for semantic values and provides feature functions for deriving missing data.

Definition at line 22 of file SemanticFeatureModel.hpp.

Constructor & Destructor Documentation

◆ SemanticFeatureModel() [1/2]

inflection::dialog::SemanticFeatureModel::SemanticFeatureModel ( const ::inflection::util::ULocale locale)
explicit

Creates a default SemanticFeatureModel for a given locale without any display data.

◆ SemanticFeatureModel() [2/2]

inflection::dialog::SemanticFeatureModel::SemanticFeatureModel ( const ::inflection::util::ULocale locale,
const ::std::map< SemanticValue, SemanticFeatureModel_DisplayData > &  semanticValueMap 
)

Creates a SemanticFeatureModel for a given locale with a mapping of display data used for constructing things like a SemanticConcept.

Parameters
localeThe locale.
semanticValueMapThe mapping of a semantic value to display data.

◆ ~SemanticFeatureModel()

inflection::dialog::SemanticFeatureModel::~SemanticFeatureModel ( )
override

Destructor

Member Function Documentation

◆ getDefaultDisplayFunction()

const DefaultDisplayFunction * inflection::dialog::SemanticFeatureModel::getDefaultDisplayFunction ( ) const

Returns the function is used for inflecting phrases when no constraints match the available SemanticFeatureModel_DisplayData. When it's null, then there is no way to inflect phrases from the constraints.

See also
getDisplayData

◆ getDefaultFeatureFunction()

const DefaultFeatureFunction * inflection::dialog::SemanticFeatureModel::getDefaultFeatureFunction ( const SemanticFeature feature) const

Returns the registered feature function for the requested semantic feature.

Parameters
featureThe feature to request.
Returns
Returns null if no feature function exists.

◆ getDisplayData()

const SemanticFeatureModel_DisplayData * inflection::dialog::SemanticFeatureModel::getDisplayData ( const SemanticValue semantic) const

Returns the SemanticFeatureModel_DisplayData associated with the semantic value in this SemanticFeatureModel

◆ getFeature()

const SemanticFeature * inflection::dialog::SemanticFeatureModel::getFeature ( ::std::u16string_view  name) const

Return the semantic feature by the name.

Parameters
nameThe name of the semantic feature.

◆ getFeatureAlias()

::std::pair<::inflection::dialog::SemanticFeature *, ::std::u16string > inflection::dialog::SemanticFeatureModel::getFeatureAlias ( ::std::u16string_view  name) const

If a feature name is aliasable, return the associated semantic feature and its value. If a semantic feature can be more than one name, the value will have the canonical name. This can happen if the semantic feature has been deprecated, or has more than one known name for the value.

Parameters
nameThe name of the semantic feature.
Returns
The semantic feature will be null if no alias was found.

◆ getKnownSemanticValues()

::std::set< inflection::dialog::SemanticValue > inflection::dialog::SemanticFeatureModel::getKnownSemanticValues ( ) const

Returns all of the semantic values are associated with SemanticFeatureModel_DisplayData in this SemanticFeatureModel

◆ getLocale()

const util::ULocale & inflection::dialog::SemanticFeatureModel::getLocale ( ) const

Returns the locale created with this SemanticFeatureModel.

◆ putDefaultFeatureFunction()

void inflection::dialog::SemanticFeatureModel::putDefaultFeatureFunction ( const SemanticFeature feature,
DefaultFeatureFunction *  function 
)

Register a default feature function for a semantic feature.

Parameters
featureThe feature to register the function for.
functionThe feature function to call for the semantic feature. This SemanticFeatureModel will adopt ownership of this function, and it will be deleted when this SemanticFeatureModel is deleted.

◆ putDefaultFeatureFunctionByName()

void inflection::dialog::SemanticFeatureModel::putDefaultFeatureFunctionByName ( ::std::u16string_view  feature,
DefaultFeatureFunction *  function 
)

This function works the same way as putDefaultFeatureFunction, but an exception is thrown if the feature is unknown.

Parameters
featureThe name of the SemanticFeature in this SemanticFeatureModel.
functionThe function to derive the specified SemanticFeature for the locale when it's not specified by available SemanticFeatureModel_DisplayData.

◆ setDefaultDisplayFunction()

void inflection::dialog::SemanticFeatureModel::setDefaultDisplayFunction ( DefaultDisplayFunction *  defaultDisplayFunction)

This function is used for inflecting phrases when no constraints match the available SemanticFeatureModel_DisplayData. Normally this does not need to be set.

See also
getDisplayData

Member Data Documentation

◆ SPEAK

constexpr auto inflection::dialog::SemanticFeatureModel::SPEAK = u"speak"
staticconstexpr

The name of the speak semantic feature.

Definition at line 43 of file SemanticFeatureModel.hpp.


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