LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
deeplima::Dict< T > Class Template Reference

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

Inheritance diagram for deeplima::Dict< T >:
deeplima::DictBase

Public Types

typedef T value_t
 
typedef std::vector< T >::size_type key_t
 

Public Member Functions

 Dict (const std::vector< T > &v1, const std::vector< T > &v2={})
 
 Dict (const T &UNK, const std::vector< T > &v1, const std::vector< T > &v2={})
 
template<class InputIt >
 Dict (InputIt begin, InputIt end)
 
template<class InputIt , typename F >
 Dict (const T &UNK, InputIt begin, InputIt end, F f)
 
template<class InputIt , typename F >
 Dict (const T &UNK, const T &EOS, InputIt begin, InputIt end, F f)
 
template<class InputIt , typename F >
 Dict (const T &UNK, const T &EOS, const T &OTHER, InputIt begin, InputIt end, F f)
 
template<class InputIt , typename F >
 Dict (InputIt begin, InputIt end, F f)
 
 Dict ()
 
const T & get_value (key_t idx) const
 
key_t get_idx (const T &val) const
 
virtual uint64_t size () const
 
key_t get_unk () const
 
std::string to_string ()
 
const std::unordered_map< T, key_t > & get_v2i () const
 
virtual const std::string & get_class_id () const
 
virtual c10::IValue toIValue () const
 
virtual void fromIValue (const c10::IValue &v)
 
void fromIValue (const c10::IValue &v)
 
c10::IValue toIValue () const
 
void fromIValue (const c10::IValue &v)
 
c10::IValue toIValue () const
 
void fromIValue (const c10::IValue &v)
 
c10::IValue toIValue () const
 
c10::IValue toIValue () const
 
void fromIValue (const c10::IValue &v)
 
- Public Member Functions inherited from deeplima::DictBase
virtual ~DictBase ()=default
 

Static Public Member Functions

static const std::string & class_id ()
 

Protected Member Functions

void add (const T &val)
 

Static Protected Member Functions

static std::wstring to_wstring (const std::wstring &s)
 
static std::u32string to_wstring (char32_t ch)
 
static void from_wstring (const std::wstring &src, std::wstring &k)
 
static void from_wstring (const std::wstring &src, wchar_t &k)
 

Protected Attributes

std::unordered_map< T, key_t > v2i
 
std::vector< T > i2v
 

Static Protected Attributes

static const std::string m_class_id
 

Detailed Description

template<class T>
class deeplima::Dict< T >

Definition at line 31 of file dict.h.

Member Typedef Documentation

◆ key_t

template<class T >
typedef std::vector<T>::size_type deeplima::Dict< T >::key_t

Definition at line 35 of file dict.h.

◆ value_t

template<class T >
typedef T deeplima::Dict< T >::value_t

Definition at line 34 of file dict.h.

Constructor & Destructor Documentation

◆ Dict() [1/8]

template<class T >
deeplima::Dict< T >::Dict ( const std::vector< T > &  v1,
const std::vector< T > &  v2 = {} 
)
inline

Definition at line 37 of file dict.h.

◆ Dict() [2/8]

template<class T >
deeplima::Dict< T >::Dict ( const T &  UNK,
const std::vector< T > &  v1,
const std::vector< T > &  v2 = {} 
)
inline

Definition at line 52 of file dict.h.

◆ Dict() [3/8]

template<class T >
template<class InputIt >
deeplima::Dict< T >::Dict ( InputIt  begin,
InputIt  end 
)
inlineexplicit

Definition at line 69 of file dict.h.

◆ Dict() [4/8]

template<class T >
template<class InputIt , typename F >
deeplima::Dict< T >::Dict ( const T &  UNK,
InputIt  begin,
InputIt  end,
F  f 
)
inline

Definition at line 74 of file dict.h.

◆ Dict() [5/8]

template<class T >
template<class InputIt , typename F >
deeplima::Dict< T >::Dict ( const T &  UNK,
const T &  EOS,
InputIt  begin,
InputIt  end,
F  f 
)
inline

Definition at line 97 of file dict.h.

◆ Dict() [6/8]

template<class T >
template<class InputIt , typename F >
deeplima::Dict< T >::Dict ( const T &  UNK,
const T &  EOS,
const T &  OTHER,
InputIt  begin,
InputIt  end,
F  f 
)
inline

Definition at line 121 of file dict.h.

◆ Dict() [7/8]

template<class T >
template<class InputIt , typename F >
deeplima::Dict< T >::Dict ( InputIt  begin,
InputIt  end,
F  f 
)
inline

Definition at line 146 of file dict.h.

◆ Dict() [8/8]

template<class T >
deeplima::Dict< T >::Dict ( )
inline

Definition at line 167 of file dict.h.

Member Function Documentation

◆ add()

template<class T >
void deeplima::Dict< T >::add ( const T &  val)
inlineprotected

