Search in sources :

Example 1 with TurkishMorphology

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

the class AnalyzeWords method main.

public static void main(String[] args) throws IOException {
    TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
    new AnalyzeWords(morphology).analyze("kalemi");
}
Also used : TurkishMorphology(zemberek.morphology.analysis.tr.TurkishMorphology)

Example 2 with TurkishMorphology

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

the class ChangeStem method main.

public static void main(String[] args) throws IOException {
    TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
    DictionaryItem newStem = morphology.getLexicon().getMatchingItems("poğaça").get(0);
    new ChangeStem(morphology).regenerate("simidime", newStem);
}
Also used : DictionaryItem(zemberek.morphology.lexicon.DictionaryItem) TurkishMorphology(zemberek.morphology.analysis.tr.TurkishMorphology)

Example 3 with TurkishMorphology

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

the class DisambiguateSentences method main.

public static void main(String[] args) throws IOException {
    TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
    Z3MarkovModelDisambiguator disambiguator = new Z3MarkovModelDisambiguator();
    TurkishSentenceAnalyzer sentenceAnalyzer = new TurkishSentenceAnalyzer(morphology, disambiguator);
    new DisambiguateSentences(sentenceAnalyzer).analyzeAndDisambiguate("86 lira harcardım.");
}
Also used : Z3MarkovModelDisambiguator(zemberek.morphology.ambiguity.Z3MarkovModelDisambiguator) TurkishSentenceAnalyzer(zemberek.morphology.analysis.tr.TurkishSentenceAnalyzer) TurkishMorphology(zemberek.morphology.analysis.tr.TurkishMorphology)

Example 4 with TurkishMorphology

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

the class SpellingExamples method main.

public static void main(String[] args) throws IOException {
    TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
    TurkishSpellChecker spellChecker = new TurkishSpellChecker(morphology);
    System.out.println("Check if written correctly.");
    String[] words = { "Ankara'ya", "Ankar'aya", "yapbileceksen", "yapabileceğinizden" };
    for (String word : words) {
        System.out.println(word + " -> " + spellChecker.check(word));
    }
    System.out.println();
    System.out.println("Give suggestions.");
    String[] toSuggest = { "Kraamanda", "okumuştk", "yapbileceksen", "oukyamıyorum" };
    for (String s : toSuggest) {
        System.out.println(s + " -> " + spellChecker.suggestForWord(s));
    }
}
Also used : TurkishSpellChecker(zemberek.normalization.TurkishSpellChecker) TurkishMorphology(zemberek.morphology.analysis.tr.TurkishMorphology)

Example 5 with TurkishMorphology

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

the class TurkishSpellCheckerTest method apostropheTest.

@Test
public void apostropheTest() throws IOException {
    TurkishMorphology morphology = TurkishMorphology.builder().addDictionaryLines("zaman [P:Noun, Time]").build();
    TurkishSpellChecker spellChecker = new TurkishSpellChecker(morphology);
    String[] inputs = { "zamanda" };
    for (String input : inputs) {
        Assert.assertTrue("Fail at " + input, spellChecker.check(input));
    }
}
Also used : TurkishMorphology(zemberek.morphology.analysis.tr.TurkishMorphology) Test(org.junit.Test)

Aggregations

TurkishMorphology (zemberek.morphology.analysis.tr.TurkishMorphology)26 Test (org.junit.Test)13 Ignore (org.junit.Ignore)5 Z3MarkovModelDisambiguator (zemberek.morphology.ambiguity.Z3MarkovModelDisambiguator)5 WordAnalysis (zemberek.morphology.analysis.WordAnalysis)5 TurkishSentenceAnalyzer (zemberek.morphology.analysis.tr.TurkishSentenceAnalyzer)5 Path (java.nio.file.Path)2 UnidentifiedTokenAnalyzer (zemberek.morphology.analysis.tr.UnidentifiedTokenAnalyzer)2 DictionaryItem (zemberek.morphology.lexicon.DictionaryItem)2 Stopwatch (com.google.common.base.Stopwatch)1 BufferedOutputStream (java.io.BufferedOutputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Before (org.junit.Before)1 SentenceAnalysis (zemberek.morphology.analysis.SentenceAnalysis)1 LexiconProto (zemberek.morphology.lexicon.proto.LexiconProto)1 Dictionary (zemberek.morphology.lexicon.proto.LexiconProto.Dictionary)1 TurkishSpellChecker (zemberek.normalization.TurkishSpellChecker)1