LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
lemmatization_impl.h
Go to the documentation of this file.
1// Copyright 2002-2021 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6#ifndef DEEPLIMA_LEMMATIZATION_IMPL_H
7#define DEEPLIMA_LEMMATIZATION_IMPL_H
8
16
17namespace deeplima
18{
19namespace lemmatization
20{
21
22namespace impl {
23
25
27{
28public:
29
31
33 size_t threads,
34 size_t buffer_size_per_thread
35 );
36
37 virtual ~LemmatizationImpl() = default;
38
39 virtual void load(const std::string& fn, const PathResolver& /*path_resolver*/);
40
41 void init(size_t max_input_word_len,
42 const std::vector<std::string>& class_names,
43 const std::vector<std::vector<std::string>>& class_values);
44
48 bool is_fixed(std::shared_ptr< StdMatrix<uint8_t> > classes, size_t idx);
49
50 morph_model::morph_feats_t get_morph_feats(std::shared_ptr< StdMatrix<uint8_t> > classes, size_t idx) const;
51
52 void predict(const std::u32string& form,
53 std::shared_ptr< StdMatrix<uint8_t> > classes, size_t idx,
54 std::u32string& target);
55
56
57protected:
63 std::vector<size_t> m_feat2cls;
65 size_t m_upos_idx;
67 std::vector<bool> m_fixed_upos;
68};
69
70} // namespace impl
71} // namespace lemmatization
72} // namespace deeplima
73
74#endif // DEEPLIMA_LEMMATIZATION_IMPL_H
75
bool is_fixed(std::shared_ptr< StdMatrix< uint8_t > > classes, size_t idx)
size_t m_upos_idx
index in the features matrix of the upos line
std::vector< bool > m_fixed_upos
index i is true if upos whose index is i is considered as fixed
size_t m_max_input_word_len
max word length the encoder workbench / vectorizer were sized for (see init)
void init(size_t max_input_word_len, const std::vector< std::string > &class_names, const std::vector< std::vector< std::string > > &class_values)
void predict(const std::u32string &form, std::shared_ptr< StdMatrix< uint8_t > > classes, size_t idx, std::u32string &target)
morph_model::morph_feats_t get_morph_feats(std::shared_ptr< StdMatrix< uint8_t > > classes, size_t idx) const
virtual void load(const std::string &fn, const PathResolver &)
Encoding on one 64 bits integer of the set of morphological features for one token.
Definition morph_model.h:36