The repository contains hunspell dictionaries for several languages listed below.
Here the example of installation of the english dictionary:
$ git clone https://github.com/postgrespro/hunspell_dicts
$ cd hunspell_dicts/hunspell_en_us
$ make USE_PGXS=1 install
$ make USE_PGXS=1 installcheck
$ psql DB -c "CREATE EXTENSION hunspell_en_us;"
Important: Don't forget to set the
PG_CONFIG
variable in case you want to test dictionaries on a custom build of PostgreSQL. Read more here.
After the installation you can use english dictionary and configuration:
=> SELECT ts_lexize('english_hunspell', 'stories');
ts_lexize
-----------
{story}
(1 row)
=> SELECT to_tsvector('english_hunspell', 'stories');
to_tsvector
-------------
'story':1
(1 row)
If you want to create a dictionary which isn't listed below, you may want to download necessary OpenOffice or LibreOffice extension.
Then you need to do the following (from the documentation):
iconv -f ISO_8859-1 -t UTF-8 -o nn_no.affix nn_NO.aff
iconv -f ISO_8859-1 -t UTF-8 -o nn_no.dict nn_NO.dic
CREATE TEXT SEARCH DICTIONARY norwegian_hunspell (
TEMPLATE = ispell,
DictFile = nn_no,
AffFile = nn_no,
StopWords = norwegian
);
The modules introduce the following dictionaries and configurations:
Module | Dictionary/Configuration |
---|---|
hunspell_cs_cz | czech_hunspell |
hunspell_de_de | german_hunspell |
hunspell_en_us | english_hunspell |
hunspell_fr | french_hunspell |
hunspell_ne_np | nepali_hunspell |
hunspell_nl_nl | dutch_hunspell |
hunspell_nn_no | norwegian_hunspell |
hunspell_pt_pt | portuguese_hunspell |
hunspell_ru_ru | russian_hunspell |
hunspell_ru_ru_aot | russian_aot_hunspell |