List of usage examples for edu.stanford.nlp.util StringUtils find
public static boolean find(String str, String regex)
From source file:opennlp.tools.jsmlearning.JSMLearnerOnLatticeWithDeduction.java
License:Apache License
public Pair<List<String>, List<String>> reGroupByOccurrenceOfSeparationKeyword(List<String> posTexts, List<String> negTexts, String[] keywords) { List<String> posTextsNew = new ArrayList<String>(), negTextsNew = new ArrayList<String>(); for (String posText : posTexts) { Boolean multiwordOccurs = true; for (String keyword : keywords) { if (!StringUtils.find(posText, keyword)) multiwordOccurs = false; break; }/* w ww . ja v a2 s . c o m*/ if (multiwordOccurs) posTextsNew.add(posText); else negTextsNew.add(posText); } for (String negText : negTexts) { Boolean multiwordOccurs = true; for (String keyword : keywords) { if (!StringUtils.find(negText, keyword)) multiwordOccurs = false; break; } if (multiwordOccurs) posTextsNew.add(negText); else negTextsNew.add(negText); } return new Pair<List<String>, List<String>>(posTextsNew, negTextsNew); }