LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
ConcatenatedDataHandler.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 ***************************************************************************/
11
13
14namespace Lima
15{
16
17namespace LinguisticProcessing
18{
19
20namespace MorphologicAnalysis
21{
22
26 const FsaStringsPool* sp) :
27 m_graph(outputGraph),
28 m_srcToken(sourceToken),
29 m_stringsPool(sp),
30 m_concatVertices(),
31 m_currentToken(0),
32 m_currentData(0),
33 m_currentElement()
34{
35 m_currentElement.type=type;
36}
37
38
41
42void ConcatenatedDataHandler::foundLingInfos(StringsPoolIndex lemma,StringsPoolIndex norm)
43{
44 m_currentElement.lemma=lemma;
45 m_currentElement.normalizedForm=norm;
46}
47
50
52{
53 m_concatVertices.push_back(std::vector<LinguisticGraphVertex>());
54}
55
56void ConcatenatedDataHandler::foundComponent(uint64_t position, uint64_t length,StringsPoolIndex form)
57{
58 // create vertex and link if necessary
59 LinguisticGraphVertex componentVertex=add_vertex(*m_graph);
60 std::vector<LinguisticGraphVertex>& concatenated=m_concatVertices.back();
61 if (concatenated.size()>0)
62 {
63 add_edge(concatenated.back(),componentVertex,*m_graph);
64 }
65 concatenated.push_back(componentVertex);
66
67 m_currentToken=new Token(form,(*m_stringsPool)[form],m_srcToken->position()+position,length,m_srcToken->status());
68 put(vertex_token,*m_graph,componentVertex,m_currentToken);
69 m_currentData=new MorphoSyntacticData();
70 put(vertex_data,*m_graph,componentVertex,m_currentData);
71
72 m_currentElement.inflectedForm=form;
73}
74
76{
77 m_currentData=0;
78 m_currentToken=0;
79}
80
84
86{
87 if (m_currentData) {
88 m_currentElement.properties=lings;
89 m_currentData->push_back(m_currentElement);
90 }
91}
92
93
94}
95
96}
97
98}
@ vertex_token
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
@ vertex_data
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
virtual void foundLingInfos(StringsPoolIndex lemma, StringsPoolIndex norm) override
ConcatenatedDataHandler(LinguisticGraph *outputGraph, LinguisticAnalysisStructure::Token *sourceToken, LinguisticAnalysisStructure::MorphoSyntacticType type, const FsaStringsPool *sp)
virtual void foundComponent(uint64_t position, uint64_t length, StringsPoolIndex form) override
NAUTITIA.