@Test public void isMultiSentenceInstructionTest() { List<String> multiSentenceInstructions = Arrays.asList( "a. a", "aaa. bbb.", "aaa. bbb. " ); List<String> nonMultiSentenceInstructions = Arrays.asList( "", "a.", "a. ", "a b. ", "aaa bbb ccc" ); assertTrue(multiSentenceInstructions.stream().allMatch(str-> new Example(null,str,null,null, null).isMultiSentenceInstruction())); assertTrue(nonMultiSentenceInstructions.stream().noneMatch(str-> new Example(null,str,null,null, null).isMultiSentenceInstruction())); }
public boolean isMultiSentenceInstruction() { int fromIndex = 0; int dotInd; while ((dotInd = instructionUtterance.indexOf(".", fromIndex)) >= 0){ if (!instructionUtterance.substring(dotInd + 1).trim().isEmpty() && StringUtils.isBlank(instructionUtterance.substring(dotInd + 1,dotInd + 2))) return true; fromIndex =dotInd+1; } return false; }
Example implements Serializable { public boolean isMultiSentenceInstruction() { int fromIndex = 0; int dotInd; while ((dotInd = instructionUtterance.indexOf(".", fromIndex)) >= 0){ if (!instructionUtterance.substring(dotInd + 1).trim().isEmpty() && StringUtils.isBlank(instructionUtterance.substring(dotInd + 1,dotInd + 2))) return true; fromIndex =dotInd+1; } return false; } }
Example implements Serializable { public boolean isMultiSentenceInstruction() { int fromIndex = 0; int dotInd; while ((dotInd = instructionUtterance.indexOf(".", fromIndex)) >= 0){ if (!instructionUtterance.substring(dotInd + 1).trim().isEmpty() && StringUtils.isBlank(instructionUtterance.substring(dotInd + 1,dotInd + 2))) return true; fromIndex =dotInd+1; } return false; } Example(String id, String instruction, State initialState, State destinationState,
				   Domain domain);  Example(Hit hit, String instruction); }
Example implements Serializable { public boolean isMultiSentenceInstruction() { int fromIndex = 0; int dotInd; while ((dotInd = instructionUtterance.indexOf(".", fromIndex)) >= 0){ if (!instructionUtterance.substring(dotInd + 1).trim().isEmpty() && StringUtils.isBlank(instructionUtterance.substring(dotInd + 1,dotInd + 2))) return true; fromIndex =dotInd+1; } return false; } Example(String id, String instruction, State initialState, State destinationState,
				   Domain domain);  Example(Hit hit, String instruction); @Override boolean equals(Object o); @Override int hashCode(); String getId(); String getInstructionUtterance(); void setInstructionUtterance(String instructionUtterance); State getInitialState(); Domain getDomain(); State getDestinationState(); boolean isMultiSentenceInstruction(); @Override String toString(); }
Example implements Serializable { public boolean isMultiSentenceInstruction() { int fromIndex = 0; int dotInd; while ((dotInd = instructionUtterance.indexOf(".", fromIndex)) >= 0){ if (!instructionUtterance.substring(dotInd + 1).trim().isEmpty() && StringUtils.isBlank(instructionUtterance.substring(dotInd + 1,dotInd + 2))) return true; fromIndex =dotInd+1; } return false; } Example(String id, String instruction, State initialState, State destinationState,
				   Domain domain);  Example(Hit hit, String instruction); @Override boolean equals(Object o); @Override int hashCode(); String getId(); String getInstructionUtterance(); void setInstructionUtterance(String instructionUtterance); State getInitialState(); Domain getDomain(); State getDestinationState(); boolean isMultiSentenceInstruction(); @Override String toString();  }