1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
static String punctuation(String nodeText) {
Map<String, String> replacementsPunct = new HashMap<String, String>();
replacementsPunct.put(",", "#v_");
replacementsPunct.put(".", "#p_");
replacementsPunct.put(";", "#pv_");
replacementsPunct.put(":", "#pp_");
replacementsPunct.put("\"", "#g_");
replacementsPunct.put("(", "#po_");
replacementsPunct.put(")", "#pf_");
replacementsPunct.put("[", "#co_");
replacementsPunct.put("]", "#cf_");
replacementsPunct.put("'", "#a_");
if (!nodeText.isEmpty()) {
for (String ponctuation : replacementsPunct.keySet()) {
nodeText = nodeText.replace(ponctuation, replacementsPunct.get(ponctuation));
}
}
return nodeText;
} |
Partager