private String removeEnding(String word){
  int length=word.length();
  int el=11;
  while (el > 0) {
    if (length - el > 1) {
      String ending=word.substring(length - el);
      String conditionCode=null;
switch (el) {
case 11:
        conditionCode=(String)m_l11.get(ending);
      break;
case 10:
    conditionCode=(String)m_l10.get(ending);
  break;
case 9:
conditionCode=(String)m_l9.get(ending);
break;
case 8:
conditionCode=(String)m_l8.get(ending);
break;
case 7:
conditionCode=(String)m_l7.get(ending);
break;
case 6:
conditionCode=(String)m_l6.get(ending);
break;
case 5:
conditionCode=(String)m_l5.get(ending);
break;
case 4:
conditionCode=(String)m_l4.get(ending);
break;
case 3:
conditionCode=(String)m_l3.get(ending);
break;
case 2:
conditionCode=(String)m_l2.get(ending);
break;
case 1:
conditionCode=(String)m_l1.get(ending);
break;
default :
}
if (conditionCode != null) {
switch (conditionCode.charAt(0)) {
case 'A':
return word.substring(0,length - el);
case 'B':
if (length - el > 2) {
return word.substring(0,length - el);
}
break;
case 'C':
if (length - el > 3) {
return word.substring(0,length - el);
}
break;
case 'D':
if (length - el > 4) {
return word.substring(0,length - el);
}
break;
case 'E':
if (word.charAt(length - el - 1) != 'e') {
return word.substring(0,length - el);
}
break;
case 'F':
if ((length - el > 2) && (word.charAt(length - el - 1) != 'e')) {
return word.substring(0,length - el);
}
break;
case 'G':
if ((length - el > 2) && (word.charAt(length - el - 1) == 'f')) {
return word.substring(0,length - el);
}
break;
case 'H':
if ((word.charAt(length - el - 1) == 't') || ((word.charAt(length - el - 1) == 'l') && (word.charAt(length - el - 2) == 'l'))) {
return word.substring(0,length - el);
}
break;
case 'I':
if ((word.charAt(length - el - 1) != 'o') && (word.charAt(length - el - 1) != 'e')) {
return word.substring(0,length - el);
}
break;
case 'J':
if ((word.charAt(length - el - 1) != 'a') && (word.charAt(length - el - 1) != 'e')) {
return word.substring(0,length - el);
}
break;
case 'K':
if ((length - el > 2) && ((word.charAt(length - el - 1) == 'l') || (word.charAt(length - el - 1) == 'i') || ((word.charAt(length - el - 1) == 'e') && (word.charAt(length - el - 3) == 'u')))) {
return word.substring(0,length - el);
}
break;
case 'L':
if ((word.charAt(length - el - 1) != 'u') && (word.charAt(length - el - 1) != 'x') && ((word.charAt(length - el - 1) != 's') || (word.charAt(length - el - 2) == 'o'))) {
return word.substring(0,length - el);
}
break;
case 'M':
if ((word.charAt(length - el - 1) != 'a') && (word.charAt(length - el - 1) != 'c') && (word.charAt(length - el - 1) != 'e')&& (word.charAt(length - el - 1) != 'm')) {
return word.substring(0,length - el);
}
break;
case 'N':
if ((length - el > 3) || ((length - el == 3) && ((word.charAt(length - el - 3) != 's')))) {
return word.substring(0,length - el);
}
break;
case 'O':
if ((word.charAt(length - el - 1) == 'l') || (word.charAt(length - el - 1) == 'i')) {
return word.substring(0,length - el);
}
break;
case 'P':
if (word.charAt(length - el - 1) != 'c') {
return word.substring(0,length - el);
}
break;
case 'Q':
if ((length - el > 2) && (word.charAt(length - el - 1) != 'l') && (word.charAt(length - el - 1) != 'n')) {
return word.substring(0,length - el);
}
break;
case 'R':
if ((word.charAt(length - el - 1) == 'n') || (word.charAt(length - el - 1) == 'r')) {
return word.substring(0,length - el);
}
break;
case 'S':
if (((word.charAt(length - el - 1) == 'r') && (word.charAt(length - el - 2) == 'd')) || ((word.charAt(length - el - 1) == 't') && (word.charAt(length - el - 2) != 't'))) {
return word.substring(0,length - el);
}
break;
case 'T':
if ((word.charAt(length - el - 1) == 's') || ((word.charAt(length - el - 1) == 't') && (word.charAt(length - el - 2) != 'o'))) {
return word.substring(0,length - el);
}
break;
case 'U':
if ((word.charAt(length - el - 1) == 'l') || (word.charAt(length - el - 1) == 'm') || (word.charAt(length - el - 1) == 'n')|| (word.charAt(length - el - 1) == 'r')) {
return word.substring(0,length - el);
}
break;
case 'V':
if (word.charAt(length - el - 1) == 'c') {
return word.substring(0,length - el);
}
break;
case 'W':
if ((word.charAt(length - el - 1) != 's') && (word.charAt(length - el - 1) != 'u')) {
return word.substring(0,length - el);
}
break;
case 'X':
if ((word.charAt(length - el - 1) == 'l') || (word.charAt(length - el - 1) == 'i') || ((length - el > 2) && (word.charAt(length - el - 1) == 'e') && (word.charAt(length - el - 3) == 'u'))) {
return word.substring(0,length - el);
}
break;
case 'Y':
if ((word.charAt(length - el - 1) == 'n') && (word.charAt(length - el - 2) == 'i')) {
return word.substring(0,length - el);
}
break;
case 'Z':
if (word.charAt(length - el - 1) != 'f') {
return word.substring(0,length - el);
}
break;
case 'a':
if ((word.charAt(length - el - 1) == 'd') || (word.charAt(length - el - 1) == 'f') || (((word.charAt(length - el - 1) == 'h') && (word.charAt(length - el - 2) == 'p')))|| (((word.charAt(length - el - 1) == 'h') && (word.charAt(length - el - 2) == 't')))|| (word.charAt(length - el - 1) == 'l')|| (((word.charAt(length - el - 1) == 'r') && (word.charAt(length - el - 2) == 'e')))|| (((word.charAt(length - el - 1) == 'r') && (word.charAt(length - el - 2) == 'o')))|| (((word.charAt(length - el - 1) == 's') && (word.charAt(length - el - 2) == 'e')))|| (word.charAt(length - el - 1) == 't')) {
return word.substring(0,length - el);
}
break;
case 'b':
if (m_CompMode) {
if (((length - el == 3) && (!((word.charAt(length - el - 1) == 't') && (word.charAt(length - el - 2) == 'e') && (word.charAt(length - el - 3) == 'm')))) || ((length - el > 3) && (!((word.charAt(length - el - 1) == 't') && (word.charAt(length - el - 2) == 's') && (word.charAt(length - el - 3) == 'y')&& (word.charAt(length - el - 4) == 'r'))))) {
return word.substring(0,length - el);
}
}
 else {
if ((length - el > 2) && (!((word.charAt(length - el - 1) == 't') && (word.charAt(length - el - 2) == 'e') && (word.charAt(length - el - 3) == 'm'))) && ((length - el < 4) || (!((word.charAt(length - el - 1) == 't') && (word.charAt(length - el - 2) == 's') && (word.charAt(length - el - 3) == 'y')&& (word.charAt(length - el - 4) == 'r'))))) {
return word.substring(0,length - el);
}
}
break;
case 'c':
if (word.charAt(length - el - 1) == 'l') {
return word.substring(0,length - el);
}
break;
default :
throw new IllegalArgumentException("Fatal error.");
}
}
}
el--;
}
return word;
}

