32 namespace LinguisticProcessing
34 namespace Coreferences
63 auto annotationData = std::dynamic_pointer_cast<AnnotationData>(analysis.
getData(
"AnnotationData"));
64 const auto& graph = *(std::dynamic_pointer_cast<LinguisticAnalysisStructure::AnalysisGraph>(analysis.
getData(m_graph)));
67 auto metadata = std::dynamic_pointer_cast<LinguisticMetaData>(analysis.
getData(
"LinguisticMetaData"));
71 LERROR <<
"no LinguisticMetaData ! abort";
76 if (!
openLogFile(out,metadata->getMetaData(
"FileName")))
79 LERROR <<
"Can't open log file ";
83 out <<
"<coreferences>" << endl;
88 boost::tie(itv, itv_end) = vertices(annotationData->getGraph());
89 for (; itv != itv_end; itv++)
102 catch (
const boost::bad_any_cast& )
105 LERROR <<
"One annotation on vertex " << *itv <<
" you are trying to cast is not a Coreference; Coreference not logged";
106 for (
int i = 0; i < 19 ; i++)
108 LERROR <<
"annot "<< i <<
" : " << annotationData->annotationName(i);
116 LERROR <<
"Vertex " << *itv <<
" has no entry in the analysis graph token map. This should not happen !!";
123 boost::tie(it, it_end) = boost::out_edges(
static_cast<AnnotationGraphVertex>(*itv), annotationData->getGraph());
125 for (; it != it_end; it++)
134 catch (
const boost::bad_any_cast& )
137 LERROR <<
"One annotation on vertex you are trying to cast resulting from an edge out of " << *itv <<
" is not a Coreference; Coreference not logged";
142 out <<
" <reference>\n"
144 <<
" <len>" << token->
stringForm().length() <<
"</len>\n"
146 <<
" <npId>" << annot->
id() <<
"</npId>\n"
147 <<
" <posVertex>" << annot->
morphVertex() <<
"</posVertex>\n";
151 out <<
" <npRef>" << antecedent->
id() <<
"</npRef>\n";
152 out <<
" <refPosVertex>" << antecedent->
morphVertex() <<
"</refPosVertex>\n";
153 out <<
" <salience>" << annot->
salience() <<
"</salience>\n";
155 out <<
" <categ>" << annot->
categ() <<
"</categ>\n"
161 out <<
"</coreferences>" << endl;
This file is the main header file for the data related to annotation graphs.
#define COREFSOLVINGNORMALIZEDXMLLOGGER_CLASSID
#define COREFSOLVERLOGINIT
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
A generic process unit to log information in files: contains some common informations such as : outpu...
bool openLogFile(std::ofstream &output, const std::string &sourceFile) const
virtual void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
virtual LimaStatusCode process(AnalysisContent &analysis) const override
Process on data in analysisContent.
virtual void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
virtual ~CorefSolvingNormalizedXmlLogger()
CorefSolvingNormalizedXmlLogger()
LinguisticGraphVertex morphVertex()
holds surface data of a token
const LimaString & stringForm() const
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
AnnotationGraph::vertex_iterator AnnotationGraphVertexIt
AnnotationGraph::vertex_descriptor AnnotationGraphVertex
AnnotationGraph::out_edge_iterator AnnotationGraphOutEdgeIt
std::string transcodeToXmlEntities(const std::string &str)
std::string limastring2utf8stdstring(const Lima::LimaString &phrase, uint32_t size0)
Convert a wide string to a string , in dest up to size bytes.
LimaString utf8stdstring2limastring(const std::string &src)
SimpleFactory< MediaProcessUnit, CorefSolvingNormalizedXmlLogger > CorefSolvingNormalizedXmlLoggerFactory(COREFSOLVINGNORMALIZEDXMLLOGGER_CLASSID)