35namespace LinguisticProcessing {
36namespace AnalysisDumpers {
59 out <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
60 out <<
"<Doc>" << endl;
61 if (!sourceFile.empty())
63 out <<
"<sourceFile>" << sourceFile <<
"</sourceFile>" << endl;
68 out <<
"</Doc>" << endl;
72 out <<
"<specific_entities>" << endl;
76 out <<
"</specific_entities>" << endl;
80 out <<
"<relations>" << endl;
84 out <<
"</relations>" << endl;
88 out <<
"<events>" << endl;
92 out <<
"</events>" << endl;
97 unsigned int entityId,
98 const std::string& entityType,
99 const std::string& entityString,
100 const std::vector<std::pair<uint64_t,uint64_t> >& positions,
104 <<
"<id>" <<
"T" << entityId <<
"</id>"
105 <<
"<type>" << entityType <<
"</type>";
107 if (positions.size()==0) {
108 LOGINIT(
"LP::AnalysisDumpers");
109 LERROR <<
"XmlIEDumper: missing position for entity" << entityString;
112 out <<
"<posD>" << positions.front().first <<
"</posD>";
113 out <<
"<posF>" << positions.back().second <<
"</posF>";
116 string str(entityString);
117 std::string::iterator new_end =
118 std::unique(str.begin(), str.end(), [=](
char lhs,
char rhs){ return (lhs == rhs) && (lhs ==
' '); } );
119 str.erase(new_end, str.end());
125 for (Automaton::EntityFeatures::const_iterator
126 featureItr=entityFeatures.begin(),features_end=entityFeatures.end();
127 featureItr!=features_end; featureItr++)
129 out <<
"<" << featureItr->getName() <<
">"
131 <<
"</" << featureItr->getName() <<
">";
134 out <<
"</entity>\n";
139 [[maybe_unused]]
unsigned int entityId,
140 [[maybe_unused]]
const std::string& entityNorm)
const
147 std::map <std::tuple <std::size_t, std::string , std::string >, std::size_t >& )
const
153 unsigned int relationId,
154 const std::string& relationType,
155 const std::string& sourceArgString,
156 const std::string& targetArgString)
const
158 out <<
"<relation><id>R" << relationId <<
"</id><type>" << relationType <<
"</type>";
159 out <<
"<source>T" << sourceArgString <<
"</source>";
160 out <<
"<target>T" << targetArgString <<
"</target>";
161 out <<
"</relation>" << endl;
167 unsigned int eventId,
168 unsigned int eventMentionId,
169 const std::string& eventMentionType,
170 const std::vector<unsigned int>& eventRoleId,
171 const std::vector<std::string>& eventRoleType)
const
173 out <<
"<event><id>E" << eventId <<
"</id>" << endl
174 <<
"<eventElements>" << endl;
176 out <<
"<element><role>"<< eventMentionType <<
"</role><id>T" << eventMentionId <<
"</id></element>" << endl;
178 for (
unsigned int i(0), n=eventRoleId.size(); i<n; i++) {
179 out <<
"<element><role>"<< eventRoleType[i] <<
"</role><id>T" << eventRoleId[i] <<
"</id></element>" << endl;
181 out <<
"</eventElements>" << endl
182 <<
"</event>" << endl;
This file is the main header file for the data related to annotation graphs.
Defines a Factory to create Object of type Base.
#define XmlIEDUMPER_CLASSID
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.
void outputGlobalFooter(std::ostream &os) const override
void outputEntitiesFooter(std::ostream &os) const override
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
void outputEntityString(std::ostream &out, unsigned int entityId, const std::string &entityType, const std::string &entityString, const std::vector< std::pair< uint64_t, uint64_t > > &positions, const Automaton::EntityFeatures &entityFeatures, bool noNorm=false) const override
void outputAttributesString(std::ostream &out, unsigned int entityId, std::map< std::tuple< std::size_t, std::string, std::string >, std::size_t > &mapAttributes) const override
void outputEventString(std::ostream &out, unsigned int eventId, unsigned int eventMentionId, const std::string &eventMentionType, const std::vector< unsigned int > &eventRoleId, const std::vector< std::string > &eventRoleType) const override
unsigned int outputRelationString(std::ostream &out, unsigned int relationId, const std::string &relationType, const std::string &sourceArgString, const std::string &targetArgString) const override
void outputEntityNorm(std::ostream &out, unsigned int entityId, const std::string &entityNorm) const override
void outputRelationsHeader(std::ostream &os) const override
void outputEventsFooter(std::ostream &os) const override
void outputEntitiesHeader(std::ostream &os) const override
void outputEventsHeader(std::ostream &os) const override
void outputRelationsFooter(std::ostream &os) const override
void outputGlobalHeader(std::ostream &os, const std::string &sourceFile="", const LimaStringText &=LimaStringText("")) const override
specific output functions to deal with actual output format these functions are called inside the pro...
a list of generic features: each feature is unique (only one feature for a name)
define the limaStringText resource which is the text in limaString formal
LimaString transcodeToXmlEntities(const LimaString &str)
SimpleFactory< MediaProcessUnit, XmlIEDumper > xmlieDumperFactory(XmlIEDUMPER_CLASSID)