private String removeEnding ( String word ) { int length = word . length ( ) ; int el = 11 ; while ( el > 0 ) { if ( length - el > 1 ) { String ending = word . substring ( length - el ) ; String conditionCode = null ; switch ( el ) { case 11 : conditionCode = ( String ) m_l11 . get ( ending ) ; break ; case 10 : conditionCode = ( String ) m_l10 . get ( ending ) ; break ; case 9 : conditionCode = ( String ) m_l9 . get ( ending ) ; break ; case 8 : conditionCode = ( String ) m_l8 . get ( ending ) ; break ; case 7 : conditionCode = ( String ) m_l7 . get ( ending ) ; break ; case 6 : conditionCode = ( String ) m_l6 . get ( ending ) ; break ; case 5 : conditionCode = ( String ) m_l5 . get ( ending ) ; break ; case 4 : conditionCode = ( String ) m_l4 . get ( ending ) ; break ; case 3 : conditionCode = ( String ) m_l3 . get ( ending ) ; break ; case 2 : conditionCode = ( String ) m_l2 . get ( ending ) ; break ; case 1 : conditionCode = ( String ) m_l1 . get ( ending ) ; break ; default : } if ( conditionCode != null ) { switch ( conditionCode . charAt ( 0 ) ) { case 'A' : return word . substring ( 0 , length - el ) ; case 'B' : if ( length - el > 2 ) { return word . substring ( 0 , length - el ) ; } break ; case 'C' : if ( length - el > 3 ) { return word . substring ( 0 , length - el ) ; } break ; case 'D' : if ( length - el > 4 ) { return word . substring ( 0 , length - el ) ; } break ; case 'E' : if ( word . charAt ( length - el - 1 ) != 'e' ) { return word . substring ( 0 , length - el ) ; } break ; case 'F' : if ( ( length - el > 2 ) && ( word . charAt ( length - el - 1 ) != 'e' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'G' : if ( ( length - el > 2 ) && ( word . charAt ( length - el - 1 ) == 'f' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'H' : if ( ( word . charAt ( length - el - 1 ) == 't' ) || ( ( word . charAt ( length - el - 1 ) == 'l' ) && ( word . charAt ( length - el - 2 ) == 'l' ) ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'I' : if ( ( word . charAt ( length - el - 1 ) != 'o' ) && ( word . charAt ( length - el - 1 ) != 'e' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'J' : if ( ( word . charAt ( length - el - 1 ) != 'a' ) && ( word . charAt ( length - el - 1 ) != 'e' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'K' : if ( ( length - el > 2 ) && ( ( word . charAt ( length - el - 1 ) == 'l' ) || ( word . charAt ( length - el - 1 ) == 'i' ) || ( ( word . charAt ( length - el - 1 ) == 'e' ) && ( word . charAt ( length - el - 3 ) == 'u' ) ) ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'L' : if ( ( word . charAt ( length - el - 1 ) != 'u' ) && ( word . charAt ( length - el - 1 ) != 'x' ) && ( ( word . charAt ( length - el - 1 ) != 's' ) || ( word . charAt ( length - el - 2 ) == 'o' ) ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'M' : if ( ( word . charAt ( length - el - 1 ) != 'a' ) && ( word . charAt ( length - el - 1 ) != 'c' ) && ( word . charAt ( length - el - 1 ) != 'e' ) && ( word . charAt ( length - el - 1 ) != 'm' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'N' : if ( ( length - el > 3 ) || ( ( length - el == 3 ) && ( ( word . charAt ( length - el - 3 ) != 's' ) ) ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'O' : if ( ( word . charAt ( length - el - 1 ) == 'l' ) || ( word . charAt ( length - el - 1 ) == 'i' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'P' : if ( word . charAt ( length - el - 1 ) != 'c' ) { return word . substring ( 0 , length - el ) ; } break ; case 'Q' : if ( ( length - el > 2 ) && ( word . charAt ( length - el - 1 ) != 'l' ) && ( word . charAt ( length - el - 1 ) != 'n' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'R' : if ( ( word . charAt ( length - el - 1 ) == 'n' ) || ( word . charAt ( length - el - 1 ) == 'r' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'S' : if ( ( ( word . charAt ( length - el - 1 ) == 'r' ) && ( word . charAt ( length - el - 2 ) == 'd' ) ) || ( ( word . charAt ( length - el - 1 ) == 't' ) && ( word . charAt ( length - el - 2 ) != 't' ) ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'T' : if ( ( word . charAt ( length - el - 1 ) == 's' ) || ( ( word . charAt ( length - el - 1 ) == 't' ) && ( word . charAt ( length - el - 2 ) != 'o' ) ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'U' : if ( ( word . charAt ( length - el - 1 ) == 'l' ) || ( word . charAt ( length - el - 1 ) == 'm' ) || ( word . charAt ( length - el - 1 ) == 'n' ) || ( word . charAt ( length - el - 1 ) == 'r' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'V' : if ( word . charAt ( length - el - 1 ) == 'c' ) { return word . substring ( 0 , length - el ) ; } break ; case 'W' : if ( ( word . charAt ( length - el - 1 ) != 's' ) && ( word . charAt ( length - el - 1 ) != 'u' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'X' : if ( ( word . charAt ( length - el - 1 ) == 'l' ) || ( word . charAt ( length - el - 1 ) == 'i' ) || ( ( length - el > 2 ) && ( word . charAt ( length - el - 1 ) == 'e' ) && ( word . charAt ( length - el - 3 ) == 'u' ) ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'Y' : if ( ( word . charAt ( length - el - 1 ) == 'n' ) && ( word . charAt ( length - el - 2 ) == 'i' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'Z' : if ( word . charAt ( length - el - 1 ) != 'f' ) { return word . substring ( 0 , length - el ) ; } break ; case 'a' : if ( ( word . charAt ( length - el - 1 ) == 'd' ) || ( word . charAt ( length - el - 1 ) == 'f' ) || ( ( ( word . charAt ( length - el - 1 ) == 'h' ) && ( word . charAt ( length - el - 2 ) == 'p' ) ) ) || ( ( ( word . charAt ( length - el - 1 ) == 'h' ) && ( word . charAt ( length - el - 2 ) == 't' ) ) ) || ( word . charAt ( length - el - 1 ) == 'l' ) || ( ( ( word . charAt ( length - el - 1 ) == 'r' ) && ( word . charAt ( length - el - 2 ) == 'e' ) ) ) || ( ( ( word . charAt ( length - el - 1 ) == 'r' ) && ( word . charAt ( length - el - 2 ) == 'o' ) ) ) || ( ( ( word . charAt ( length - el - 1 ) == 's' ) && ( word . charAt ( length - el - 2 ) == 'e' ) ) ) || ( word . charAt ( length - el - 1 ) == 't' ) ) { return word . substring ( 0 , length - el ) ; } break ; case 'b' : if ( m_CompMode ) { if ( ( ( length - el == 3 ) && ( ! ( ( word . charAt ( length - el - 1 ) == 't' ) && ( word . charAt ( length - el - 2 ) == 'e' ) && ( word . charAt ( length - el - 3 ) == 'm' ) ) ) ) || ( ( length - el > 3 ) && ( ! ( ( word . charAt ( length - el - 1 ) == 't' ) && ( word . charAt ( length - el - 2 ) == 's' ) && ( word . charAt ( length - el - 3 ) == 'y' ) && ( word . charAt ( length - el - 4 ) == 'r' ) ) ) ) ) { return word . substring ( 0 , length - el ) ; } } else { if ( ( length - el > 2 ) && ( ! ( ( word . charAt ( length - el - 1 ) == 't' ) && ( word . charAt ( length - el - 2 ) == 'e' ) && ( word . charAt ( length - el - 3 ) == 'm' ) ) ) && ( ( length - el < 4 ) || ( ! ( ( word . charAt ( length - el - 1 ) == 't' ) && ( word . charAt ( length - el - 2 ) == 's' ) && ( word . charAt ( length - el - 3 ) == 'y' ) && ( word . charAt ( length - el - 4 ) == 'r' ) ) ) ) ) { return word . substring ( 0 , length - el ) ; } } break ; case 'c' : if ( word . charAt ( length - el - 1 ) == 'l' ) { return word . substring ( 0 , length - el ) ; } break ; default : throw new IllegalArgumentException ( "Fatal error." ) ; } } } el -- ; } return word ; }
finds and removes ending from given word .
