36namespace LinguisticProcessing
38namespace FlatTokenizer
44 m_startState(0), m_states()
50 for (std::vector< State* >::iterator it = m_states.begin();
51 it != m_states.end(); it++)
63 LDEBUG <<
"Creating a Tokenizer Automaton (loads file)";
71 LERROR <<
"no parameter 'automatonFile' in tokenizer group for language " << (int) language <<
" !";
80 const State* currentState = state;
81 if (currentState == 0)
83 if (m_startState == 0)
86 LERROR <<
"No start state";
89 currentState = m_startState;
93 LDEBUG <<
"Running Automaton ; currentState is '"
96 const State* result = currentState->
run(text);
100 LWARN <<
"Current state failed: backtracking to start state";
101 result = m_startState;
110 LDEBUG <<
"Loading tokenizer automaton from " << fileName;
117 std::vector<State*>::iterator it, it_end;
118 it = m_states.begin(); it_end = m_states.end();
119 for (; it != it_end; it++)
121 if ( (*it)->name() == name )
131 std::vector<State*>::const_iterator it, it_end;
132 it = m_states.begin(); it_end = m_states.end();
133 for (; it != it_end; it++)
135 if ( (*it)->name() == name )
#define FLATAUTOMATON_CLASSID
Defines a Factory to create Object of type Base.
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.
const State * stateNamed(const LimaString &name) const
void loadFromFile(const std::string &fileName)
const State * run(Text &text, const State *state=0) const
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &, Manager *) override
const State * run(Text &text) const
const LimaString & name() const
static const MediaticData & single()
const singleton accessor
std::string limastring2utf8stdstring(const Lima::LimaString &phrase, uint32_t size0)
Convert a wide string to a string , in dest up to size bytes.
QString findFileInPaths(const QString &paths, const QString &fileName, const QChar &separator)
Find the given file in the given paths.
SimpleFactory< AbstractResource, Automaton > flatAutomatonFactory(FLATAUTOMATON_CLASSID)