@Test public void shouldFormat() { { final MorphemeContainer result = getFirstParseResult("kitaba"); assertThat(MorphemeContainerFormatter.formatMorphemeContainer(result), equalTo("kitap+Noun+A3sg+Pnon+Dat")); } { final MorphemeContainer result = getFirstParseResult("yaptırtmayı"); assertThat(MorphemeContainerFormatter.formatMorphemeContainer(result), equalTo("yap+Verb+Verb+Caus+Verb+Caus+Pos+Noun+Inf+A3sg+Pnon+Acc")); } }
public static String formatMorphemeContainer(final MorphemeContainer morphemeContainer) { final Root root = morphemeContainer.getRoot(); final Lexeme lexeme = root.getLexeme(); final StringBuilder b = new StringBuilder(); b.append(String.format("%s+%s", lexeme.getLemmaRoot(), morphemeContainer.getRootState().getPrimaryPos().getStringForm())); if (lexeme.getSecondaryPos() != null) b.append("+").append(lexeme.getSecondaryPos()); if (morphemeContainer.hasTransitions()) { for (SuffixTransition suffixTransition : morphemeContainer.getSuffixTransitions()) { final Suffix suffix = suffixTransition.getSuffixFormApplication().getSuffixForm().getSuffix(); if (suffix instanceof FreeTransitionSuffix || suffix instanceof ConditionalFreeTransitionSuffix) continue; b.append("+").append(formatTransition(suffixTransition, false)); } } return b.toString(); }
MorphemeContainerFormatter { public static String formatMorphemeContainer(final MorphemeContainer morphemeContainer) { final Root root = morphemeContainer.getRoot(); final Lexeme lexeme = root.getLexeme(); final StringBuilder b = new StringBuilder(); b.append(String.format("%s+%s", lexeme.getLemmaRoot(), morphemeContainer.getRootState().getPrimaryPos().getStringForm())); if (lexeme.getSecondaryPos() != null) b.append("+").append(lexeme.getSecondaryPos()); if (morphemeContainer.hasTransitions()) { for (SuffixTransition suffixTransition : morphemeContainer.getSuffixTransitions()) { final Suffix suffix = suffixTransition.getSuffixFormApplication().getSuffixForm().getSuffix(); if (suffix instanceof FreeTransitionSuffix || suffix instanceof ConditionalFreeTransitionSuffix) continue; b.append("+").append(formatTransition(suffixTransition, false)); } } return b.toString(); } }
MorphemeContainerFormatter { public static String formatMorphemeContainer(final MorphemeContainer morphemeContainer) { final Root root = morphemeContainer.getRoot(); final Lexeme lexeme = root.getLexeme(); final StringBuilder b = new StringBuilder(); b.append(String.format("%s+%s", lexeme.getLemmaRoot(), morphemeContainer.getRootState().getPrimaryPos().getStringForm())); if (lexeme.getSecondaryPos() != null) b.append("+").append(lexeme.getSecondaryPos()); if (morphemeContainer.hasTransitions()) { for (SuffixTransition suffixTransition : morphemeContainer.getSuffixTransitions()) { final Suffix suffix = suffixTransition.getSuffixFormApplication().getSuffixForm().getSuffix(); if (suffix instanceof FreeTransitionSuffix || suffix instanceof ConditionalFreeTransitionSuffix) continue; b.append("+").append(formatTransition(suffixTransition, false)); } } return b.toString(); }  }
MorphemeContainerFormatter { public static String formatMorphemeContainer(final MorphemeContainer morphemeContainer) { final Root root = morphemeContainer.getRoot(); final Lexeme lexeme = root.getLexeme(); final StringBuilder b = new StringBuilder(); b.append(String.format("%s+%s", lexeme.getLemmaRoot(), morphemeContainer.getRootState().getPrimaryPos().getStringForm())); if (lexeme.getSecondaryPos() != null) b.append("+").append(lexeme.getSecondaryPos()); if (morphemeContainer.hasTransitions()) { for (SuffixTransition suffixTransition : morphemeContainer.getSuffixTransitions()) { final Suffix suffix = suffixTransition.getSuffixFormApplication().getSuffixForm().getSuffix(); if (suffix instanceof FreeTransitionSuffix || suffix instanceof ConditionalFreeTransitionSuffix) continue; b.append("+").append(formatTransition(suffixTransition, false)); } } return b.toString(); }  static String formatMorphemeContainer(final MorphemeContainer morphemeContainer); @SuppressWarnings("UnusedDeclaration") static Collection<String> formatMorphemeContainers(final Collection<MorphemeContainer> morphemeContainers); static List<String> formatMorphemeContainers(final List<MorphemeContainer> morphemeContainers); static String formatMorphemeContainerWithForms(final MorphemeContainer morphemeContainer); static String formatMorphemeContainerWithDerivationGrouping(MorphemeContainer morphemeContainer); static String formatMorphemeContainerWithDerivationGrouping(MorphemeContainer morphemeContainer, boolean addIndices); static String formatMorphemeContainerDetailed(MorphemeContainer morphemeContainer); static Collection<String> formatMorphemeContainersWithDerivationGrouping(Collection<MorphemeContainer> morphemeContainers); }
MorphemeContainerFormatter { public static String formatMorphemeContainer(final MorphemeContainer morphemeContainer) { final Root root = morphemeContainer.getRoot(); final Lexeme lexeme = root.getLexeme(); final StringBuilder b = new StringBuilder(); b.append(String.format("%s+%s", lexeme.getLemmaRoot(), morphemeContainer.getRootState().getPrimaryPos().getStringForm())); if (lexeme.getSecondaryPos() != null) b.append("+").append(lexeme.getSecondaryPos()); if (morphemeContainer.hasTransitions()) { for (SuffixTransition suffixTransition : morphemeContainer.getSuffixTransitions()) { final Suffix suffix = suffixTransition.getSuffixFormApplication().getSuffixForm().getSuffix(); if (suffix instanceof FreeTransitionSuffix || suffix instanceof ConditionalFreeTransitionSuffix) continue; b.append("+").append(formatTransition(suffixTransition, false)); } } return b.toString(); }  static String formatMorphemeContainer(final MorphemeContainer morphemeContainer); @SuppressWarnings("UnusedDeclaration") static Collection<String> formatMorphemeContainers(final Collection<MorphemeContainer> morphemeContainers); static List<String> formatMorphemeContainers(final List<MorphemeContainer> morphemeContainers); static String formatMorphemeContainerWithForms(final MorphemeContainer morphemeContainer); static String formatMorphemeContainerWithDerivationGrouping(MorphemeContainer morphemeContainer); static String formatMorphemeContainerWithDerivationGrouping(MorphemeContainer morphemeContainer, boolean addIndices); static String formatMorphemeContainerDetailed(MorphemeContainer morphemeContainer); static Collection<String> formatMorphemeContainersWithDerivationGrouping(Collection<MorphemeContainer> morphemeContainers);  }