Search in sources :

Example 86 with WordAnalysis

use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.

the class TurkishMorphologyFunctionalTests method testTime2.

@Test
public void testTime2() {
    TurkishMorphology morphology = getMorphology("dört [P:Num,Card;A:Voicing]");
    WordAnalysis result = morphology.analyze("10:24'te");
    Assert.assertEquals(1, result.analysisCount());
    SingleAnalysis analysis = result.getAnalysisResults().get(0);
    Assert.assertEquals(SecondaryPos.Clock, analysis.getDictionaryItem().secondaryPos);
    String lexical = analysis.formatLexical();
    Assert.assertTrue(lexical.endsWith("A3sg+Loc"));
}
Also used : SingleAnalysis(zemberek.morphology.analysis.SingleAnalysis) WordAnalysis(zemberek.morphology.analysis.WordAnalysis) Test(org.junit.Test)

Example 87 with WordAnalysis

use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.

the class TurkishMorphologyFunctionalTests method testEmail.

@Test
public void testEmail() {
    TurkishMorphology morphology = getMorphology();
    WordAnalysis result = morphology.analyze("foo@bar.com'a");
    Assert.assertEquals(1, result.analysisCount());
    SingleAnalysis analysis = result.getAnalysisResults().get(0);
    Assert.assertEquals(SecondaryPos.Email, analysis.getDictionaryItem().secondaryPos);
    String lexical = analysis.formatLexical();
    Assert.assertTrue(lexical.endsWith("A3sg+Dat"));
    Assert.assertEquals("foo@bar.com", analysis.getDictionaryItem().lemma);
}
Also used : SingleAnalysis(zemberek.morphology.analysis.SingleAnalysis) WordAnalysis(zemberek.morphology.analysis.WordAnalysis) Test(org.junit.Test)

Example 88 with WordAnalysis

use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.

the class TurkishMorphologyFunctionalTests method testAbbreviationShouldNotGetBecomeOrAcquire_Issue218.

@Test
public void testAbbreviationShouldNotGetBecomeOrAcquire_Issue218() {
    TurkishMorphology morphology = getMorphology("aa [P:Abbrv]");
    WordAnalysis result = morphology.analyze("aalaş");
    Assert.assertEquals(0, result.analysisCount());
    result = morphology.analyze("aalan");
    Assert.assertEquals(0, result.analysisCount());
}
Also used : WordAnalysis(zemberek.morphology.analysis.WordAnalysis) Test(org.junit.Test)

Example 89 with WordAnalysis

use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.

the class TurkishMorphologyFunctionalTests method testWordsWithDot.

@Test
public void testWordsWithDot() {
    TurkishMorphology morphology = getMorphology("Dr [P:Abbrv]");
    WordAnalysis result = morphology.analyze("Dr.");
    Assert.assertEquals(1, result.analysisCount());
}
Also used : WordAnalysis(zemberek.morphology.analysis.WordAnalysis) Test(org.junit.Test)

Example 90 with WordAnalysis

use of zemberek.morphology.analysis.WordAnalysis in project zemberek-nlp by ahmetaa.

the class TurkishMorphologyFunctionalTests method testUrl.

@Test
public void testUrl() {
    TurkishMorphology morphology = getMorphology();
    WordAnalysis result = morphology.analyze("www.foo.com");
    Assert.assertEquals(1, result.analysisCount());
    Assert.assertEquals(SecondaryPos.Url, result.getAnalysisResults().get(0).getDictionaryItem().secondaryPos);
    String lexical = result.getAnalysisResults().get(0).formatLexical();
    Assert.assertTrue(lexical.endsWith("A3sg"));
}
Also used : WordAnalysis(zemberek.morphology.analysis.WordAnalysis) Test(org.junit.Test)

Aggregations

WordAnalysis (zemberek.morphology.analysis.WordAnalysis)96 Test (org.junit.Test)42 SingleAnalysis (zemberek.morphology.analysis.SingleAnalysis)36 TurkishMorphology (zemberek.morphology.TurkishMorphology)22 ArrayList (java.util.ArrayList)21 SentenceAnalysis (zemberek.morphology.analysis.SentenceAnalysis)19 LinkedHashSet (java.util.LinkedHashSet)13 Ignore (org.junit.Ignore)13 Histogram (zemberek.core.collections.Histogram)12 Path (java.nio.file.Path)11 PrintWriter (java.io.PrintWriter)10 SentenceWordAnalysis (zemberek.morphology.analysis.SentenceWordAnalysis)10 IOException (java.io.IOException)6 HashSet (java.util.HashSet)6 List (java.util.List)6 WordAnalyzer (zemberek.morphology.analysis.WordAnalyzer)6 SimpleGenerator (zemberek.morphology.generator.SimpleGenerator)6 DictionaryItem (zemberek.morphology.lexicon.DictionaryItem)6 DynamicLexiconGraph (zemberek.morphology.lexicon.graph.DynamicLexiconGraph)6 Log (zemberek.core.logging.Log)5