LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
CompoundTokenAnnotation.cpp
Go to the documentation of this file.
1// Copyright 2002-2022 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
9
11
12namespace Lima
13{
14
15namespace LinguisticProcessing
16{
17
18namespace Compounds
19{
20
22 m_realization(0),
23 m_conceptType(std::numeric_limits<uint32_t>::max()),
24 m_referencedAnnotations()
25{
26}
27
29 const StringsPoolIndex& realization,
30 const Common::MediaticData::ConceptType type,
31 const std::vector< uint64_t >& references) :
32 m_realization(realization),
33 m_conceptType(type),
34 m_referencedAnnotations(references)
35{
36}
37
41
42void ConceptModifier::dump(std::ostream& os,const FsaStringsPool& sp) const
43{
44 os << "<conceptModifier real=\""
46 <<"\" type=\""
47// << Common::MediaticData::MediaticData::single().getConceptName(m_conceptType)
48 << m_conceptType
49 <<"\" refs=\"";
50 std::vector< uint64_t >::const_iterator it, it_end;
51 it = m_referencedAnnotations.begin(); it_end = m_referencedAnnotations.end();
52 if (it != it_end)
53 {
54 os << *it;
55 it++;
56 }
57 for (; it != it_end; it++)
58 {
59 os << "," << *it;
60 }
61 os << "\" />";
62}
63
64
65void CompoundTokenAnnotation::dump(std::ostream& os,const FsaStringsPool& sp)
66{
67 os << "<cpdtok>" << std::endl;
68 CompoundTokenAnnotation::const_iterator it, it_end;
69 it = begin(); it_end = end();
70 for (; it != it_end; it++)
71 {
72 it->dump(os,sp);
73 os << std::endl;
74 }
75 os << "</cpdtok>" << std::endl;
76}
77
79{
81 try
82 {
83 ga.value<CompoundTokenAnnotation>().dump(os,m_sp);
84 return SUCCESS_ID;
85 }
86 catch (const boost::bad_any_cast& )
87 {
88 LERROR << "This annotation is not a CompoundTokenAnnotation ; nothing dumped";
89 return UNKNOWN_ERROR;
90 }
91}
92
93
94} // Compounds
95} // LinguisticProcessing
96} // Lima
97
#define LERROR
Definition LimaCommon.h:161
#define PROCESSORSLOGINIT
Definition LimaCommon.h:211
This class allows to convert any object into an annotation by inheritance.
void dump(std::ostream &os, const FsaStringsPool &sp)
The functions that dumps a CompoundTokenAnnotation on an output stream.
void dump(std::ostream &os, const FsaStringsPool &sp) const
The functions that dumps a ConceptModifier on an output stream.
virtual int dump(std::ostream &os, Common::AnnotationGraphs::GenericAnnotation &ga) const override
std::string limastring2utf8stdstring(const Lima::LimaString &phrase, uint32_t size0)
Convert a wide string to a string , in dest up to size bytes.
NAUTITIA.
@ UNKNOWN_ERROR
Definition LimaCommon.h:238
@ SUCCESS_ID
Definition LimaCommon.h:237
STL namespace.