public static void main(String[] args) { String[] number = {"A3sg", "A3pl"}; String[] possessives = {"P1sg", "P2sg", "P3sg"}; String[] cases = {"Dat", "Loc", "Abl"}; TurkishMorphology morphology = TurkishMorphology.builder().setLexicon("armut").disableCache().build(); DictionaryItem item = morphology.getLexicon().getMatchingItems("armut").get(0); for (String numberM : number) { for (String possessiveM : possessives) { for (String caseM : cases) { List<Result> results = morphology.getWordGenerator().generate(item, numberM, possessiveM, caseM); results.forEach(s->System.out.println(s.surface)); } } } }
@Override public void run() { Builder b = TurkishMorphology.builder().setLexicon(RootLexicon.getDefault()); if (disableUnknownAnalysis) { b.disableUnidentifiedTokenAnalyzer();
morphology = TurkishMorphology.builder() .setLexicon(RootLexicon.getDefault()) .build();
public static void main(String[] args) throws IOException { TurkishMorphology morphology = TurkishMorphology.builder() .ignoreDiacriticsInAnalysis() .setLexicon(RootLexicon.getDefault()) .build(); morphology.analyze("kisi").forEach(System.out::println); }
this.informalAsciiTolerantMorphology = TurkishMorphology.builder() .setLexicon(morphology.getLexicon()) .useInformalAnalysis()
public static void main(String[] args) { TurkishMorphology morphology = TurkishMorphology.builder() .setLexicon(RootLexicon.getDefault()) .useInformalAnalysis() .build(); List<SingleAnalysis> analyses = morphology .analyzeAndDisambiguate("okuycam diyo") .bestAnalysis(); for (SingleAnalysis a : analyses) { System.out.println(a.surfaceForm() + "-" + a); } System.out.println("Converting formal surface form:"); InformalAnalysisConverter converter = new InformalAnalysisConverter(morphology.getWordGenerator()); for (SingleAnalysis a : analyses) { System.out.println(converter.convert(a.surfaceForm(), a)); } } }
public static void main(String[] args) throws IOException { morphology = TurkishMorphology.builder() .setLexicon(RootLexicon.getDefault()) .build();
public static void main(String[] args) throws IOException { morphology = TurkishMorphology.builder() .setLexicon(RootLexicon.getDefault()) .build();
public static void main(String[] args) { String[] number = {"A3sg", "A3pl"}; String[] possessives = {"P1sg", "P2sg", "P3sg"}; String[] cases = {"Dat", "Loc", "Abl"}; TurkishMorphology morphology = TurkishMorphology.builder().addDictionaryLines("armut").disableCache().build(); DictionaryItem item = morphology.getLexicon().getMatchingItems("armut").get(0); for (String numberM : number) { for (String possessiveM : possessives) { for (String caseM : cases) { List<Result> results = morphology.getWordGenerator().generate(item, numberM, possessiveM, caseM); results.forEach(s->System.out.println(s.surface)); } } } }
public void initializeController() { post("/generate_word", (req, res) -> { String word = req.queryParams("word"); String morphemes = req.queryParams("morphemes"); morphemes = morphemes.replace('|', '+'); morphemes = morphemes.replace('→', '+'); TurkishMorphology morphology = TurkishMorphology.builder().addDictionaryLines(word).disableCache().build(); DictionaryItem item = morphology.getLexicon().getMatchingItems(word).get(0); List<GenerateWordResult> wordResults = new ArrayList<>(); List<Result> results = morphology.getWordGenerator().generate(item, morphemes.split("\\+")); for (Result generateResult : results) { GenerateWordResult wordResult = new GenerateWordResult(); wordResult.word = word; wordResult.no_surface = generateResult.analysis.formatMorphemesLexical(); wordResult.surface = generateResult.surface; wordResult.analysis = generateResult.analysis.formatLong(); wordResults.add(wordResult); } return jsonConverter.toJson(wordResults); }); } }