QuestionWord implements IAnalyzer { public QuestionWord() { ArrayList<String> attributeValues = new ArrayList<String>(); attributeValues.add("Who"); attributeValues.add("What"); attributeValues.add("When"); attributeValues.add("Where"); attributeValues.add("Which"); attributeValues.add(Commands); attributeValues.add(AuxVerb); attributeValues.add("How"); attributeValues.add("Misc"); attribute = new Attribute("QuestionWord", attributeValues); } QuestionWord(); @Override Object analyze(String q); @Override Attribute getAttribute();  }
@Test public void questionWordTest() { QuestionWord questionWord = new QuestionWord(); ArrayList<Attribute> fvWekaAttributes = new ArrayList<Attribute>(); fvWekaAttributes.add(questionWord.getAttribute()); new Instances("Test", fvWekaAttributes, 1 ); Instance test = new DenseInstance(fvWekaAttributes.size()); test.setValue(questionWord.getAttribute(), (String) questionWord.analyze("How high is the lighthouse in Colombo?")); assertTrue(test.stringValue(questionWord.getAttribute()).equals("How")); test.setValue(questionWord.getAttribute(), (String) questionWord.analyze("List all the musicals with music by Elton John.")); assertTrue(test.stringValue(questionWord.getAttribute()).equals(Commands)); }