22#include "common/misc/traceUtils.h"
34using namespace Lima::Common::LinguisticData;
40namespace LinguisticProcessing
42namespace MorphologicAnalysis
67 LERROR <<
"no param 'dictionary' in OrthographicAlternatives group for language " << (int) m_language;
79 LERROR <<
"no param 'charChart' in OrthographicAlternatives group for language " << (int) m_language;
86 m_confidentMode=(confident==
"true");
90 LWARN <<
"no param 'confidentMode' in OrthographicAlternatives group for language " << (int) m_language;
91 LWARN <<
"use default value : 'true'";
104 LINFO <<
"MorphologicalAnalysis: starting process OrthographicAlternatives";
106 StringsPool& sp=Common::LinguisticData::LinguisticData::changeable().stringsPool(m_language);
107 auto tokenList=std::dynamic_pointer_cast<AnalysisGraph>(analysis.
getData(
"AnalysisGraph"));
112 boost::tie(it,itEnd)=vertices(*g);
113 for (;it!=itEnd;it++)
115 LDEBUG <<
"processing vertex " << *it;
117 Token* tok=tokenMap[*it];
118 if (currentTokenData!=0)
122 if ( m_confidentMode && (currentTokenData->size()>0) )
continue;
127 LDEBUG <<
"processing alternatives from dico";
130 if (entry->hasAccented()) {
132 while ( oa.size() > 0 )
135 oa = entry->nextAccented();
141 if (m_confidentMode && (currentTokenData->size() > 0) )
continue;
144 LDEBUG <<
"set unmark alternatives";
153 LINFO <<
"MorphologicalAnalysis: ending process OrthographicAlternatives";
169 if (!(lowerWord ==
"") && !(lowerWord == tokenStr) )
171 LDEBUG <<
"createAlternative for lowerWord " << lowerWord;
174 if (tokenData->size()>0)
181 if (!(unmarked==
"") && !(unmarked==tokenStr))
183 LDEBUG <<
"createAlternative for unmarked " << unmarked;
198 LDEBUG <<
"OrthographicAlternatives::createAlternative" << str;
203 StringsPoolIndex infl=sp[str];
205 altToken->setDictionaryEntry(dicoEntry);
206 srcToken->addOrthographicAlternative(altToken);
208 tokenData->appendLingInfo(infl,dicoEntry,ORTHOGRAPHIC_ALTERNATIVE,sp);
212 if (dicoEntry->hasAccented())
216 while (alternativeStr.size() != 0)
220 StringsPoolIndex infl2=sp[alternativeStr];
221 tokenData->appendLingInfo(infl2,altDicoEntry,ORTHOGRAPHIC_ALTERNATIVE,sp);
225 altToken2->setDictionaryEntry(altDicoEntry);
226 srcToken->addOrthographicAlternative(altToken2);
228 alternativeStr = dicoEntry->nextAccented();
boost::property_map< LinguisticGraph, vertex_data_t >::type VertexDataPropertyMap
LinguisticGraph::vertex_iterator LinguisticGraphVertexIt
boost::property_map< LinguisticGraph, vertex_token_t >::type VertexTokenPropertyMap
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
#define ORTHOGRAPHALTERNATIVES_CLASSID
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
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
Use this exception to signal an error in one of the configuration files.
interface for analysis dictionary
virtual DictionaryEntry getEntry(const Lima::LimaString &word) const =0
get dictionary entry for a word
Lima::LimaChar unmark(const Lima::LimaChar &c) const
Gets the unmark character corresponding to the specified character.
Lima::LimaString toLower(const Lima::LimaString &src) const
Converts src to its lowercase equivalent.
Holds morphosyntactic informations.
holds surface data of a token
uint64_t position() const
const TStatus & status() const
const LimaString & stringForm() const
LimaStatusCode process(AnalysisContent &analysis) const
Process on data in analysisContent.
OrthographicAlternatives()
virtual ~OrthographicAlternatives()
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager)
initialize with parameters from configuration file.
static void setOrthographicAlternatives(LinguisticAnalysisStructure::Token *token, LinguisticAnalysisStructure::MorphoSyntacticData *tokenData, AnalysisDict::AbstractAnalysisDictionary *dictionary, FlatTokenizer::CharChart *charChart, FsaStringsPool &sp)
static void createAlternative(LinguisticAnalysisStructure::Token *srcToken, LinguisticAnalysisStructure::MorphoSyntacticData *tokenData, LimaString &str, AnalysisDict::AbstractAnalysisDictionary *dictionary, FsaStringsPool &sp)
static const LinguisticResources & single()
const singleton accessor
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
SimpleFactory< LinguisticProcessUnit, OrthographicAlternatives > orthographicAlternativeFactory(ORTHOGRAPHALTERNATIVES_CLASSID)
launch exception related to the configuration file parsing