@Test public void testParseWithError() { String sentence = "the_DT stories"; try { POSSample.parse(sentence); } catch (InvalidFormatException e) { return; } Assert.fail(); }
public static POSSample parse(String sentenceString) throws InvalidFormatException { String[] tokenTags = WhitespaceTokenizer.INSTANCE.tokenize(sentenceString); String[] sentence = new String[tokenTags.length]; String[] tags = new String[tokenTags.length]; for (int i = 0; i < tokenTags.length; i++) { int split = tokenTags[i].lastIndexOf("_"); if (split == -1) { throw new InvalidFormatException("Cannot find \"_\" inside token '" + tokenTags[i] + "'!"); } sentence[i] = tokenTags[i].substring(0, split); tags[i] = tokenTags[i].substring(split + 1); } return new POSSample(sentence, tags); }
POSSample implements Serializable { public static POSSample parse(String sentenceString) throws InvalidFormatException { String[] tokenTags = WhitespaceTokenizer.INSTANCE.tokenize(sentenceString); String[] sentence = new String[tokenTags.length]; String[] tags = new String[tokenTags.length]; for (int i = 0; i < tokenTags.length; i++) { int split = tokenTags[i].lastIndexOf("_"); if (split == -1) { throw new InvalidFormatException("Cannot find \"_\" inside token '" + tokenTags[i] + "'!"); } sentence[i] = tokenTags[i].substring(0, split); tags[i] = tokenTags[i].substring(split + 1); } return new POSSample(sentence, tags); } }
POSSample implements Serializable { public static POSSample parse(String sentenceString) throws InvalidFormatException { String[] tokenTags = WhitespaceTokenizer.INSTANCE.tokenize(sentenceString); String[] sentence = new String[tokenTags.length]; String[] tags = new String[tokenTags.length]; for (int i = 0; i < tokenTags.length; i++) { int split = tokenTags[i].lastIndexOf("_"); if (split == -1) { throw new InvalidFormatException("Cannot find \"_\" inside token '" + tokenTags[i] + "'!"); } sentence[i] = tokenTags[i].substring(0, split); tags[i] = tokenTags[i].substring(split + 1); } return new POSSample(sentence, tags); } POSSample(String[] sentence, String[] tags);  POSSample(List<String> sentence, List<String> tags);  POSSample(List<String> sentence, List<String> tags,
      String[][] additionalContext);  POSSample(String[] sentence, String[] tags,
      String[][] additionalContext); }
POSSample implements Serializable { public static POSSample parse(String sentenceString) throws InvalidFormatException { String[] tokenTags = WhitespaceTokenizer.INSTANCE.tokenize(sentenceString); String[] sentence = new String[tokenTags.length]; String[] tags = new String[tokenTags.length]; for (int i = 0; i < tokenTags.length; i++) { int split = tokenTags[i].lastIndexOf("_"); if (split == -1) { throw new InvalidFormatException("Cannot find \"_\" inside token '" + tokenTags[i] + "'!"); } sentence[i] = tokenTags[i].substring(0, split); tags[i] = tokenTags[i].substring(split + 1); } return new POSSample(sentence, tags); } POSSample(String[] sentence, String[] tags);  POSSample(List<String> sentence, List<String> tags);  POSSample(List<String> sentence, List<String> tags,
      String[][] additionalContext);  POSSample(String[] sentence, String[] tags,
      String[][] additionalContext); String[] getSentence(); String[] getTags(); String[][] getAddictionalContext(); @Override String toString(); static POSSample parse(String sentenceString); @Override int hashCode(); @Override boolean equals(Object obj); }
POSSample implements Serializable { public static POSSample parse(String sentenceString) throws InvalidFormatException { String[] tokenTags = WhitespaceTokenizer.INSTANCE.tokenize(sentenceString); String[] sentence = new String[tokenTags.length]; String[] tags = new String[tokenTags.length]; for (int i = 0; i < tokenTags.length; i++) { int split = tokenTags[i].lastIndexOf("_"); if (split == -1) { throw new InvalidFormatException("Cannot find \"_\" inside token '" + tokenTags[i] + "'!"); } sentence[i] = tokenTags[i].substring(0, split); tags[i] = tokenTags[i].substring(split + 1); } return new POSSample(sentence, tags); } POSSample(String[] sentence, String[] tags);  POSSample(List<String> sentence, List<String> tags);  POSSample(List<String> sentence, List<String> tags,
      String[][] additionalContext);  POSSample(String[] sentence, String[] tags,
      String[][] additionalContext); String[] getSentence(); String[] getTags(); String[][] getAddictionalContext(); @Override String toString(); static POSSample parse(String sentenceString); @Override int hashCode(); @Override boolean equals(Object obj);  }