
com.graphaware.nlp.util.TextUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nlp Show documentation
Show all versions of nlp Show documentation
GraphAware Framework Module for adding NLP capabilities to Neo4j.
The newest version!
package com.graphaware.nlp.util;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TextUtils {
private static String REGEX = "\\(..\\)$";
private static String REPLACE = "";
private static Pattern pattern = Pattern.compile(REGEX);
public static String removeApices(String text) {
if (text != null) {
return text.replace("\"", "");
}
return null;
}
public static String removeParenthesis(String concept) {
Matcher m = pattern.matcher(concept);
StringBuffer sb = new StringBuffer();
while (m.find()) {
m.appendReplacement(sb, REPLACE);
}
m.appendTail(sb);
return sb.toString();
}
public static String replaceEach(List searches, String original) {
String ns = original;
for (String s : searches) {
ns = ns.replace(s, "");
}
return ns;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy