public Record predict ( String text ) { TrainingParameters trainingParameters = ( TrainingParameters ) knowledgeBase . getTrainingParameters ( ) ; Dataframe testDataset = new Dataframe ( knowledgeBase . getConfiguration ( ) ) ; testDataset . add ( new Record ( new AssociativeArray ( AbstractTextExtractor . newInstance ( trainingParameters . getTextExtractorParameters ( ) ) . extract ( StringCleaner . clear ( text ) ) ) , null ) ) ; predict ( testDataset ) ; Record r = testDataset . iterator ( ) . next ( ) ; testDataset . close ( ) ; return r ; }
It generates a prediction for a particular string . It returns a Record object which contains the observation data the predicted class and probabilities .