@@ -0,0 +1,1527 @@
+package morfologik.fsa.morph;%0D%0A%0D%0A/**%0D%0A * A class that converts tabular data to fsa morphological%0D%0A * format. Three formats are supported:%0D%0A * %3Cul%3E%0D%0A * %3Cli%3Estandard%3C/li%3E%0D%0A * %3Cli%3Eprefix%3C/li%3E%0D%0A * %3Cli%3Einfix%3C/li%3E%0D%0A * %3C/ul%3E%0D%0A */%0D%0Apublic class FsaMorphCoder %7B%0D%0A%0D%0A%09static final char SEPARATOR = '+';%0D%0A%09%0D%0A%09private FsaMorphCoder() %7B%0D%0A%09// only static stuff%0D%0A%09%7D;%0D%0A%09%0D%0A%09public static final int commonPrefix(final String s1, final String s2, %0D%0A%09%09%09final int n)%0D%0A%09%7B%0D%0A%09%09for (int i = 0; i %3C n; i++)%0D%0A%09%09%09if (s1.charAt(i) != s2.charAt(i))%0D%0A%09%09%09%09return i;%0D%0A%09%09return n;%0D%0A%09%7D%0D%0A%09%0D%0A%09/** %0D%0A%09 * This method converts the WordForm, wordLemma and tag to the form:%3Cbr/%3E%0D%0A%09 * wordForm+Kending+tags%0D%0A%09 * %3C/br%3E%0D%0A%09 * where '+' is a separator, K is a character that specifies how %0D%0A%09 * many characters should be deleted from the end of the inflected %0D%0A%09 * form to produce the lexeme by concatenating the stripped string %0D%0A%09 * with the ending.%0D%0A%09 * %0D%0A%09 */%0D%0A%09public static final String standardEncode(final String wordForm, %0D%0A%09%09%09final String wordLemma, final String wordTag) %7B%09%09%0D%0A%09%09int l1 = wordForm.length();%0D%0A%09%09int prefix = commonPrefix(wordForm, wordLemma, wordForm.length());%0D%0A%09%09StringBuilder sb = new StringBuilder();%0D%0A%09%09sb.append(wordForm);%0D%0A%09%09sb.append(SEPARATOR);%0D%0A%09%09if (prefix != 0) %7B%09%09%09%09%09%09%09%09%0D%0A%09%09%09sb.append((char)((l1 - prefix + 65)&0xff));%0D%0A%09%09%09sb.append(wordLemma.substring(prefix));%0D%0A%09%09%7D else %7B%09%09%09  %09%09 %0D%0A%09%09%09sb.append((char)((l1 + 65)&0xff));%0D%0A%09%09%09sb.append(wordLemma);%0D%0A%09%09%7D%0D%0A%09%09sb.append(SEPARATOR);%0D%0A%09%09sb.append(wordTag);%0D%0A%09%09return sb.toString();%0D%0A%09%7D%0D%0A%09%0D%0A%7D%0D%0A

add initial port of morph_data.awk to Java