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

Facilitates the creation of Concepts More...

#include <CommonConceptFactory.hpp>

+ Inheritance diagram for inflection::dialog::CommonConceptFactory:

Public Member Functions

virtual const SemanticFeatureModelgetSemanticFeatureModel () const =0
 
virtual const ::inflection::util::ULocalegetLanguage () const =0
 
virtual InflectableStringConceptcreateConcept (const ::inflection::dialog::SpeakableString &string) const =0
 
virtual SemanticConceptListcreateOrList (const ::std::vector< const ::inflection::dialog::SemanticFeatureConceptBase * > &concepts) const =0
 
virtual SemanticConceptListcreateOrList (const ::std::vector<::inflection::dialog::SemanticFeatureConceptBase * > &concepts) const =0
 
virtual SemanticConceptListcreateAndList (const ::std::vector< const ::inflection::dialog::SemanticFeatureConceptBase * > &concepts) const =0
 
virtual SemanticConceptListcreateAndList (const ::std::vector<::inflection::dialog::SemanticFeatureConceptBase * > &concepts) const =0
 
virtual NumberConceptnumber (const ::inflection::util::ULocale &regionFormatLocale, int64_t number) const =0
 
virtual NumberConceptnumber (const ::inflection::util::ULocale &regionFormatLocale, double number) const =0
 
virtual SpeakableString quote (const ::inflection::dialog::SpeakableString &str) const =0
 
virtual SpeakableStringquantify (const NumberConcept &number, const ::inflection::dialog::SemanticFeatureConceptBase *semanticConcept) const =0
 
virtual SpeakableStringquantifyFormatted (const NumberConcept &number, const ::inflection::dialog::SpeakableString &formattedNumber, const ::inflection::dialog::SemanticFeatureConceptBase *semanticConcept) const =0
 
 ~CommonConceptFactory () override
 
- Public Member Functions inherited from inflection::Object
virtual ::std::u16string toString () const
 
virtual ~Object ()
 

Detailed Description

Facilitates the creation of Concepts

Concepts can generally be defined as a way to lexically represent real-world or linguistic ideas. These ideas can vary greatly in scope, and range from the representation of a mathematical number by a language, to rules on how to properly affix a suffix to a token in order to represent plurality.

You should never instantiate this interface yourself. Instead use CommonConceptFactoryProvider to get an instance of this class for any supported locale.

To use this class, it is recommended to use LocalizedCommonConceptFactoryProvider::getDefaultCommonConceptFactoryProvider() to get a LocalizedCommonConceptFactoryProvider singleton, then use CommonConceptFactoryProvider::getCommonConceptFactory() to get a CommonConceptFactory in any supported locale:

#include <inflection/dialog/LocalizedCommonConceptFactoryProvider.hpp>
#include <inflection/dialog/CommonConceptFactory.hpp>
auto commonConceptFactory =
const ::inflection::dialog::CommonConceptFactory * getCommonConceptFactory(const ::inflection::util::ULocale &locale) override
static LocalizedCommonConceptFactoryProvider * getDefaultCommonConceptFactoryProvider()
static const ::inflection::util::ULocale & PORTUGUESE()

Definition at line 31 of file CommonConceptFactory.hpp.

Constructor & Destructor Documentation

◆ ~CommonConceptFactory()

inflection::dialog::CommonConceptFactory::~CommonConceptFactory ( )
override

Destructor

This destructor does NOT delete created concepts. Created concepts must be manually deleted.

Member Function Documentation

◆ createAndList() [1/2]

virtual SemanticConceptList * inflection::dialog::CommonConceptFactory::createAndList ( const ::std::vector< const ::inflection::dialog::SemanticFeatureConceptBase * > &  concepts) const
pure virtual

Returns a new SemanticConceptList based on an input std::vector of concepts. The returned list is created using the semantically inclusive specifier (i.e. "and" in English).

An example of using this function would be creating an array of concepts using the input strings ["chocolate", "vanilla", "caramel"] and the resulting output would be "chocolate, vanilla, and caramel".

The returned pointer is unmanaged and must be manually deleted.

Returns
A new SemanticConceptList.
Parameters
conceptsstd::vector of semantic feature concepts. These should be subclasses of SemanticFeatureConceptBase.

◆ createAndList() [2/2]

virtual SemanticConceptList * inflection::dialog::CommonConceptFactory::createAndList ( const ::std::vector<::inflection::dialog::SemanticFeatureConceptBase * > &  concepts) const
pure virtual

Returns a new SemanticConceptList based on an input std::vector of concepts. The returned list is created using the semantically inclusive specifier (i.e. "and" in English).

An example of using this function would be creating an array of concepts using the input strings ["chocolate", "vanilla", "caramel"] and the resulting output would be "chocolate, vanilla, and caramel".

The returned pointer is unmanaged and must be manually deleted.

Returns
A new SemanticConceptList.
Parameters
conceptsstd::vector of semantic feature concepts. These should be subclasses of SemanticFeatureConceptBase.

◆ createConcept()

virtual InflectableStringConcept * inflection::dialog::CommonConceptFactory::createConcept ( const ::inflection::dialog::SpeakableString string) const
pure virtual

Returns a new InflectableStringConcept based on an input SpeakableString.

The returned pointer is unmanaged and must be manually deleted.

