use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.
the class ParseConsole method run.
public void run(TurkishMorphology parser) throws IOException {
String input;
System.out.println("Enter word:");
Scanner sc = new Scanner(System.in);
input = sc.nextLine();
while (!input.equals("exit") && !input.equals("quit")) {
List<WordAnalysis> tokens = parser.analyze(input);
if (tokens.size() == 0 || (tokens.size() == 1 && tokens.get(0).dictionaryItem.primaryPos == PrimaryPos.Unknown)) {
System.out.println("cannot be parsed");
parser.getWordAnalyzer().dump(input);
} else {
tokens.forEach(this::printMorphParse);
}
input = sc.nextLine();
}
}
use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.
the class TurkishMorphologyFunctionalTests method testWordsWithCircumflex.
@Test
public void testWordsWithCircumflex() {
TurkishMorphology morphology = getMorphology("zekâ");
WordAnalysis result = morphology.analyze("zekâ");
Assert.assertEquals(1, result.analysisCount());
}
use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.
the class TurkishMorphologyFunctionalTests method testRomanNumeral3.
@Test
public void testRomanNumeral3() {
TurkishMorphology morphology = getMorphology("dört [P:Num,Card;A:Voicing]");
WordAnalysis result = morphology.analyze("XXIV'ten");
Assert.assertEquals(1, result.analysisCount());
Assert.assertEquals(SecondaryPos.RomanNumeral, result.getAnalysisResults().get(0).getDictionaryItem().secondaryPos);
}
use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.
the class TurkishMorphologyFunctionalTests method testPercent.
@Test
public void testPercent() {
TurkishMorphology morphology = getMorphology("iki [P:Num,Card]");
String[] correct = { "%2", "%2'si", "%2.2'si", "%2,2'si" };
for (String s : correct) {
WordAnalysis result = morphology.analyze(s);
Assert.assertEquals("Failed for " + s, 1, result.analysisCount());
Assert.assertEquals("Failed for " + s, SecondaryPos.Percentage, result.getAnalysisResults().get(0).getDictionaryItem().secondaryPos);
}
}
use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.
the class TurkishMorphologyFunctionalTests method testWordsWithDash.
@Test
public void testWordsWithDash() {
// Instance with no dictionary item.
TurkishMorphology morphology = getEmptyTurkishMorphology();
WordAnalysis result = morphology.analyze("Blah-Foo'ya");
Assert.assertEquals(1, result.analysisCount());
}
Aggregations