LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
AgglutinatedToken.cpp
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
16#include "AgglutinatedToken.h"
17#include <set>
18
19namespace Lima
20{
21namespace LinguisticProcessing
22{
23namespace LinguisticAnalysisStructure
24{
25
27 Token(ft),
28 m_cuttings()
29{}
30
31AgglutinatedToken::~ AgglutinatedToken()
32{
33// std::cerr << "in deletion of agglutinated token " << stringForm() << std::endl;
34 std::set<Token*> tokToDelete;
35 std::set<MorphoSyntacticData*> dataToDelete;
36 for (T_CUTTINGS::iterator it=m_cuttings.begin();
37 it!=m_cuttings.end();
38 it++)
39 {
40 for (Cutting::iterator part=it->begin();
41 part!=it->end();
42 part++)
43 {
44 tokToDelete.insert(part->first);
45 dataToDelete.insert(part->second);
46 }
47 }
48 for (std::set<Token*>::iterator it=tokToDelete.begin();
49 it!=tokToDelete.end();
50 it++)
51 {
52// std::cerr << "delete " << (*it)->stringForm() << std::endl;
53 delete *it;
54 }
55 for (std::set<MorphoSyntacticData*>::iterator it=dataToDelete.begin();
56 it!=dataToDelete.end();
57 it++)
58 {
59// std::cerr << "delete data " << *it << std::endl;
60 delete *it;
61 }
62}
63
65{
66 m_cuttings=cuttings;
67}
68
70{
71 return m_cuttings;
72}
73
74void AgglutinatedToken::outputXml(std::ostream& xmlStream,const Common::PropertyCode::PropertyCodeManager& pcm,const FsaStringsPool& sp) const
75{
76 Token::outputXml(xmlStream,pcm,sp);
77 xmlStream << " <agglutination_properties>" << std::endl;
78 for (T_CUTTINGS::const_iterator it=m_cuttings.begin();
79 it!=m_cuttings.end();
80 it++)
81 {
82 xmlStream << " <cutting>" << std::endl;
83 for (Cutting::const_iterator cuttingItr=it->begin();
84 cuttingItr!=it->end();
85 cuttingItr++)
86 {
87 xmlStream << " <cutting_part>" << std::endl;
88 xmlStream << " <token>" << std::endl;
89 cuttingItr->first->outputXml(xmlStream,pcm,sp);
90 xmlStream << " </token>" << std::endl;
91 cuttingItr->second->outputXml(xmlStream,pcm,sp);
92 xmlStream << " </cutting_part>" << std::endl;
93 }
94 xmlStream << " </cutting>" << std::endl;
95 }
96 xmlStream << " </agglutination_properties>" << std::endl;
97}
98
99} // closing namespace Data
100} // closing namespace LinguisticProcessing
101} // closing namespace Lima
AgglutinatedToken is a fulltoken that is a agglutinated compound word.
Provide tools to parse a property file, and deal with the property coding system.
virtual void outputXml(std::ostream &XmlStream, const Common::PropertyCode::PropertyCodeManager &pcm, const FsaStringsPool &sp) const override
virtual void outputXml(std::ostream &xmlStream, const Common::PropertyCode::PropertyCodeManager &pcm, const FsaStringsPool &sp) const
Definition Token.cpp:60
NAUTITIA.