@Test public void GetCommand_InvocabotFrequencyTwo_Success() { setUp(); String input = "hi my name is julio invocabot schedule an appointment with chris at twelve p m tomorrow invocabot what time is it"; String desiredOutput = "schedule an appointment with chris at twelve p m tomorrow"; String output = SphinxManager.getCommand(input); assertEquals(desiredOutput, output); tearDown(); }
public static String getCommand(String string){ int index = string.indexOf("invocabot"); if (index == -1) return null; String words[] = string.split(" "); if (words[words.length - 1].equals("invocabot")) return ""; if (string.equalsIgnoreCase("invocabot")) return ""; String output; int endIndex = string.indexOf("invocabot", index + 1); int truncationIndex = index + "invocabot".length() + 1; if (endIndex == -1) { output = string.substring(truncationIndex); } else { output = string.substring(truncationIndex, endIndex - 1); } return output; }
SphinxManager { public static String getCommand(String string){ int index = string.indexOf("invocabot"); if (index == -1) return null; String words[] = string.split(" "); if (words[words.length - 1].equals("invocabot")) return ""; if (string.equalsIgnoreCase("invocabot")) return ""; String output; int endIndex = string.indexOf("invocabot", index + 1); int truncationIndex = index + "invocabot".length() + 1; if (endIndex == -1) { output = string.substring(truncationIndex); } else { output = string.substring(truncationIndex, endIndex - 1); } return output; } }
SphinxManager { public static String getCommand(String string){ int index = string.indexOf("invocabot"); if (index == -1) return null; String words[] = string.split(" "); if (words[words.length - 1].equals("invocabot")) return ""; if (string.equalsIgnoreCase("invocabot")) return ""; String output; int endIndex = string.indexOf("invocabot", index + 1); int truncationIndex = index + "invocabot".length() + 1; if (endIndex == -1) { output = string.substring(truncationIndex); } else { output = string.substring(truncationIndex, endIndex - 1); } return output; }  }
SphinxManager { public static String getCommand(String string){ int index = string.indexOf("invocabot"); if (index == -1) return null; String words[] = string.split(" "); if (words[words.length - 1].equals("invocabot")) return ""; if (string.equalsIgnoreCase("invocabot")) return ""; String output; int endIndex = string.indexOf("invocabot", index + 1); int truncationIndex = index + "invocabot".length() + 1; if (endIndex == -1) { output = string.substring(truncationIndex); } else { output = string.substring(truncationIndex, endIndex - 1); } return output; }  static String getCommand(String string); }
SphinxManager { public static String getCommand(String string){ int index = string.indexOf("invocabot"); if (index == -1) return null; String words[] = string.split(" "); if (words[words.length - 1].equals("invocabot")) return ""; if (string.equalsIgnoreCase("invocabot")) return ""; String output; int endIndex = string.indexOf("invocabot", index + 1); int truncationIndex = index + "invocabot".length() + 1; if (endIndex == -1) { output = string.substring(truncationIndex); } else { output = string.substring(truncationIndex, endIndex - 1); } return output; }  static String getCommand(String string);  }