LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
deeplima::lemmatization::lemm_rules_t< K, KHash > Class Template Reference

Rules ready for lookup, keyed by K, the analyzer's encoding of UPOS(+FEATS) (morph_feats_t in TokenSequenceAnalyzer, strings in tests). More...

#include <deeplima/lemmatization/lemm_rules.h>

Public Member Functions

void add (const K &key, const std::u32string &affix, const edit_rule_t &rule, size_t count, bool fallback, bool prefix=false)
 Adds a rule to the exact or the fallback table, of the suffixes or of the beginnings (prefix, affix then being the word's beginning); of two rules under the same key, the most supported one stays.
bool empty () const
size_t size () const
bool lemmatize (const K &exact, const K &fallback, const std::u32string &form, std::u32string &lemma) const
 Lemmatizes form with the rule of its longest known ending, the exact features before the UPOS-only fallback at equal length, and then the rule of its longest known beginning likewise (none: the beginning is kept).

Detailed Description

template<typename K, typename KHash = std::hash<K>>
class deeplima::lemmatization::lemm_rules_t< K, KHash >

Rules ready for lookup, keyed by K, the analyzer's encoding of UPOS(+FEATS) (morph_feats_t in TokenSequenceAnalyzer, strings in tests).

Exact-features rules and UPOS-only fallback rules are kept apart, for the suffixes and the beginnings alike: in the analyzer a word without features ("NOUN _") and the fallback ("NOUN *") encode to the same key, and sharing one table let the fallback overwrite the exact rule.

Definition at line 439 of file lemm_rules.h.

Member Function Documentation

◆ add()

template<typename K, typename KHash = std::hash<K>>
void deeplima::lemmatization::lemm_rules_t< K, KHash >::add ( const K & key,
const std::u32string & affix,
const edit_rule_t & rule,
size_t count,
bool fallback,
bool prefix = false )
inline

Adds a rule to the exact or the fallback table, of the suffixes or of the beginnings (prefix, affix then being the word's beginning); of two rules under the same key, the most supported one stays.

Definition at line 447 of file lemm_rules.h.

◆ empty()

template<typename K, typename KHash = std::hash<K>>
bool deeplima::lemmatization::lemm_rules_t< K, KHash >::empty ( ) const
inline

Definition at line 460 of file lemm_rules.h.

◆ lemmatize()

template<typename K, typename KHash = std::hash<K>>
bool deeplima::lemmatization::lemm_rules_t< K, KHash >::lemmatize ( const K & exact,
const K & fallback,
const std::u32string & form,
std::u32string & lemma ) const
inline

Lemmatizes form with the rule of its longest known ending, the exact features before the UPOS-only fallback at equal length, and then the rule of its longest known beginning likewise (none: the beginning is kept).

A rule stripping more than the form leaves is passed over for a shorter key.

Definition at line 469 of file lemm_rules.h.

◆ size()

template<typename K, typename KHash = std::hash<K>>
size_t deeplima::lemmatization::lemm_rules_t< K, KHash >::size ( ) const
inline

Definition at line 461 of file lemm_rules.h.


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