public String classify ( String cps ) { // cps contains a list of context predicates String modelLabel = "" ; int i ; intCps . clear ( ) ; StringTokenizer strTok = new StringTokenizer ( cps , " \t\r\n" ) ; int count = strTok . countTokens ( ) ; for ( i = 0 ; i < count ; i ++ ) { String cpStr = strTok . nextToken ( ) ; Integer cpInt = ( Integer ) data . cpStr2Int . get ( cpStr ) ; if ( cpInt != null ) { intCps . add ( cpInt ) ; } } Observation obsr = new Observation ( intCps ) ; // classify inference . classify ( obsr ) ; String lbStr = ( String ) data . lbInt2Str . get ( new Integer ( obsr . modelLabel ) ) ; if ( lbStr != null ) { modelLabel = lbStr ; } return modelLabel ; }
classify an observation .