25#include "common/misc/LimaString.h"
27#include "common/misc/traceUtils.h"
43namespace LinguisticProcessing
45namespace MorphologicAnalysis
69 LINFO <<
"starting process DicoConcatenated";
71 auto tokenList=std::dynamic_pointer_cast<AnalysisGraph>(analysis.
getData(
"AnalysisGraph"));
76 boost::tie(it,itEnd)=vertices(*g);
80 Token* currentToken=tokenMap[*it];
81 if (currentToken==0)
continue;
84 DictionaryEntry* entry=currentToken->dictionaryEntry();
85 if (entry->hasConcatenated())
90 expandConcatenatedEntries(*it,g,currentToken,entry);
99 for (vector<Token*>::const_iterator tokItr=orthos.begin();
100 tokItr!=orthos.end();
103 DictionaryEntry* entry=(*tokItr)->dictionaryEntry();
104 if (entry->hasConcatenated())
106 expandConcatenatedEntries(*it,g,currentToken,entry);
111 if (expanded && currentData->empty())
113 clear_vertex(*it,*g);
117 LINFO <<
"ending process DicoConcatenated";
123void DicoConcatenatedAlternatives::expandConcatenatedEntries(
127 DictionaryEntry* entry)
const
130 LDEBUG <<
"DicoConcatenatedAlternatives::expandConcatenatedEntries" << v;
131 list<LinguisticGraphVertex> preds,succs;
133 boost::tie(inItr,inItrEnd)=in_edges(v,*g);
134 for (;inItr!=inItrEnd;inItr++)
136 preds.push_back(source(*inItr,*g));
139 boost::tie(outItr,outItrEnd)=out_edges(v,*g);
140 for (;outItr!=outItrEnd;outItr++)
142 succs.push_back(target(*outItr,*g));
146 if (entry->hasConcatenated())
148 StringsPool& sp=Common::LinguisticData::LinguisticData::changeable().stringsPool(m_language);
149 ConcatenatedEntry concatEntry=entry->nextConcatenated();
150 while (!concatEntry.isEmpty())
152 list<LinguisticGraphVertex> localpreds(preds);
154 SingleConcatenatedEntry singleEntry=concatEntry.nextSingleConcatenated();
155 while (!singleEntry.isEmpty())
158 unsigned char* adr = singleEntry.dictionaryEntryAddress();
165 nft->setDictionaryEntry(ent);
171 for (list<LinguisticGraphVertex>::const_iterator predItr=localpreds.begin();
172 predItr!=localpreds.end();
175 add_edge(*predItr,nv,*g);
179 localpreds.push_back(nv);
180 singleEntry=concatEntry.nextSingleConcatenated();
183 for (list<LinguisticGraphVertex>::const_iterator predItr=localpreds.begin();
184 predItr!=localpreds.end();
187 for (list<LinguisticGraphVertex>::const_iterator succItr=succs.begin();
188 succItr!=succs.end();
191 add_edge(*predItr,*succItr,*g);
194 concatEntry=entry->nextConcatenated();
#define DICOCONCATENATEDALTERNATIVES_CLASSID
LinguisticGraph::in_edge_iterator LinguisticGraphInEdgeIt
boost::property_map< LinguisticGraph, vertex_data_t >::type VertexDataPropertyMap
LinguisticGraph::vertex_iterator LinguisticGraphVertexIt
boost::property_map< LinguisticGraph, vertex_token_t >::type VertexTokenPropertyMap
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
LinguisticGraph::out_edge_iterator LinguisticGraphOutEdgeIt
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
Defines a Factory to create Object of type Base.
Holds all data that pass through the ProcessUnits Analysis data are shared pointers,...
std::shared_ptr< AnalysisData > getData(const QString &id)
return AnalysisData by id
Manage initialization of InitializableObjects using configuration module and parameters.
const InitializationParameters & getInitializationParameters() const
get Initialization Parameters
Holds morphosyntactic informations.
holds surface data of a token
const std::vector< StringsPoolIndex > & orthographicAlternatives() const
StringsPoolIndex form() const
LimaStatusCode process(AnalysisContent &analysis) const
Process on data in analysisContent.
virtual ~DicoConcatenatedAlternatives()
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager)
initialize with parameters from configuration file.
DicoConcatenatedAlternatives()
static void logElapsedTime(const std::string &mess, const std::string &taskCategory=std::string(""))
log the number of microseconds since last UpdateCurrentTime
static void updateCurrentTime(const std::string &taskCategory=std::string(""))
store current time for new elapsed time computation
@ CONCATENATED_ALTERNATIVE
SimpleFactory< LinguisticProcessUnit, DicoConcatenatedAlternatives > dicoConcatenatedAlternativesFactory(DICOCONCATENATEDALTERNATIVES_CLASSID)
launch exception related to the configuration file parsing