Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

分词结果缺失 #79

Open
day210 opened this issue Jun 19, 2023 · 1 comment
Open

分词结果缺失 #79

day210 opened this issue Jun 19, 2023 · 1 comment

Comments

@day210
Copy link

day210 commented Jun 19, 2023

不知道是因为忽略了停止词还是什么原因,会丢失结果,比如"批量处理"的分词结果只有"处理"这个词,"自动提交"的结果也只有"提交",然而在调试分词结果的网页里测试是正常的。

@IZ-ONE
Copy link

IZ-ONE commented Aug 26, 2024

我也发现了同样的问题,例如输入: select * from to_tsvector('testzhcfg', '我将沉入超凡的黑暗')
却返回了 : '沉入':1 '黑暗':2
按理来说超凡应该是形容词,不应该被当做停用词被过滤掉。

我尝试执行调试命令: ts_debug('testzhcfg', '我将沉入超凡的黑暗')
image

注意结果中'超凡'单词所在的行,它被当做了一个未知词,别名是 x (并且字典那一列是空,没有匹配到可用字典)。
再来看看示例中提供的配置命令 ALTER TEXT SEARCH CONFIGURATION testzhcfg ADD MAPPING FOR n,v,a,i,e,l WITH simple
其中对 只n,v,a,i,e,l 六种词做了映射,使用了simple字典。但并没有包含 x (停用词),这导致了x (停用词) 在处理时匹配不到可用的字典。可以使用select ts_token_type('zhparser') 查看有哪些类型的词

也就是说再ADD MAPPING时加上这个 x (停用词)就解决了这个问题 (不过这不固定,你得使用ts_debug确认那个没有被切分出来的词是什么类型,然后把这个加入到mapping里)。但是这样可能会引入那些不需要的词,我不确定这样做会有什么问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants