LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
SimplificationData.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
17#include "SimplificationData.h"
18
19namespace Lima {
20namespace LinguisticProcessing {
21namespace SyntacticAnalysis {
22
32
36
41{
42 if (m_simplifications.find(m_sentence) == m_simplifications.end())
43 {
44 m_simplifications.insert(std::make_pair(m_sentence, std::list< boost::tuple< LinguisticGraphEdge, LinguisticGraphEdge, Common::MediaticData::SyntacticRelationId > >()));
45 }
46 m_simplifications[m_sentence].push_back(boost::make_tuple(first, last, type));
47 m_simplificationDone = true;
48}
49
50std::list< boost::tuple< LinguisticGraphEdge, LinguisticGraphEdge, Common::MediaticData::SyntacticRelationId > >& SimplificationData::simplifications(LinguisticGraphVertex sent)
51{
52 if (m_simplifications.find(sent) == m_simplifications.end())
53 {
54 m_simplifications.insert(std::make_pair(sent, std::list< boost::tuple< LinguisticGraphEdge, LinguisticGraphEdge, Common::MediaticData::SyntacticRelationId > >()));
55 }
56 return m_simplifications[sent];
57}
58
59void SimplificationData::subSentBounds(const boost::tuple<LinguisticGraphVertex, LinguisticGraphVertex, Common::MediaticData::SyntacticRelationId >& bounds)
60{
61 std::list< boost::tuple< LinguisticGraphVertex, LinguisticGraphVertex, Common::MediaticData::SyntacticRelationId > >::iterator it, it_end;
62 it = m_subSentBounds.begin(); it_end = m_subSentBounds.end();
63 for (; it != it_end ; it++)
64 {
65 if ( ( (*it).get<0>() == bounds.get<0>()
66 || (*it).get<1>() == bounds.get<0>()
67 || (*it).get<0>() == bounds.get<1>()
68 || (*it).get<1>() == bounds.get<1>())
69 && ((*it).get<2>() == bounds.get<2>()) )
70 {
71 m_subSentBounds.erase(it);
72 break;
73 }
74 }
75 m_subSentBounds.push_back(bounds);
76}
77
78} // closing namespace SyntacticAnalysis
79} // closing namespace LinguisticProcessing
80} // closing namespace Lima
#define LIMA_UNUSED(x)
Definition LimaCommon.h:224
boost::graph_traits< LinguisticGraph >::edge_descriptor LinguisticGraphEdge
typedefs to simplify the access to various graphs elements
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
Data used for the simplification of sentences allowing easier heterosyntagmatic analysis.
An AnalysisData containing a LinguisticGraph with a language and an id.
const std::list< boost::tuple< LinguisticGraphVertex, LinguisticGraphVertex, Common::MediaticData::SyntacticRelationId > > & subSentBounds() const
SimplificationData(LinguisticAnalysisStructure::AnalysisGraph *pit)
std::list< boost::tuple< LinguisticGraphEdge, LinguisticGraphEdge, Common::MediaticData::SyntacticRelationId > > & simplifications(LinguisticGraphVertex sent)
void addSimplification(LinguisticGraphEdge first, LinguisticGraphEdge last, Common::MediaticData::SyntacticRelationId type)
NAUTITIA.