@Test public void testCheckForTaggedWord() { try { Assert.assertEquals("States", NLPUtils.checkForTaggedWord(mapString("[\"States\",\"NNPS\"]"), "NNP", "NNPS")); Assert.assertEquals("State", NLPUtils.checkForTaggedWord(mapString("[\"State\",\"NNP\"]"), "NNP", "NNPS")); Assert.assertEquals("State", NLPUtils.checkForTaggedWord(mapString("[\"State\",\"NNP\"]"), "NNP")); } catch (Exception e) { e.printStackTrace(); fail(e.toString()); } }
public static String checkForTaggedWord(JsonNode child, String... tags) { for (int i = 0; i < tags.length; i++) { if ((child.size() == 2) && (tags[i].equals(child.get(1).asText()))) { return child.get(0).asText(); } } return null; }
NLPUtils { public static String checkForTaggedWord(JsonNode child, String... tags) { for (int i = 0; i < tags.length; i++) { if ((child.size() == 2) && (tags[i].equals(child.get(1).asText()))) { return child.get(0).asText(); } } return null; } }
NLPUtils { public static String checkForTaggedWord(JsonNode child, String... tags) { for (int i = 0; i < tags.length; i++) { if ((child.size() == 2) && (tags[i].equals(child.get(1).asText()))) { return child.get(0).asText(); } } return null; }  }
NLPUtils { public static String checkForTaggedWord(JsonNode child, String... tags) { for (int i = 0; i < tags.length; i++) { if ((child.size() == 2) && (tags[i].equals(child.get(1).asText()))) { return child.get(0).asText(); } } return null; }  static List<String> findTaggedWords(JsonNode rootNode, boolean lookForSequence, String... tags); static String checkForTaggedWord(JsonNode child, String... tags); }
NLPUtils { public static String checkForTaggedWord(JsonNode child, String... tags) { for (int i = 0; i < tags.length; i++) { if ((child.size() == 2) && (tags[i].equals(child.get(1).asText()))) { return child.get(0).asText(); } } return null; }  static List<String> findTaggedWords(JsonNode rootNode, boolean lookForSequence, String... tags); static String checkForTaggedWord(JsonNode child, String... tags);  }