use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class WordAnalysisFormatterTest method formatToCase.
@Test
public void formatToCase() throws IOException {
TurkishMorphology morphology = TurkishMorphology.builder().addDictionaryLines("kış", "şiir", "Aydın", "Google [Pr:gugıl]").build();
String[] inputs = { "aydında", "googledan", "Google", "şiirde", "kışçığa", "kış" };
String[] expectedDefaultCase = { "Aydın'da", "Google'dan", "Google", "şiirde", "kışçığa", "kış" };
String[] expectedLowerCase = { "aydın'da", "google'dan", "google", "şiirde", "kışçığa", "kış" };
String[] expectedUpperCase = { "AYDIN'DA", "GOOGLE'DAN", "GOOGLE", "ŞİİRDE", "KIŞÇIĞA", "KIŞ" };
String[] expectedCapitalCase = { "Aydın'da", "Google'dan", "Google", "Şiirde", "Kışçığa", "Kış" };
String[] expectedUpperRootLowerEndingCase = { "AYDIN'da", "GOOGLE'dan", "GOOGLE", "ŞİİRde", "KIŞçığa", "KIŞ" };
testCaseType(morphology, inputs, expectedDefaultCase, WordAnalysisFormatter.CaseType.DEFAULT_CASE);
testCaseType(morphology, inputs, expectedLowerCase, WordAnalysisFormatter.CaseType.LOWER_CASE);
testCaseType(morphology, inputs, expectedUpperCase, WordAnalysisFormatter.CaseType.UPPER_CASE);
testCaseType(morphology, inputs, expectedCapitalCase, WordAnalysisFormatter.CaseType.TITLE_CASE);
testCaseType(morphology, inputs, expectedUpperRootLowerEndingCase, WordAnalysisFormatter.CaseType.UPPER_CASE_ROOT_LOWER_CASE_ENDING);
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class WordAnalysisFormatterTest method formatNumerals.
@Test
public void formatNumerals() throws IOException {
TurkishMorphology morphology = TurkishMorphology.builder().build();
String[] inputs = { "1e", "4ten", "123ü", "12,5ten" };
String[] expected = { "1'e", "4'ten", "123'ü", "12,5ten" };
WordAnalysisFormatter formatter = new WordAnalysisFormatter();
int i = 0;
for (String input : inputs) {
List<WordAnalysis> results = morphology.analyze(input);
for (WordAnalysis result : results) {
if (result.getDictionaryItem().primaryPos == PrimaryPos.Numeral) {
Assert.assertEquals(expected[i], formatter.format(result, "'"));
}
}
i++;
}
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class AddNewDictionaryItem method main.
public static void main(String[] args) throws IOException {
TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
AddNewDictionaryItem app = new AddNewDictionaryItem(morphology);
System.out.println("Proper Noun Test - 1 :");
app.test("Meydan'a", new DictionaryItem("Meydan", "meydan", "meydan", PrimaryPos.Noun, SecondaryPos.ProperNoun));
System.out.println();
System.out.println("Proper Noun Test - 2 :");
app.test("Meeeydan'a", new DictionaryItem("Meeeydan", "meeeydan", "meeeydan", PrimaryPos.Noun, SecondaryPos.ProperNoun));
System.out.println();
System.out.println("Verb Test : ");
app.test("tweetleyeyazdım", new DictionaryItem("tweetlemek", "tweetle", "tivitle", PrimaryPos.Verb, SecondaryPos.None));
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class FindPOS 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 FindPOS(sentenceAnalyzer).test("Keşke yarın hava güzel olsa.");
}
use of zemberek.morphology.analysis.tr.TurkishMorphology in project zemberek-nlp by ahmetaa.
the class StemmingAndLemmatization method main.
public static void main(String[] args) throws IOException {
TurkishMorphology morphology = TurkishMorphology.createWithDefaults();
new StemmingAndLemmatization(morphology).analyze("kitabımızsa");
}
Aggregations