List of usage examples for edu.stanford.nlp.util StringUtils isPunct
public static boolean isPunct(String s)
From source file:knu.univ.lingvo.coref.Mention.java
License:Open Source License
public String getPattern(List<CoreLabel> pTokens) { ArrayList<String> phrase_string = new ArrayList<String>(); String ne = ""; for (CoreLabel token : pTokens) { if (token.index() == headWord.index()) { phrase_string.add(token.lemma()); ne = ""; } else if ((token.lemma().equals("and") || StringUtils.isPunct(token.lemma())) && pTokens.size() > pTokens.indexOf(token) + 1 && pTokens.indexOf(token) > 0 && pTokens.get(pTokens.indexOf(token) + 1).ner() .equals(pTokens.get(pTokens.indexOf(token) - 1).ner())) { } else if (token.index() == headWord.index() - 1 && token.ner().equals(nerString)) { phrase_string.add(token.lemma()); ne = ""; } else if (!token.ner().equals("O")) { if (!token.ner().equals(ne)) { ne = token.ner();/*from w ww .j a va2 s. c o m*/ phrase_string.add("<" + ne + ">"); } } else { phrase_string.add(token.lemma()); ne = ""; } } return StringUtils.join(phrase_string); }