use of org.opencastproject.metadata.mpeg7.TextualImpl in project opencast by opencast.
the class DictionaryServiceImpl method cleanUpText.
/**
* Filter the text according to the rules defined by the dictionary
* implementation used. This implementation uses a regular expression to find
* matching terms.
*
* @return filtered text
*/
@Override
public Textual cleanUpText(String text) {
logger.debug("Text input: “{}”", text);
LinkedList<String> words = new LinkedList<String>();
Matcher matcher = compilesPattern.matcher(text);
while (matcher.find()) {
words.add(matcher.group());
}
String result = org.apache.commons.lang3.StringUtils.join(words, " ");
logger.debug("Resulting text: “{}”", result);
if ("".equals(result)) {
return null;
}
return new TextualImpl(result);
}
Aggregations