Definition at line 257 of file dict.h.

◆ class_id()

template<class T >
static const std::string & deeplima::Dict< T >::class_id ( )
inlinestatic

Definition at line 243 of file dict.h.

◆ from_wstring() [1/2]

template<class T >
static void deeplima::Dict< T >::from_wstring ( const std::wstring &  src,
std::wstring &  k 
)
inlinestaticprotected

Definition at line 227 of file dict.h.

◆ from_wstring() [2/2]

template<class T >
static void deeplima::Dict< T >::from_wstring ( const std::wstring &  src,
wchar_t &  k 
)
inlinestaticprotected

Definition at line 232 of file dict.h.

◆ fromIValue() [1/5]

void deeplima::Dict< wstring >::fromIValue ( const c10::IValue &  v)
virtual

Implements deeplima::DictBase.

Definition at line 63 of file dict.cpp.

◆ fromIValue() [2/5]

void deeplima::Dict< string >::fromIValue ( const c10::IValue &  v)
virtual

Implements deeplima::DictBase.

Definition at line 105 of file dict.cpp.

◆ fromIValue() [3/5]

void deeplima::Dict< char32_t >::fromIValue ( const c10::IValue &  v)
virtual

Implements deeplima::DictBase.

Definition at line 139 of file dict.cpp.

◆ fromIValue() [4/5]

void deeplima::Dict< uint64_t >::fromIValue ( const c10::IValue &  v)
virtual

Implements deeplima::DictBase.

Definition at line 194 of file dict.cpp.

◆ fromIValue() [5/5]

template<class T >
void deeplima::Dict< T >::fromIValue ( const c10::IValue &  v)
virtual

Implements deeplima::DictBase.

Definition at line 36 of file dict.cpp.

◆ get_class_id()

template<class T >
virtual const std::string & deeplima::Dict< T >::get_class_id ( ) const
inlinevirtual

Implements deeplima::DictBase.

Definition at line 248 of file dict.h.

◆ get_idx()

template<class T >
key_t deeplima::Dict< T >::get_idx ( const T &  val) const
inline

Definition at line 178 of file dict.h.

◆ get_unk()

template<class T >
key_t deeplima::Dict< T >::get_unk ( ) const
inline

Definition at line 193 of file dict.h.

◆ get_v2i()

template<class T >
const std::unordered_map< T, key_t > & deeplima::Dict< T >::get_v2i ( ) const
inline

Definition at line 210 of file dict.h.

◆ get_value()

template<class T >
const T & deeplima::Dict< T >::get_value ( key_t  idx) const
inline

Definition at line 169 of file dict.h.

◆ size()

template<class T >
virtual uint64_t deeplima::Dict< T >::size ( ) const
inlinevirtual

Implements deeplima::DictBase.

Definition at line 188 of file dict.h.

◆ to_string()

template<class T >
std::string deeplima::Dict< T >::to_string ( )
inline

Definition at line 198 of file dict.h.

◆ to_wstring() [1/2]

template<class T >
static std::u32string deeplima::Dict< T >::to_wstring ( char32_t  ch)
inlinestaticprotected

Definition at line 221 of file dict.h.

◆ to_wstring() [2/2]

template<class T >
static std::wstring deeplima::Dict< T >::to_wstring ( const std::wstring &  s)
inlinestaticprotected

Definition at line 216 of file dict.h.

◆ toIValue() [1/5]

c10::IValue deeplima::Dict< wstring >::toIValue ( ) const
virtual

Implements deeplima::DictBase.

Definition at line 88 of file dict.cpp.

◆ toIValue() [2/5]

c10::IValue deeplima::Dict< string >::toIValue ( ) const
virtual

Implements deeplima::DictBase.

Definition at line 125 of file dict.cpp.

◆ toIValue() [3/5]

c10::IValue deeplima::Dict< char32_t >::toIValue ( ) const
virtual

Implements deeplima::DictBase.

Definition at line 164 of file dict.cpp.

◆ toIValue() [4/5]

c10::IValue deeplima::Dict< uint64_t >::toIValue ( ) const
virtual

Implements deeplima::DictBase.

Definition at line 181 of file dict.cpp.

◆ toIValue() [5/5]

template<class T >
c10::IValue deeplima::Dict< T >::toIValue ( ) const
virtual

Implements deeplima::DictBase.

Definition at line 21 of file dict.cpp.

Member Data Documentation

◆ i2v

template<class T >
std::vector<T> deeplima::Dict< T >::i2v
protected

Definition at line 268 of file dict.h.

◆ m_class_id

template<class T >
const std::string deeplima::Dict< T >::m_class_id
staticprotected

Definition at line 270 of file dict.h.

◆ v2i

template<class T >
std::unordered_map<T, key_t> deeplima::Dict< T >::v2i
protected

Definition at line 267 of file dict.h.


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