ts_lexize() 是一个系统函数,用于返回指定词典已知词元的替代词元数组。
ts_lexize() 添加于 PostgreSQL 8.3。
用法
ts_lexize (dictregdictionary,tokentext) →text[]
如果词元已知于词典但是一个停用词,则返回空数组;如果不是已知词元,则返回 NULL。
ts_lexize() 主要用于测试词典。
变更历史
- PostgreSQL 8.3
- 添加(提交 140d4ebc)
示例
ts_lexize() 的基本用法示例
postgres=# SELECT ts_lexize('english_stem', 'foxes');
ts_lexize
-----------
{fox}
(1 row)
停用词返回空数组
postgres=# SELECT ts_lexize('english_stem', 'the');
ts_lexize
-----------
{}
(1 row)
如果词元不是已知词元,则返回 NULL
postgres=# CREATE TEXT SEARCH DICTIONARY ispell ( template = ispell, dictfile = ispell_sample, afffile = ispell_sample ); CREATE TEXT SEARCH DICTIONARY postgres=# SELECT ts_lexize('ispell', 'yabadabadoo') IS NULL; ?column? ---------- t (1 row)
