Closed hoathienvu8x closed 2 years ago
Thanks. The tokenizer is not perfect.
@datquocnguyen I think single quote character has been split inside of regex PUNCTUATION
, it will be punctuation if space is prefix or suffix
--- src/main/java/vn/corenlp/tokenizer/Tokenizer.java 2022-06-29 15:25:05.204820143 +0700
+++ src/main/java/vn/corenlp/tokenizer/Tokenizer.java 2022-06-29 15:25:18.268773361 +0700
@@ -315,6 +315,8 @@
public static final String NUMBERS_EXPRESSION = NUMBER + "([\\+\\-\\*\\/]" + NUMBER + ")*";
public static final String SHORT_NAME = "([\\p{L}]+([\\.\\-][\\p{L}]+)+)|([\\p{L}]+-\\d+)";
+
+ public static final String NAME_HAS_PUNCTUATION = "([\\p{L}]+(['’][\\p{L}]+)+)";
public static final String WORD_WITH_HYPHEN = "\\p{L}+-\\p{L}+(-\\p{L}+)*";
@@ -360,6 +362,9 @@
regexes.add(SHORT_NAME);
regexIndex.add("SHORT_NAME");
+ regexes.add(NAME_HAS_PUNCTUATION);
+ regexIndex.add("NAME_HAS_PUNCTUATION");
+
regexes.add(NUMBERS_EXPRESSION);
regexIndex.add("NUMBERS_EXPRESSION");
Issue when tokenize string contains single quote character. I have a string :
"Nghiên cứu Đại học King's College London và Đại học Leiceste đăng trên Tạp chí Di truyền Con người Mỹ năm 2021 cũng cho thấy"
When run with VnCoreNLP result:
Other sample string:
"H'Hen Niê là một hoa hậu và người mẫu người Việt Nam."
result: