public void learn(Object example){
  String form=extractor.discreteValue(example);
  String label=labeler.discreteValue(example);
  if (form.length() >= 5) {
    boolean allLetters=true;
    for (int i=form.length() - 3; i < form.length() && allLetters; ++i)     allLetters=Character.isLetter(form.charAt(i));
    if (allLetters) {
      Word w=(Word)example;
      HashMap<String,TreeMap<String,Integer>> t=null;
      if (w.capitalized) {
        if (w.previous == null)         t=firstCapitalized;
 else         t=notFirstCapitalized;
      }
 else {
        if (form.contains("-"))         return;
        t=table;
      }
      form=form.toLowerCase();
      increment(t,form.substring(form.length() - 3),label);
      if (form.length() >= 6 && Character.isLetter(form.charAt(form.length() - 4)))       increment(t,form.substring(form.length() - 4),label);
    }
  }
}

public void learn ( Object example ) { String form = extractor . discreteValue ( example ) ; String label = labeler . discreteValue ( example ) ; if ( form . length ( ) >= 5 ) { boolean allLetters = true ; for ( int i = form . length ( ) - 3 ; i < form . length ( ) && allLetters ; ++ i ) allLetters = Character . isLetter ( form . charAt ( i ) ) ; if ( allLetters ) { Word w = ( Word ) example ; HashMap < String , TreeMap < String , Integer > > t = null ; if ( w . capitalized ) { if ( w . previous == null ) t = firstCapitalized ; else t = notFirstCapitalized ; } else { if ( form . contains ( "-" ) ) return ; t = table ; } form = form . toLowerCase ( ) ; increment ( t , form . substring ( form . length ( ) - 3 ) , label ) ; if ( form . length ( ) >= 6 && Character . isLetter ( form . charAt ( form . length ( ) - 4 ) ) ) increment ( t , form . substring ( form . length ( ) - 4 ) , label ) ; } } }
trains the learning algorithm given an object as an example .
