Skip to content

Commit 9570c4a

Browse files
author
jian.li
committed
fix chinese numbers link with roman numbers
1 parent 3f59c73 commit 9570c4a

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/main/java/com/hankcs/hanlp/dictionary/other/CharType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public class CharType
6060
*/
6161
public static final byte CT_INDEX = CT_SINGLE + 5;
6262

63+
/**
64+
* 中文数字
65+
*/
66+
public static final byte CT_CNUM = CT_SINGLE + 6;
67+
6368
/**
6469
* 其他
6570
*/

src/main/java/com/hankcs/hanlp/utility/TextUtility.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public class TextUtility
4040
*/
4141
public static final int CT_INDEX = CT_SINGLE + 5;// HanYu Pinyin
4242

43+
/**
44+
* 中文数字
45+
*/
46+
public static final int CT_CNUM = CT_SINGLE + 6;
47+
4348
/**
4449
* 其他
4550
*/
@@ -59,7 +64,8 @@ public static int charType(String str)
5964
{
6065
if (str != null && str.length() > 0)
6166
{
62-
if ("零○〇一二两三四五六七八九十廿百千万亿壹贰叁肆伍陆柒捌玖拾佰仟".contains(str)) return CT_NUM;
67+
if ("零○〇一二两三四五六七八九十廿百千万亿壹贰叁肆伍陆柒捌玖拾佰仟".contains(str)) return CT_CNUM;
68+
System.out.println("lijian");
6369
byte[] b;
6470
try
6571
{

0 commit comments

Comments
 (0)