DebitCreditWekaClassifier() { /* * Class for running an arbitrary classifier on data that has been passed through an arbitrary filter. */ classifier = new FilteredClassifier(); /** * Class for building and using a multinomial Naive Bayes classifier. For more information see, * Andrew Mccallum, Kamal Nigam: A Comparison of Event Models for Naive Bayes Text Classification. * https://weka.sourceforge.io/doc.dev/weka/classifiers/bayes/NaiveBayesMultinomial.html */ classifier.setClassifier(new NaiveBayesMultinomial()); /** * Declare text attribute to hold the message */ Attribute attributeText = new Attribute("text", (List) null); /** * Define the etalons or labels attribute and its values */ ArrayList classAttributeValues = new ArrayList<>(); classAttributeValues.add("debit"); classAttributeValues.add("credit"); Attribute classAttribute = new Attribute("label", classAttributeValues); /** * Built the feature vector "wekaAttributes" */ wekaAttributes = new ArrayList<>(); wekaAttributes.add(classAttribute); wekaAttributes.add(attributeText); }