Я хочу отфильтровать строки из документов так же, как и график, склонный к Sklearn. Он использует следующую regex: (? U) \ b \ w \ w+\ b < /code>.
Этот код Java должен вести себя так же: < /p>
Pattern regex = Pattern.compile("(?u)\\b\\w\\w+\\b");
Matcher matcher = regex.matcher("this is the document.!? äöa m²");
while(matcher.find()) {
String match = matcher.group();
System.out.println(match);
}
< /code>
Но это не создает желаемый вывод, как это происходит в Python: < /p>
this
is
the
document
äöa
m²
< /code>
Это вместо этого выводит: < /p>
this
is
the
document
< /code>
Что я могу сделать, чтобы включить не assii символы, как это делает Python Regeex? < /p>
Подробнее здесь: https://stackoverflow.com/questions/494 ... -python-re