LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
deaccentuatedTransition.cpp
Go to the documentation of this file.
1// Copyright 2002-2019 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/************************************************************************
7 *
8 * @file deaccentuatedTransition.cpp
9 * @author besancon (besanconr@zoe.cea.fr)
10 * @date Mon Jan 3 2005
11 * @version $Id$
12 * copyright Copyright (C) 2005-2019 by CEA LIST
13 *
14 ***********************************************************************/
15
20
21using namespace std;
23
24namespace Lima {
25namespace LinguisticProcessing {
26namespace Automaton {
27
28//***********************************************************************
29// constructors
30//***********************************************************************
33m_deaccentuatedForm(),
34m_language(0),
35m_charchart(0)
36{
37}
38
40DeaccentuatedTransition(const LimaString& deaccentuatedForm,
41 MediaId language):
43m_deaccentuatedForm(deaccentuatedForm),
44m_language(language),
45m_charchart(0)
46{
47 auto res = LinguisticResources::single().getResource(m_language,"charchart");
48 m_charchart = std::dynamic_pointer_cast<FlatTokenizer::CharChart>(res);
49}
50
54m_deaccentuatedForm(t.m_deaccentuatedForm),
55m_language(t.m_language),
56m_charchart(0)
57{
58 auto res = LinguisticResources::single().getResource(m_language,"charchart");
59 m_charchart = std::dynamic_pointer_cast<FlatTokenizer::CharChart>(res);
60}
61
62//***********************************************************************
63// destructor
64//***********************************************************************
67
68//***********************************************************************
69// assignment operator
70//***********************************************************************
73 if (this != &t) {
75 m_deaccentuatedForm = t.getDeaccentuatedForm();
76 m_language =t.m_language;
77 auto res = LinguisticResources::single().getResource(m_language,"charchart");
78 m_charchart = std::dynamic_pointer_cast<FlatTokenizer::CharChart>(res);
79 }
80 return *this;
81}
82
83//***********************************************************************
84// member functions
85//***********************************************************************
92
96
98 ostringstream oss;
99 oss << "deaccentT~" << Common::Misc::limastring2utf8stdstring(m_deaccentuatedForm);
100 return oss.str();
101}
102
104 if (type() == t.type() &&
105 m_deaccentuatedForm ==
106 static_cast<const DeaccentuatedTransition&>(t).
108 return compareProperties(t);
109 }
110 return false;
111}
112
115 const LinguisticGraphVertex& /*vertex*/,
116 AnalysisContent& /*analysis*/,
119{
120 return (m_charchart->unmark(token->stringForm()) == m_deaccentuatedForm);
121}
122
123} // end namespace
124} // end namespace
125} // end namespace
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
bool compare(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &vertex, AnalysisContent &analysis, const LinguisticAnalysisStructure::Token *token, const LinguisticAnalysisStructure::MorphoSyntacticData *data) const override
comparison of the transition with a token : can use the graph and vertex info, associated with genera...
DeaccentuatedTransition & operator=(const DeaccentuatedTransition &)
bool compareProperties(const TransitionUnit &t) const
TransitionUnit & operator=(const TransitionUnit &transition)
An AnalysisData containing a LinguisticGraph with a language and an id.
static const LinguisticResources & single()
const singleton accessor
Definition Singleton.h:51
std::string limastring2utf8stdstring(const Lima::LimaString &phrase, uint32_t size0)
Convert a wide string to a string , in dest up to size bytes.
NAUTITIA.
QString LimaString
Definition LimaString.h:33
STL namespace.