LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
Token.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
6/***************************************************************************
7 * Copyright (C) 2004-2012 by CEA LIST *
8 * *
9 ***************************************************************************/
10#include "Token.h"
11#include "TStatus.h"
13
14using namespace Lima::Common::MediaticData;
15
16namespace Lima {
17
18namespace LinguisticProcessing {
19
20namespace LinguisticAnalysisStructure {
21
23 StringsPoolIndex form,
24 const LimaString& stringForm,
25 uint64_t position,
26 uint64_t length) :
27 m_form(form),
28 m_stringForm(stringForm),
29 m_position(position),
30 m_length(length),
31 m_status()
32{}
33
35 StringsPoolIndex form,
36 const LimaString& stringForm,
37 uint64_t position,
38 uint64_t length,
39 const TStatus& status) :
40 m_form(form),
41 m_stringForm(stringForm),
42 m_position(position),
43 m_length(length),
44 m_status(status)
45{}
46
47Token::Token(const Token& tok) :
48 m_form(tok.m_form),
49 m_stringForm(tok.m_stringForm),
50 m_position(tok.m_position),
51 m_length(tok.m_length),
52 m_status(tok.m_status)
53{
54}
55
57{
58}
59
60void Token::outputXml(std::ostream& xmlStream,
62 const FsaStringsPool& sp) const
63{
64 xmlStream << " <string>"
65 << Common::Misc::transcodeToXmlEntities(m_stringForm).toStdString()
66 << "</string>" << std::endl;
67 xmlStream << " <position>" << position() << "</position>" << std::endl;
68 xmlStream << " <length>" << length() << "</length>" << std::endl;
69 if (!m_alternatives.empty()) {
70 xmlStream << " <alternatives>" << std::endl;
71 for (auto it = m_alternatives.cbegin(); it != m_alternatives.cend();
72 it++)
73 {
74 xmlStream << " <string>"
75 << Common::Misc::transcodeToXmlEntities(sp[*it]).toStdString()
76 << "</string>" << std::endl;
77 }
78 xmlStream << " </alternatives>" << std::endl;
79 }
80 xmlStream << " <t_status>" << std::endl;
81 m_status.outputXML(xmlStream);
82 xmlStream << " </t_status>" << std::endl;
83}
84
85}
86
87}
88
89}
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
Definition Token.cpp:60
Token(StringsPoolIndex form, const LimaString &stringForm, uint64_t position, uint64_t length)
Definition Token.cpp:22
LimaString transcodeToXmlEntities(const LimaString &str)
NAUTITIA.
QString LimaString
Definition LimaString.h:33