Open amalgame21 opened 1 year ago
Hi,
'2021年蝴 蝶图标HanLPv2.1为生产环境带来次世代最先进的多语种Neuro-linguistic programming技术。'
会被分作['2021年', '蝴 蝶', '图标', 'HanLPv2.1', '为', '生产', '环境', '带来', '次世代', '最', '先进', '的', '多', '语种', 'Neuro-linguistic', 'programming', '技术', '。']
。'Neuro-linguistic programming'
应当分作一个单词,这属于对分词颗粒度看法不同。按照MSR分词标准,英文词组应当被拆开,HanLP的模型很准确。这有点尴尬,我自己写代码,比对原文和分割后的列表,实现了 “还原文本”
Describe the feature and the current behavior/state.
文本的空格(全形和半形)会在tok舍弃
Will this change the current api? How?
不知道
Who will benefit with this feature?
使用简繁转换的人
Are you willing to contribute it (Yes/No):
力有不逮
System information
pip install hanlp
安装Any other info
我主要是想用hanlp来进行文本简繁转换
因为opencc的简繁转换有时会出现问题(例如
只
和隻
的转换) 在其github #224 (comment)的讨论中,看到有人使用HanLP分词再丢给opencc 所以试了一整天,感觉不错 但是因为tok未能保存空格以文本未能成功还原例子
输出为:
Neuro-linguistic programming
两个词中的空格消失了 把这段输出丢给opencc再还原后 就会变成Neuro-linguisticprogramming
因为我编程能力极度有限 现在我只是使用python读取txt档 再像上面那样python的hanlp的tok分词 再使用json.dumps掉进terminal 在terminal用
opencc
进行简繁转换 再使用jq
,sed
等工具还原文本或者有没有什么更有效的分词简繁转换方法? 谢谢!