LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
lemmaTransition.cpp
Go to the documentation of this file.
1// Copyright 2002-2020 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/*************************************************************************
7*
8* File : lemmaTransition.cpp
9* Author : Romaric Besan�n (besanconr@zoe.cea.fr)
10* Created on : Wed Nov 13 2002
11* Copyright : (c) 2002 by CEA
12* Version : $Id$
13*
14*************************************************************************/
15
16#include "lemmaTransition.h"
17#include <iostream>
18#include <fstream>
19
20using namespace std;
22using namespace Lima::Common::MediaticData;
23
24namespace Lima {
25namespace LinguisticProcessing {
26namespace Automaton {
27
28/***********************************************************************/
29// constructors
30/***********************************************************************/
33m_lemma(),
34m_pos()
35{}
36
38 const Tpos p,
39 const Common::PropertyCode::PropertyAccessor* macroAccessor,
40 const Common::PropertyCode::PropertyAccessor* microAccessor,
41 bool keep):
42TransitionUnit(keep),
43m_lemma(s),
44m_pos(p),
45m_macroAccessor(macroAccessor),
46m_microAccessor(microAccessor) {
47}
48
51m_lemma(t.lemma()),
52m_pos(t.partOfSpeech()),
53m_macroAccessor(t.m_macroAccessor),
54m_microAccessor(t.m_microAccessor) {
55// copyProperties(t);
56}
57
59
61 if (this != &t) {
62 m_lemma = t.lemma();
63 m_pos = t.partOfSpeech();
64 m_macroAccessor = t.m_macroAccessor;
65 m_microAccessor = t.m_microAccessor;
67 }
68 return *this;
69}
70
71/***********************************************************************/
72// operators ==
73/***********************************************************************/
75 if (type() == tright.type()) {
76 const LemmaTransition& other=
77 static_cast<const LemmaTransition&>(tright);
78 if (m_lemma == other.lemma() && m_pos == other.partOfSpeech()) {
79 return compareProperties(tright);
80 }
81 }
82 return false;
83}
84
87 const LinguisticGraphVertex& /*vertex*/,
88 AnalysisContent& /*analysis*/,
91{
92 MorphoSyntacticData::const_iterator
93 it=data->begin(),
94 it_end=data->end();
95 for (; it!=it_end; it++) {
96 if ( ((*it).lemma == m_lemma) &&
97 compareTpos(m_pos,(*it).properties,
98 *m_macroAccessor,
99 *m_microAccessor)) {
100 return true;
101 }
102 }
103 return false;
104}
105
106/***********************************************************************/
107// output
108/***********************************************************************/
110 return sp[m_lemma];
111}
112
113std::string LemmaTransition::printValue() const {
114 ostringstream oss;
115/* const FsaStringsPool& sp=Common::MediaticData::MediaticData::single().stringsPool(0);
116 LimaString s = sp[(StringsPoolIndex)m_lemma];
117 oss << s << "|$" << m_pos;*/
118 oss << "lemmaT'" << m_lemma << "'$" << m_pos.toString();
119 return oss.str();
120}
121
122} // namespace end
123} // namespace end
124} // namespace end
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
Provide function to read write and check a property.
std::string toString() const
Definition StdBitset.h:152
bool operator==(const TransitionUnit &) const override
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...
LemmaTransition & operator=(const LemmaTransition &)
LimaString lemmaString(const FsaStringsPool &sp) const
bool compareProperties(const TransitionUnit &t) const
An AnalysisData containing a LinguisticGraph with a language and an id.
bool compareTpos(const Tpos &pos, const LinguisticCode &lingProperty, const PropertyCode::PropertyAccessor &macroAccessor, const PropertyCode::PropertyAccessor &microAccessor)
NAUTITIA.
QString LimaString
Definition LimaString.h:33
STL namespace.