#include <LingDef.h>
Public Types | |
typedef std::set< Feature * > | EnumChildrenSet |
typedef EnumChildrenSet::const_iterator | EnumChildrenIterator |
SYNTAX | |
MORPHO | |
SEMANTIC | |
MISC | |
BOOLEAN | |
ENUM | |
REFERENCE | |
VTREE | |
enum | Domain { SYNTAX, MORPHO, SEMANTIC, MISC } |
enum | Type { BOOLEAN, ENUM, REFERENCE, VTREE } |
Public Member Functions | |
~Feature () | |
const std::string & | getName () const |
Returns the name of this feature, such as 'plural' or 'active'. | |
Domain | getDomain () const |
Type | getType () const |
const LingDef * | getLingDef () const |
Returns a pointer to the definition that this feature belongs to. | |
const LingDef::Pos * | getPosDef () const |
Returns a pointer to the pos definition that this feature belongs to. | |
const Feature * | getParentEnum () const |
If this feature is an enumeration value ('plural'), then this will return a pointer to the enumeration feature ('number'). | |
EnumChildrenIterator | enumChildrenBegin () const |
If this is an enumeration feature, this will give a start iterator to the available enumeration value features. | |
EnumChildrenIterator | enumChildrenEnd () const |
If this is an enumeration feature, this will give an end iterator to the available enumeration value features. | |
void | setTree (const Tree &) |
If this is a virtual tree feature, then this will enable us to set which tree to use. | |
const Tree * | getTree () const |
If this is a virtual tree feature, then this will return a pointer to the tree in question. | |
const Tree::Node * | getTreeNode () const |
If this is a virtual tree node feature, then this will return a pointer to the tree node in question. | |
bool | isIn (const std::set< const LingDef::Feature * > &) const |
Returns true if this feature is in the passed set. | |
void | setAllowSeveralValues (bool) |
For enumeration and reference features, several values may optionally be allowed. | |
bool | allowSeveralValues () const |
void | setAllowNoValue (bool) |
For enumerations, it is possible to forbid the undefined state, where no enumeration value is selected. | |
bool | allowNoValue () const |
void | setDefault (bool) |
Sets whether this feature should be set by default. | |
bool | isDefault () const |
void | setShortName (const std::string &) |
A short name is an alternative name that may be used in some contexts. | |
const std::string & | getShortName () const |
Feature & | createEnumValueFeature (const std::string &name) |
For enumeration features, this adds an enumeration value. | |
void | addConflict (const Feature &) |
Friends | |
class | Pos |
class | LingDef |
A feature belongs to a pos.
Definition at line 294 of file LingDef.h.
typedef EnumChildrenSet::const_iterator LinguisticDefinition::LingDef::Feature::EnumChildrenIterator |
typedef std::set<Feature *> LinguisticDefinition::LingDef::Feature::EnumChildrenSet |
LingDef::Feature::~Feature | ( | ) |
Definition at line 527 of file LingDef.cc.
void LingDef::Feature::addConflict | ( | const Feature & | ) |
Definition at line 433 of file LingDef.cc.
References LinguisticDefinition::LingDef::addConflict().
Referenced by main().
bool LingDef::Feature::allowNoValue | ( | ) | const |
Definition at line 660 of file LingDef.cc.
bool LingDef::Feature::allowSeveralValues | ( | ) | const |
Definition at line 646 of file LingDef.cc.
Referenced by LinguisticDefinition::LingFeaturesSet::set(), and LinguisticDefinition::LingFeatures::setReference().
Feature& LinguisticDefinition::LingDef::Feature::createEnumValueFeature | ( | const std::string & | name | ) |
EnumChildrenIterator LinguisticDefinition::LingDef::Feature::enumChildrenBegin | ( | ) | const [inline] |
If this is an enumeration feature, this will give a start iterator to the available enumeration value features.
Definition at line 362 of file LingDef.h.
Referenced by LinguisticDefinition::LingFeatures::setDefaultForEnum().
EnumChildrenIterator LinguisticDefinition::LingDef::Feature::enumChildrenEnd | ( | ) | const [inline] |
If this is an enumeration feature, this will give an end iterator to the available enumeration value features.
Definition at line 370 of file LingDef.h.
Referenced by LinguisticDefinition::LingFeatures::setDefaultForEnum().
LingDef::Feature::Domain LingDef::Feature::getDomain | ( | ) | const |
const LingDef * LingDef::Feature::getLingDef | ( | ) | const |
Returns a pointer to the definition that this feature belongs to.
Definition at line 541 of file LingDef.cc.
const string & LingDef::Feature::getName | ( | ) | const |
Returns the name of this feature, such as 'plural' or 'active'.
Definition at line 533 of file LingDef.cc.
Referenced by main(), and testQuery().
const LingDef::Feature * LingDef::Feature::getParentEnum | ( | ) | const |
If this feature is an enumeration value ('plural'), then this will return a pointer to the enumeration feature ('number').
Otherwise it will return NULL.
Enumeration values are of type boolean.
Definition at line 602 of file LingDef.cc.
Referenced by LinguisticDefinition::LingFeatures::hasEnumValue(), main(), LinguisticDefinition::LingFeaturesSet::set(), LinguisticDefinition::LingFeaturesSet::setEnum(), LinguisticDefinition::LingFeatures::setEnum(), LinguisticDefinition::WordPattern::LeafElement::setFeature(), and testQuery().
const LingDef::Pos * LingDef::Feature::getPosDef | ( | ) | const |
Returns a pointer to the pos definition that this feature belongs to.
Definition at line 548 of file LingDef.cc.
const string & LingDef::Feature::getShortName | ( | ) | const |
Definition at line 724 of file LingDef.cc.
const LingDef::Tree * LingDef::Feature::getTree | ( | ) | const |
If this is a virtual tree feature, then this will return a pointer to the tree in question.
If not, it will return NULL.
Definition at line 731 of file LingDef.cc.
const LingDef::Tree::Node * LingDef::Feature::getTreeNode | ( | ) | const |
If this is a virtual tree node feature, then this will return a pointer to the tree node in question.
If not, it will return NULL.
Definition at line 753 of file LingDef.cc.
LingDef::Feature::Type LingDef::Feature::getType | ( | ) | const |
Definition at line 595 of file LingDef.cc.
Referenced by LinguisticDefinition::XmlLingFeaturesFormatter::populateLingFeatures().
bool LingDef::Feature::isDefault | ( | ) | const |
Definition at line 707 of file LingDef.cc.
bool LinguisticDefinition::LingDef::Feature::isIn | ( | const std::set< const LingDef::Feature * > & | ) | const |
Returns true if this feature is in the passed set.
Used to allow the "sloppyness" of the virtual tree.
Referenced by LinguisticDefinition::LingFeatures::has().
void LingDef::Feature::setAllowNoValue | ( | bool | ) |
For enumerations, it is possible to forbid the undefined state, where no enumeration value is selected.
In that case, the enumeration value that has is set to default will be active, or if there is no default, the first value.
Definition at line 653 of file LingDef.cc.
void LingDef::Feature::setAllowSeveralValues | ( | bool | ) |
For enumeration and reference features, several values may optionally be allowed.
For a reference, this could for example be an attribute 'modifiedBy' where several words modify this word.
For an enumeration, it is less clear. It allows for some simple ambiguity, for example if the case is always ambiguous for a certain type of noun. For more complex ambiguities, the class LingFeaturesSet is recommended.
Definition at line 639 of file LingDef.cc.
void LingDef::Feature::setDefault | ( | bool | ) |
Sets whether this feature should be set by default.
Definition at line 667 of file LingDef.cc.
Referenced by main().
void LinguisticDefinition::LingDef::Feature::setShortName | ( | const std::string & | ) |
A short name is an alternative name that may be used in some contexts.
void LingDef::Feature::setTree | ( | const Tree & | ) |
If this is a virtual tree feature, then this will enable us to set which tree to use.
The nodes will be mapped to features.
Definition at line 739 of file LingDef.cc.
References createEnumValueFeature(), d_tree, d_treeNode, LinguisticDefinition::LingDef::Tree::nodesBegin(), and LinguisticDefinition::LingDef::Tree::nodesEnd().
Referenced by main().