Skip to content
Snippets Groups Projects
Commit 9c9135a9 authored by Franck Dary's avatar Franck Dary
Browse files

Added oracle for lemmatizer

parent f66d8384
No related branches found
No related tags found
No related merge requests found
...@@ -382,6 +382,43 @@ void Oracle::createDatabase() ...@@ -382,6 +382,43 @@ void Oracle::createDatabase()
return 0; return 0;
}))); })));
str2oracle.emplace("strategy_lemmatizer", std::unique_ptr<Oracle>(new Oracle(
[](Oracle *)
{
},
[](Config & c, Oracle *)
{
if (c.pastActions.size() == 0)
return std::string("MOVE lemmatizer_lookup 0");
std::string previousState = util::noAccentLower(c.pastActions.getElem(0).first);
std::string previousAction = util::noAccentLower(c.pastActions.getElem(0).second.name);
std::string newState;
int movement = 0;
if (previousState == "lemmatizer_rules")
{
newState = "lemmatizer_lookup";
movement = 1;
}
else if (previousAction == "notfound")
{
newState = "lemmatizer_rules";
movement = 0;
}
else
{
newState = "lemmatizer_lookup";
movement = 1;
}
return "MOVE " + newState + " " + std::to_string(movement);
},
[](Config &, Oracle *, const std::string &)
{
return 0;
})));
str2oracle.emplace("strategy_tokenizer", std::unique_ptr<Oracle>(new Oracle( str2oracle.emplace("strategy_tokenizer", std::unique_ptr<Oracle>(new Oracle(
[](Oracle *) [](Oracle *)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment