safe lemmatizer
This commit is contained in:
parent
3f3a136fa2
commit
8cf2911c72
@ -57,6 +57,8 @@ namespace LemmaGenSockets
|
|||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
string[] parts = word.Split(wordInnerSeparator);
|
string[] parts = word.Split(wordInnerSeparator);
|
||||||
|
|
||||||
|
string result = "";
|
||||||
if (parts.Length == 2)
|
if (parts.Length == 2)
|
||||||
{
|
{
|
||||||
string firstPart = parts[0];
|
string firstPart = parts[0];
|
||||||
@ -65,11 +67,20 @@ namespace LemmaGenSockets
|
|||||||
firstPart = lemmatizersDict[languageCode].Lemmatize(firstPart);
|
firstPart = lemmatizersDict[languageCode].Lemmatize(firstPart);
|
||||||
}
|
}
|
||||||
string secondPart = lemmatizersDict[languageCode].Lemmatize(parts[1]);
|
string secondPart = lemmatizersDict[languageCode].Lemmatize(parts[1]);
|
||||||
return firstPart + "-" + secondPart;
|
result = firstPart + "-" + secondPart;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return lemmatizersDict[languageCode].Lemmatize(word);
|
result = lemmatizersDict[languageCode].Lemmatize(word);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == "" || result.Contains(" "))
|
||||||
|
{
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user