private String manageMessage(String mess) {
Command c;
Trigger t = null;
Reaction r;
NaturalLanguageProcessor nlp2 = new NaturalLanguageProcessor();
// String sentenceMess[] = nlp.getSentenceDetector().sentDetect(mess);
String tokenMess[] = mess.split(" "); //nlp.getTokenizer().tokenize(sentenceMess[0]);
String triggername = "";
int conditionSep = 0;
if (tokenMess[0].equalsIgnoreCase(HELP)) {
return help(tokenMess);
}
if (tokenMess[0].equalsIgnoreCase(LIST)) {
return list(tokenMess);
}
if (tokenMess[0].equalsIgnoreCase(IF) || tokenMess[0].equalsIgnoreCase(WHEN)) {
for (int i = 1; i < tokenMess.length; i++) {
if (tokenMess[i].equalsIgnoreCase(THEN)) {
triggername = unsplit(tokenMess, 1, i - 1, " ");
conditionSep = i + 1;
break;
}
}
t = TriggerPersistence.getTrigger(triggername);
}
String commandName = unsplit(tokenMess, conditionSep, tokenMess.length - conditionSep, " ");
List<NaturalLanguageProcessor.Rank> mostSimilar = nlp2.getMostSimilarCommand(commandName, 10);
// user is asking for help
if (commandName.contains("*")) {
String response = "";
for (NaturalLanguageProcessor.Rank nlpr : mostSimilar) {
response += "? " + nlpr.getCommand().getName() + "\n";