LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
UnknownWordLogger.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 "UnknownWordLogger.h"
11
19
20#include <fstream>
21
22
23using namespace boost;
26using namespace std;
27
28namespace Lima
29{
30
31namespace LinguisticProcessing
32{
33
34namespace MorphologicAnalysis
35{
36
38
42
45
48 Manager* manager)
49{
50 AbstractTextualAnalysisDumper::init(unitConfiguration,manager);
51}
52
54 AnalysisContent& analysis) const
55{
57
58 auto tokenList=std::dynamic_pointer_cast<AnalysisGraph>(analysis.getData("AnalysisGraph"));
59 LinguisticGraph* g=tokenList->getGraph();
60
61 try
62 {
63
65 boost::tie(v, vEnd) = vertices(*g);
66
67 // Lima::LimaString dummyString;
68
69 for (; v != vEnd; v++)
70 {
71 MorphoSyntacticData* currentData=get(vertex_data, *g, *v);
72 Token* tok=get(vertex_token, *g, *v);
73 if (currentData == 0)
74 {
75 continue;
76 } // NULL for first and last vertex
77
78 if (in_degree(*v,*g)==0) {
79 // ignore this vertex, it's not in graph
80 continue;
81 }
82
83 //<if token has any linguistic properties, directly or by its
84 // orthographic alternatives, default properties are not applied>
85 if ((m_out != 0) && currentData->empty())
86 {
88 }
89 }
90 }
91 catch (std::exception &exc)
92 {
94 LWARN << "Exception in UnknownWordLogger : " << exc.what();
95 return UNKNOWN_ERROR;
96 }
97
98 // Graphe après l'affectation des propriétés par défaut
99 // std::cout << std::endl;
100 // std::cout << "Graph after Default Properties:" << std::endl;
101
102 // Fin de l'analyse morphologique
103 // std::cout << "End of Morphological Analysis" << std::endl;
104 // std::cout << std::endl;
105
106 TimeUtils::logElapsedTime("UnknownWordLogger");
107 return SUCCESS_ID;
108}
109
110
111}
112
113}
114
115}
#define LWARN
Definition LimaCommon.h:160
LinguisticGraph::vertex_iterator LinguisticGraphVertexIt
@ vertex_token
@ vertex_data
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
#define MORPHOLOGINIT
Defines a Factory to create Object of type Base.
#define UNKNOWNWORDLOGGER_CLASSID
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.
virtual void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
LimaStatusCode process(AnalysisContent &analysis) const override
Process on data in analysisContent.
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
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
std::string limastring2utf8stdstring(const Lima::LimaString &phrase, uint32_t size0)
Convert a wide string to a string , in dest up to size bytes.
SimpleFactory< MediaProcessUnit, UnknownWordLogger > unknownWordLoggerFactory(UNKNOWNWORDLOGGER_CLASSID)
NAUTITIA.
LimaStatusCode
Definition LimaCommon.h:236
@ UNKNOWN_ERROR
Definition LimaCommon.h:238
@ SUCCESS_ID
Definition LimaCommon.h:237
STL namespace.
launch exception related to the configuration file parsing