19namespace LinguisticProcessing
22namespace LinguisticAnalysisStructure
52 const std::list<LinguisticCode>& microFilter)
55 for (
auto it = cbegin(); it != cend(); it++)
57 auto tmp = microAccessor.
readValue(it->properties);
70 for (
auto filterItr = microFilter.cbegin(); filterItr != microFilter.cend();
91 std::set<LinguisticCode> values;
98 std::set<LinguisticCode>& result)
const
100 for (
auto it = cbegin(); it != cend(); it++)
102 if (!propertyAccessor.
empty(it->properties))
104 result.insert(propertyAccessor.
readValue(it->properties));
110 std::ostream& xmlStream,
114 xmlStream <<
" <data>" << std::endl;
122 StringsPoolIndex form(0);
123 StringsPoolIndex lemma(0);
124 StringsPoolIndex norm(0);
125 std::string currentType;
126 bool firstEntry =
true;
127 for (
auto it = tmp.cbegin(); it != tmp.cend(); it++)
129 if (it->type != type)
134 xmlStream <<
" </form>" << std::endl;
135 xmlStream <<
" </" << currentType <<
">" << std::endl;
141 currentType =
"simple_word";
144 currentType =
"idiomatic_expression";
147 currentType =
"unknown_word";
150 currentType =
"abbrev_alternative";
153 currentType =
"hyphen_alternative";
156 currentType =
"concatenated_alternative";
159 currentType =
"spelling_alternative";
162 currentType =
"capitalfirst_word";
165 currentType =
"agglutinated_word";
168 currentType =
"desagglutinated_word";
171 currentType =
"specific_entity";
174 currentType =
"hyperwordstemmer_alternative";
177 currentType =
"chinese_segmenter";
180 currentType =
"UNKNOWN_MORPHOSYNTACTIC_TYPE";
183 xmlStream <<
" <" << currentType <<
">" << std::endl;
185 if ((it->inflectedForm != form) || (it->lemma != lemma)
186 || (it->normalizedForm != norm))
190 xmlStream <<
" </form>" << std::endl;
192 form = it->inflectedForm;
194 norm = it->normalizedForm;
195 xmlStream <<
" <form infl=\""
198 xmlStream <<
"lemma=\""
201 xmlStream <<
"norm=\""
203 <<
"\">" << std::endl;
206 xmlStream <<
" <property>" << std::endl;
207 for (
auto propItr = managers.cbegin(); propItr != managers.cend();
210 if (!propItr->second.getPropertyAccessor().empty(it->properties))
212 xmlStream <<
" <p prop=\"" << propItr->first
214 << propItr->second.getPropertySymbolicValue(it->properties)
215 <<
"\"/>" << std::endl;
218 xmlStream <<
" </property>" << std::endl;
221 xmlStream <<
" </form>" << std::endl;
222 xmlStream <<
" </" << currentType <<
">" << std::endl;
224 xmlStream <<
" </data>" << std::endl;
229 std::set<StringsPoolIndex> forms;
230 for (
auto it = cbegin(); it != cend(); it++)
232 forms.insert(it->inflectedForm);
239 std::set<StringsPoolIndex> lemma;
240 for (
auto it = cbegin(); it != cend(); it++)
242 lemma.insert(it->lemma);
249 std::set<StringsPoolIndex> norms;
250 for (
auto it = cbegin(); it != cend(); it++)
252 norms.insert(it->normalizedForm);
260 for (
auto it = cbegin(); it != cend(); it++)
262 if (!propertyAccessor.
empty(it->properties))
264 return propertyAccessor.
readValue(it->properties);
Provide function to read write and check a property.
LinguisticCode readValue(const LinguisticCode &code) const
read a property in a coded int.
bool empty(const LinguisticCode &l) const
Test if the given code has property data.
Provide tools to parse a property file, and deal with the property coding system.
const std::map< std::string, PropertyManager > & getPropertyManagers() const
Get the map of all PropertyManagers.
Holds morphosyntactic informations.
std::set< StringsPoolIndex > allInflectedForms() const
uint64_t countValues(const Common::PropertyCode::PropertyAccessor &propertyAccessor)
void outputXml(std::ostream &xmlStream, const Common::PropertyCode::PropertyCodeManager &pcm, const FsaStringsPool &sp) const
std::set< StringsPoolIndex > allNormalizedForms() const
LinguisticCode firstValue(const Common::PropertyCode::PropertyAccessor &propertyAccessor) const
Return the first non empty value for the given accessor.
std::set< StringsPoolIndex > allLemma() const
bool hasUniqueMicro(const Lima::Common::PropertyCode::PropertyAccessor µAccessor, const std::list< Lima::LinguisticCode > µFilter)
return true if there is only one micro, and this micro is in microfilter
virtual ~MorphoSyntacticData()
std::set< LinguisticCode > allValues(const Common::PropertyCode::PropertyAccessor &propertyAccessor) const
LimaString transcodeToXmlEntities(const LimaString &str)
@ CONCATENATED_ALTERNATIVE
PUGI__FN void sort(I begin, I end, const Pred &pred)
StringsPoolIndex inflectedForm
bool operator==(const LinguisticElement &le) const
StringsPoolIndex normalizedForm
LinguisticCode properties
bool operator<(const LinguisticElement &le) const