LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
deeplima::lemmatization::lemm_rules_builder_t Class Reference

Learns rules from (form, UPOS, FEATS, lemma) observations and writes them. More...

#include <deeplima/lemmatization/lemm_rules.h>

Public Member Functions

 lemm_rules_builder_t (size_t max_suffix=6, size_t max_prefix=0)
void add (const std::string &upos, const std::string &feats, const std::u32string &form, const std::u32string &lemma)
void write (std::ostream &out) const
 The most supported rule of each (UPOS, FEATS, ending), then of each (UPOS, FEATS, beginning); ties go to the simplest rule.

Detailed Description

Learns rules from (form, UPOS, FEATS, lemma) observations and writes them.

With max_prefix 0, suffix rules only, and the file is what it was before prefix rules existed.

Callers add each distinct observation once (a rule's count is a number of word types, not tokens: a frequent irregular word must not outvote the regular paradigm) and preferably only rare words, which resemble the words the rules will meet: words missing from the dictionary.

A rule is indexed under endings at least as long as what it strips, so that "lisait" -> "lire" (strip "sait") is never applied on the strength of "-ait" alone ("utilisait" would give "utilire"). Likewise, a prefix rule is indexed under beginnings at least as long as what it strips.

Definition at line 274 of file lemm_rules.h.

Constructor & Destructor Documentation

◆ lemm_rules_builder_t()

deeplima::lemmatization::lemm_rules_builder_t::lemm_rules_builder_t ( size_t max_suffix = 6,
size_t max_prefix = 0 )
inlineexplicit

Definition at line 277 of file lemm_rules.h.

Member Function Documentation

◆ add()

void deeplima::lemmatization::lemm_rules_builder_t::add ( const std::string & upos,
const std::string & feats,
const std::u32string & form,
const std::u32string & lemma )
inline

Definition at line 280 of file lemm_rules.h.

◆ write()

void deeplima::lemmatization::lemm_rules_builder_t::write ( std::ostream & out) const
inline

The most supported rule of each (UPOS, FEATS, ending), then of each (UPOS, FEATS, beginning); ties go to the simplest rule.

Definition at line 307 of file lemm_rules.h.


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