删除没有在postgresql中产生的停用词 [英] remove stop words without stemming in postgresql
本文介绍了删除没有在postgresql中产生的停用词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从我的数据中删除停用词,但我不想干这些词,因为确切的词对我来说很重要。
我使用了这个查询。
从tblName中选择to_tsvector('english',colName)order by lower asc;
是否有任何方法可以删除停用词而不会阻止单词?
感谢
解决方案创建您自己的文本搜索字典和配置:
CREATE TEXT SEARCH DICTIONARY simple_english
(TEMPLATE = pg_catalog.simple,STOPWORDS = english);
CREATE TEXT SEARCH CONFIGURATION simple_english
(copy = english);
更改文本搜索配置simple_english
更改asciihword,asciiword,hword,hword_asciipart,hword_part,word
与simple_english的映射关系;
它可以这样工作:
SELECT to_tsvector('simple_english','许多牛吃房子');
┌───────────────────────────────────────────────┐
│to_tsvector│
├───────────────────────────────────────────────
│'吃':4'房屋':5'许多':1'牛':3│
└──────────────────────────────────── ───────────┘
(1 row)
您可以设置参数 default_text_search_config
为 simple_english
,使其成为默认的文本搜索配置。
I want to remove the stop words from my data but I do not want to stem the words since the exact words matters to me. I used this query.
SELECT to_tsvector('english',colName)from tblName order by lower asc;
Is there any way that I can remove stopWords without stemming the words?
thanks
解决方案
Create your own text search dictionary and configuration:
CREATE TEXT SEARCH DICTIONARY simple_english
(TEMPLATE = pg_catalog.simple, STOPWORDS = english);
CREATE TEXT SEARCH CONFIGURATION simple_english
(copy = english);
ALTER TEXT SEARCH CONFIGURATION simple_english
ALTER MAPPING FOR asciihword, asciiword, hword, hword_asciipart, hword_part, word
WITH simple_english;
It works like this:
SELECT to_tsvector('simple_english', 'many an ox eats the houses');
┌─────────────────────────────────────┐
│ to_tsvector │
├─────────────────────────────────────┤
│ 'eats':4 'houses':5 'many':1 'ox':3 │
└─────────────────────────────────────┘
(1 row)
You can set the parameter default_text_search_config
to simple_english
to make it your default text search configuration.
这篇关于删除没有在postgresql中产生的停用词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文