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

Helper class for morphology data (upos, features) binarization. More...

#include </home/runner/work/lima/lima/deeplima/libs/morph_model/morph_model.h>

Classes

struct  feat_pos_t

Public Member Functions

 morph_model_t ()
 morph_model_t (const std::string &str)
std::string to_string () const
std::string to_string (const morph_feats_t &feats) const
const std::vector< std::string > & get_feat_vec_ref (size_t feat_id) const
size_t get_feats_count () const
bool has_feat (const std::string &feat_name) const
const std::string & get_feat_name (size_t feat_id) const
size_t get_feat_idx (const std::string &feat_name) const
feat_base_t decode_upos (const morph_feats_t &feats) const
feat_base_t decode_feat (const morph_feats_t &feats, size_t feat_id) const
size_t get_upos_id (const std::string &name) const
bool can_convert (const std::string &upos, const std::map< std::string, std::set< std::string > > &feats) const
 True when convert(upos, feats) can encode this UPOS and these features: convert only asserts it, which a release build does not check.
morph_feats_t convert (const std::string &upos, const std::map< std::string, std::set< std::string > > &feats) const
template<typename F>
morph_feats_t convert (F featid2value) const
const std::string & decode_upos_to_str (const morph_feats_t &feats) const

Public Attributes

feat_base_t m_upos_mask
std::vector< feat_base_t > m_masks
std::vector< uint8_t > m_offset
std::vector< std::map< size_t, size_t > > m_feats2mask
std::vector< dict_t > m_feats

Protected Member Functions

size_t add_upos (const std::string &name)
size_t get_feat_id (const std::string &name) const
size_t add_feat (const std::string &name)

Friends

class morph_model_builder

Detailed Description

Helper class for morphology data (upos, features) binarization.

Get id from data string and reverse.

Definition at line 92 of file morph_model.h.

Constructor & Destructor Documentation

◆ morph_model_t() [1/2]

deeplima::morph_model::morph_model_t::morph_model_t ( )
inline

Definition at line 148 of file morph_model.h.

◆ morph_model_t() [2/2]

deeplima::morph_model::morph_model_t::morph_model_t ( const std::string & str)

Definition at line 99 of file morph_model.cpp.

Member Function Documentation

◆ add_feat()

size_t deeplima::morph_model::morph_model_t::add_feat ( const std::string & name)
inlineprotected

Definition at line 212 of file morph_model.h.

◆ add_upos()

size_t deeplima::morph_model::morph_model_t::add_upos ( const std::string & name)
inlineprotected

Definition at line 202 of file morph_model.h.

◆ can_convert()

bool deeplima::morph_model::morph_model_t::can_convert ( const std::string & upos,
const std::map< std::string, std::set< std::string > > & feats ) const
inline

True when convert(upos, feats) can encode this UPOS and these features: convert only asserts it, which a release build does not check.

Definition at line 241 of file morph_model.h.

◆ convert() [1/2]

morph_feats_t deeplima::morph_model::morph_model_t::convert ( const std::string & upos,
const std::map< std::string, std::set< std::string > > & feats ) const

Definition at line 20 of file morph_model.cpp.

◆ convert() [2/2]

template<typename F>
morph_feats_t deeplima::morph_model::morph_model_t::convert ( F featid2value) const
inline

Definition at line 266 of file morph_model.h.

◆ decode_feat()

feat_base_t deeplima::morph_model::morph_model_t::decode_feat ( const morph_feats_t & feats,
size_t feat_id ) const
inline

Definition at line 183 of file morph_model.h.

◆ decode_upos()

feat_base_t deeplima::morph_model::morph_model_t::decode_upos ( const morph_feats_t & feats) const
inline

Definition at line 178 of file morph_model.h.

◆ decode_upos_to_str()

const string & deeplima::morph_model::morph_model_t::decode_upos_to_str ( const morph_feats_t & feats) const

Definition at line 55 of file morph_model.cpp.

◆ get_feat_id()

size_t deeplima::morph_model::morph_model_t::get_feat_id ( const std::string & name) const
inlineprotected

Definition at line 207 of file morph_model.h.

◆ get_feat_idx()

size_t deeplima::morph_model::morph_model_t::get_feat_idx ( const std::string & feat_name) const
inline

Definition at line 173 of file morph_model.h.

◆ get_feat_name()

const std::string & deeplima::morph_model::morph_model_t::get_feat_name ( size_t feat_id) const
inline

Definition at line 168 of file morph_model.h.

◆ get_feat_vec_ref()

const std::vector< std::string > & deeplima::morph_model::morph_model_t::get_feat_vec_ref ( size_t feat_id) const
inline

Definition at line 153 of file morph_model.h.

◆ get_feats_count()

size_t deeplima::morph_model::morph_model_t::get_feats_count ( ) const

Definition at line 61 of file morph_model.cpp.

◆ get_upos_id()

size_t deeplima::morph_model::morph_model_t::get_upos_id ( const std::string & name) const
inline

Definition at line 196 of file morph_model.h.

◆ has_feat()

bool deeplima::morph_model::morph_model_t::has_feat ( const std::string & feat_name) const
inline

Definition at line 163 of file morph_model.h.

◆ to_string() [1/2]

string deeplima::morph_model::morph_model_t::to_string ( ) const

Definition at line 216 of file morph_model.cpp.

◆ to_string() [2/2]

std::string deeplima::morph_model::morph_model_t::to_string ( const morph_feats_t & feats) const

Definition at line 273 of file morph_model.cpp.

◆ morph_model_builder

friend class morph_model_builder
friend

Definition at line 306 of file morph_model.h.

Member Data Documentation

◆ m_feats

std::vector<dict_t> deeplima::morph_model::morph_model_t::m_feats

Definition at line 233 of file morph_model.h.

◆ m_feats2mask

std::vector<std::map<size_t, size_t> > deeplima::morph_model::morph_model_t::m_feats2mask

Definition at line 232 of file morph_model.h.

◆ m_masks

std::vector<feat_base_t> deeplima::morph_model::morph_model_t::m_masks

Definition at line 229 of file morph_model.h.

◆ m_offset

std::vector<uint8_t> deeplima::morph_model::morph_model_t::m_offset

Definition at line 230 of file morph_model.h.

◆ m_upos_mask

feat_base_t deeplima::morph_model::morph_model_t::m_upos_mask

Definition at line 227 of file morph_model.h.


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