Returns
A new InflectableStringConcept.
Parameters
stringSpeakableString used to initialize the concept with a value to inflect upon.

◆ createOrList() [1/2]

virtual SemanticConceptList * inflection::dialog::CommonConceptFactory::createOrList ( const ::std::vector< const ::inflection::dialog::SemanticFeatureConceptBase * > &  concepts) const
pure virtual

Returns a new SemanticConceptList based on an input std::vector of concepts. The returned list is created using the semantically optional specifier (i.e. "or" in English).

An example of using this function would be creating an array of concepts using the input strings ["chocolate", "vanilla", "caramel"] and the resulting output would be "chocolate, vanilla, or caramel".

The returned pointer is unmanaged and must be manually deleted.

Returns
A new SemanticConceptList.
Parameters
conceptsstd::vector of semantic feature concepts. These should be subclasses of SemanticFeatureConceptBase.

◆ createOrList() [2/2]

virtual SemanticConceptList * inflection::dialog::CommonConceptFactory::createOrList ( const ::std::vector<::inflection::dialog::SemanticFeatureConceptBase * > &  concepts) const
pure virtual

Returns a new SemanticConceptList based on an input std::vector of concepts. The returned list is created using the semantically optional specifier (i.e. "or" in English).

An example of using this function would be creating an array of concepts using the input strings ["chocolate", "vanilla", "caramel"] and the resulting output would be "chocolate, vanilla, or caramel".

The returned pointer is unmanaged and must be manually deleted.

Returns
A new SemanticConceptList.
Parameters
conceptsstd::vector of semantic feature concepts. These should be subclasses of SemanticFeatureConceptBase.

◆ getLanguage()

virtual const ::inflection::util::ULocale & inflection::dialog::CommonConceptFactory::getLanguage ( ) const
pure virtual

Returns this ConceptFactory's underlying language.

Returns
The language.

◆ getSemanticFeatureModel()

virtual const SemanticFeatureModel * inflection::dialog::CommonConceptFactory::getSemanticFeatureModel ( ) const
pure virtual

Returns a pointer to the inheriting ConceptFactory's SemanticFeatureModel.

Returns
The underlying language's SemanticFeatureModel

◆ number() [1/2]

virtual NumberConcept * inflection::dialog::CommonConceptFactory::number ( const ::inflection::util::ULocale regionFormatLocale,
double  number 
) const
pure virtual

Returns a new NumberConcept based on this concept factory's language, the region format for printing and double number. Returns a new NumberConcept based on a specified RequestContext and double number.

The returned object is owned by the caller and must be deleted by the caller.

Parameters
regionFormatLocaleThe locale for printing the number. The language will be used for the speak value.
numberThe input number.
Returns
A new NumberConcept.

◆ number() [2/2]

virtual NumberConcept * inflection::dialog::CommonConceptFactory::number ( const ::inflection::util::ULocale regionFormatLocale,
int64_t  number 
) const
pure virtual

Returns a new NumberConcept based on this concept factory's language, the region format for printing and int64_t number.

The returned object is owned by the caller and must be deleted by the caller.

Parameters
regionFormatLocaleThe locale for printing the number. The language will be used for the speak value.
numberThe input number.
Returns
A new NumberConcept.

◆ quantify()

virtual SpeakableString * inflection::dialog::CommonConceptFactory::quantify ( const NumberConcept number,
const ::inflection::dialog::SemanticFeatureConceptBase semanticConcept 
) const
pure virtual

Returns a new SpeakableString based on a NumberConcept and SemanticConcept.

Usage for this would be to automatically determine plurality rules for words. This is especially useful for words that have multiple rules based on amounts, such as Slavic languages, in which the genetive plural form has a different inflection.

For example in Russian:
0 years → 0 лет
1 year → 1 год
4 years → 4 года
5 years → 5 лет
100 years → 100 лет

The returned pointer is unmanaged and must be manually deleted.

Returns
A new SpeakableString.
Parameters
numberAn input NumberConcept to represent the amount.
semanticConceptAn input SemanticConcept to represent the word to be inflected based on the amount.

◆ quantifyFormatted()

virtual SpeakableString * inflection::dialog::CommonConceptFactory::quantifyFormatted ( const NumberConcept number,
const ::inflection::dialog::SpeakableString formattedNumber,
const ::inflection::dialog::SemanticFeatureConceptBase semanticConcept 
) const
pure virtual

Returns a new SpeakableString based on a NumberConcept, format number, and SemanticConcept.

The returned pointer is unmanaged and must be manually deleted.

Returns
A new SpeakableString.
Parameters
numberAn input NumberConcept to represent the amount.
formattedNumberIf the default chosen cardinal number is wrong for the context of the noun, you can format a specific form of the number.
semanticConceptAn input SemanticConcept to represent the word to be inflected based on the amount.

◆ quote()

virtual SpeakableString inflection::dialog::CommonConceptFactory::quote ( const ::inflection::dialog::SpeakableString str) const
pure virtual

Returns a SpeakableString based on an input SpeakableString and with the print component surrounded with the locale's quotation punctuation, in English this is represented with quotation marks: "". Another example is in Swiss German dialects this is represented with «».

Returns
The quoted SpeakableString.
Parameters
strThe input SpeakableString to add quotation punctuation to.

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