QuestionTypeAnalyzer implements IAnalyzer { public static Boolean isASKQuestion(String question) { return question.startsWith("Are ") || question.startsWith("Did ") || question.startsWith("Do ") || question.startsWith("Does ") || question.startsWith("Is ") || question.startsWith("Was "); }  @Override Object analyze(String q); @Override Attribute getAttribute(); static Boolean isASKQuestion(String question); Boolean isListQuestion(String question); Boolean isNumberQuestion(String question);  }
@Test public void resultTypeBoolean() { log.info("Test QuestionType classification ..."); log.debug("Initialize components ..."); log.info("Run queries through components ..."); log.debug("Load data file: " + Dataset.QALD9_Test_Multilingual.name()); List<IQuestion> questions = LoaderController.load(Dataset.QALD9_Test_Multilingual); int counter = 0; int counterASK = 0; int counterClassifiedWrong = 0; for (IQuestion q : questions) { boolean classification = QuestionTypeAnalyzer.isASKQuestion(q.getLanguageToQuestion().get("en")); counter++; if (classification) { counterASK++; } if ( (classification && !"boolean".equals(q.getAnswerType())) || (!classification && "boolean".equals(q.getAnswerType())) ) { counterClassifiedWrong++; } } log.info("Classified " + counterClassifiedWrong + " wrong from " + counter + " queries. (" + counterASK + " are ASK)"); assertTrue(counterClassifiedWrong == 0); }