@Test public void getStemsTest() { RuleBasedAnalyzer analyzer = getAnalyzer("kitap"); SingleAnalysis analysis = analyzer.analyze("kitap").get(0); Assert.assertEquals(toList("kitap"), analysis.getStems()); analysis = analyzer.analyze("kitaplı").get(0); Assert.assertEquals(toList("kitap", "kitaplı"), analysis.getStems()); analysis = analyzer.analyze("kitaplarda").get(0); Assert.assertEquals(toList("kitap"), analysis.getStems()); analysis = analyzer.analyze("kitabımmış").get(0); Assert.assertEquals(toList("kitab", "kitabım"), analysis.getStems()); analysis = analyzer.analyze("kitapçığa").get(0); Assert.assertEquals(toList("kitap", "kitapçığ"), analysis.getStems()); analyzer = getAnalyzer("okumak"); analysis = analyzer.analyze("okut").get(0); Assert.assertEquals(toList("oku", "okut"), analysis.getStems()); analysis = analyzer.analyze("okuttur").get(0); Assert.assertEquals(toList("oku", "okut", "okuttur"), analysis.getStems()); analysis = analyzer.analyze("okutturuluyor").get(0); Assert.assertEquals(toList("oku", "okut", "okuttur", "okutturul"), analysis.getStems()); analysis = analyzer.analyze("okutturamıyor").get(0); Assert.assertEquals(toList("oku", "okut", "okuttur"), analysis.getStems()); analysis = analyzer.analyze("okutturabiliyor").get(0); Assert.assertEquals(toList("oku", "okut", "okuttur", "okutturabil"), analysis.getStems()); }
public List<String> getStems() { List<String> stems = Lists.newArrayListWithCapacity(2); stems.add(getStem()); String previousStem = getGroup(0).surfaceForm(); if (groupBoundaries.length > 1) { for (int i = 1; i < groupBoundaries.length; i++) { MorphemeGroup ig = getGroup(i); MorphemeData suffixData = ig.morphemes.get(0); String surface = suffixData.surface; String stem = previousStem + surface; if (!stems.contains(stem)) { stems.add(stem); } previousStem = previousStem + ig.surfaceForm(); } } return stems; }
SingleAnalysis { public List<String> getStems() { List<String> stems = Lists.newArrayListWithCapacity(2); stems.add(getStem()); String previousStem = getGroup(0).surfaceForm(); if (groupBoundaries.length > 1) { for (int i = 1; i < groupBoundaries.length; i++) { MorphemeGroup ig = getGroup(i); MorphemeData suffixData = ig.morphemes.get(0); String surface = suffixData.surface; String stem = previousStem + surface; if (!stems.contains(stem)) { stems.add(stem); } previousStem = previousStem + ig.surfaceForm(); } } return stems; } }
SingleAnalysis { public List<String> getStems() { List<String> stems = Lists.newArrayListWithCapacity(2); stems.add(getStem()); String previousStem = getGroup(0).surfaceForm(); if (groupBoundaries.length > 1) { for (int i = 1; i < groupBoundaries.length; i++) { MorphemeGroup ig = getGroup(i); MorphemeData suffixData = ig.morphemes.get(0); String surface = suffixData.surface; String stem = previousStem + surface; if (!stems.contains(stem)) { stems.add(stem); } previousStem = previousStem + ig.surfaceForm(); } } return stems; } SingleAnalysis(
      DictionaryItem item,
      List<MorphemeData> morphemeDataList,
      int[] groupBoundaries); }
SingleAnalysis { public List<String> getStems() { List<String> stems = Lists.newArrayListWithCapacity(2); stems.add(getStem()); String previousStem = getGroup(0).surfaceForm(); if (groupBoundaries.length > 1) { for (int i = 1; i < groupBoundaries.length; i++) { MorphemeGroup ig = getGroup(i); MorphemeData suffixData = ig.morphemes.get(0); String surface = suffixData.surface; String stem = previousStem + surface; if (!stems.contains(stem)) { stems.add(stem); } previousStem = previousStem + ig.surfaceForm(); } } return stems; } SingleAnalysis(
      DictionaryItem item,
      List<MorphemeData> morphemeDataList,
      int[] groupBoundaries); static SingleAnalysis unknown(String input); static SingleAnalysis dummy(String input, DictionaryItem item); String surfaceForm(); boolean containsInformalMorpheme(); String getEnding(); String getStem(); boolean containsMorpheme(Morpheme morpheme); StemAndEnding getStemAndEnding(); DictionaryItem getDictionaryItem(); boolean isUnknown(); boolean isRuntime(); List<MorphemeData> getMorphemeDataList(); List<Morpheme> getMorphemes(); MorphemeGroup getGroup(int groupIndex); MorphemeGroup getLastGroup(); MorphemeGroup[] getGroups(); static SingleAnalysis fromSearchPath(SearchPath searchPath); boolean containsAnyMorpheme(Morpheme... morphemes); List<String> getStems(); List<String> getLemmas(); @Override String toString(); String formatLexical(); String formatMorphemesLexical(); PrimaryPos getPos(); String formatLong(); int groupCount(); @Override boolean equals(Object o); @Override int hashCode(); }
SingleAnalysis { public List<String> getStems() { List<String> stems = Lists.newArrayListWithCapacity(2); stems.add(getStem()); String previousStem = getGroup(0).surfaceForm(); if (groupBoundaries.length > 1) { for (int i = 1; i < groupBoundaries.length; i++) { MorphemeGroup ig = getGroup(i); MorphemeData suffixData = ig.morphemes.get(0); String surface = suffixData.surface; String stem = previousStem + surface; if (!stems.contains(stem)) { stems.add(stem); } previousStem = previousStem + ig.surfaceForm(); } } return stems; } SingleAnalysis(
      DictionaryItem item,
      List<MorphemeData> morphemeDataList,
      int[] groupBoundaries); static SingleAnalysis unknown(String input); static SingleAnalysis dummy(String input, DictionaryItem item); String surfaceForm(); boolean containsInformalMorpheme(); String getEnding(); String getStem(); boolean containsMorpheme(Morpheme morpheme); StemAndEnding getStemAndEnding(); DictionaryItem getDictionaryItem(); boolean isUnknown(); boolean isRuntime(); List<MorphemeData> getMorphemeDataList(); List<Morpheme> getMorphemes(); MorphemeGroup getGroup(int groupIndex); MorphemeGroup getLastGroup(); MorphemeGroup[] getGroups(); static SingleAnalysis fromSearchPath(SearchPath searchPath); boolean containsAnyMorpheme(Morpheme... morphemes); List<String> getStems(); List<String> getLemmas(); @Override String toString(); String formatLexical(); String formatMorphemesLexical(); PrimaryPos getPos(); String formatLong(); int groupCount(); @Override boolean equals(Object o); @Override int hashCode();  }