42namespace LinguisticProcessing
44namespace WordSenseDisambiguation
69 m_outputSuffix=string(
".senses")+
".xml";
82 auto metadata = std::dynamic_pointer_cast<LinguisticMetaData>(analysis.
getData(
"LinguisticMetaData"));
85 LOGINIT(
"WordSenseDisambiguator");
86 LERROR <<
"no LinguisticMetaData ! abort";
90 string textFileName = metadata->getMetaData(
"FileName");
91 string outputFile = textFileName + m_outputSuffix;
92 ofstream out(outputFile.c_str(), std::ofstream::binary);
94 throw runtime_error(
"can't open file " + outputFile);
97 auto anagraph=std::dynamic_pointer_cast<AnalysisGraph>(analysis.
getData(
"PosGraph"));
100 LOGINIT(
"WordSenseDisambiguator");
101 LERROR <<
"no AnalysisGraph ! abort";
106 dump(out, anagraph.get(),
107 std::dynamic_pointer_cast<AnnotationData>(analysis.
getData(
"AnnotationData")).get());
132 catch (
const boost::bad_any_cast& e)
134 LOGINIT(
"WordSenseDisambiguator");
135 LERROR <<
"non word sense annotation";
159 if (m_outputSuffix ==
".senses.xml")
161 xmlStream <<
"<?xml version='1.0' standalone='no'?>" << std::endl;
162 xmlStream <<
"<!--generated by MM project on ";
165 std::string str(ctime(&aclock));
166 str = str.substr(0,str.size()-1);
168 xmlStream <<
"-->" << std::endl;
169 xmlStream <<
"<!DOCTYPE WORDSENSE SYSTEM \"wordsense.dtd\">" << std::endl;
170 xmlStream << std::endl;
171 xmlStream <<
"<TEXT>" << std::endl;
177 xmlStream << std::endl << std::endl <<
"</TEXT>" << std::endl;
AgglutinatedToken is a fulltoken that is a agglutinated compound word.
This file is the main header file for the data related to annotation graphs.
boost::graph_traits< LinguisticGraph >::edge_descriptor LinguisticGraphEdge
typedefs to simplify the access to various graphs elements
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
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.
Data used for the syntactic analyzis of texts.
xml logger for Word Senses
#define WORDSENSEXMLLOGGER_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
Holds an annotation graph and gives an API to manipulate it.
const GenericAnnotation & annotation(AnnotationGraphVertex v1, AnnotationGraphVertex v2, const LimaString &annot) const
This class allows to convert any object into an annotation by inheritance.
std::string & getParamsValueAtKey(const std::string &key)
return a message when a 'param' was not found
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...
virtual void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
An AnalysisData containing a LinguisticGraph with a language and an id.
const LinguisticGraph * getGraph(void) const
Returns the underlying graph structure.
const LinguisticGraphVertex & firstVertex(void) const
Returns the first vertex of the graph.
holds surface data of a token
const LimaString & stringForm() const
void examine_edge(LinguisticGraphEdge e, const LinguisticGraph &g)
virtual void outputXml(std::ostream &xmlStream, const LinguisticGraph &g) const
LimaStatusCode process(AnalysisContent &analysis) const override
Process on data in analysisContent.
virtual ~WordSenseXmlLogger()
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
bool hasAnnotation(AnnotationGraphVertex v, const LimaString &annot) const
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, WordSenseXmlLogger > fullTokenXmlLoggerFactory(WORDSENSEXMLLOGGER_CLASSID)
launch exception related to the configuration file parsing