Skip to content

Commit 020050f

Browse files
author
Artur Zakirov
committed
Modified documentation for dictionary modules
1 parent c275d54 commit 020050f

File tree

10 files changed

+306
-222
lines changed

10 files changed

+306
-222
lines changed
Lines changed: 69 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,77 @@
11
CREATE EXTENSION hunspell_en_us;
22
CREATE TABLE table1(name varchar);
3-
INSERT INTO table1 VALUES ('stories'), ('traveled'), ('eaten'),
4-
('Saturdays'), ('healthcare'), ('generally'),
5-
('integrating'), ('lankiness'), ('rewritten');
6-
SELECT ts_lexize('public.english_hunspell', name) FROM table1;
7-
ts_lexize
8-
-------------------
9-
{story}
10-
{traveled,travel}
11-
{eaten,eat}
12-
{saturday}
13-
{healthcare}
14-
{general}
15-
{integrate}
16-
{lankiness,lanky}
17-
{written}
18-
(9 rows)
3+
INSERT INTO table1 VALUES ('leaves'), ('leaved'), ('leaving'),
4+
('inability'), ('abilities'), ('disability'), ('ability');
5+
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.english', t.name) AS d;
6+
alias | description | token | dictionaries | dictionary | lexemes
7+
-----------+-----------------+------------+---------------------------------+------------------+-----------
8+
asciiword | Word, all ASCII | leaves | {english_hunspell,english_stem} | english_hunspell | {leave}
9+
asciiword | Word, all ASCII | leaved | {english_hunspell,english_stem} | english_hunspell | {leave}
10+
asciiword | Word, all ASCII | leaving | {english_hunspell,english_stem} | english_hunspell | {leave}
11+
asciiword | Word, all ASCII | inability | {english_hunspell,english_stem} | english_hunspell | {ability}
12+
asciiword | Word, all ASCII | abilities | {english_hunspell,english_stem} | english_hunspell | {ability}
13+
asciiword | Word, all ASCII | disability | {english_hunspell,english_stem} | english_hunspell | {ability}
14+
asciiword | Word, all ASCII | ability | {english_hunspell,english_stem} | english_hunspell | {ability}
15+
(7 rows)
1916

2017
CREATE INDEX name_idx ON table1 USING GIN (to_tsvector('public.english', "name"));
21-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.english', t.name) AS d;
22-
alias | description | token | dictionaries | dictionary | lexemes
23-
-----------+-----------------+-------------+---------------------------------+------------------+-------------------
24-
asciiword | Word, all ASCII | stories | {english_hunspell,english_stem} | english_hunspell | {story}
25-
asciiword | Word, all ASCII | traveled | {english_hunspell,english_stem} | english_hunspell | {traveled,travel}
26-
asciiword | Word, all ASCII | eaten | {english_hunspell,english_stem} | english_hunspell | {eaten,eat}
27-
asciiword | Word, all ASCII | Saturdays | {english_hunspell,english_stem} | english_hunspell | {saturday}
28-
asciiword | Word, all ASCII | healthcare | {english_hunspell,english_stem} | english_hunspell | {healthcare}
29-
asciiword | Word, all ASCII | generally | {english_hunspell,english_stem} | english_hunspell | {general}
30-
asciiword | Word, all ASCII | integrating | {english_hunspell,english_stem} | english_hunspell | {integrate}
31-
asciiword | Word, all ASCII | lankiness | {english_hunspell,english_stem} | english_hunspell | {lankiness,lanky}
32-
asciiword | Word, all ASCII | rewritten | {english_hunspell,english_stem} | english_hunspell | {written}
33-
(9 rows)
18+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
19+
@@ to_tsquery('public.english', 'leaving');
20+
name
21+
---------
22+
leaves
23+
leaved
24+
leaving
25+
(3 rows)
26+
27+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
28+
@@ to_tsquery('public.english', 'abilities');
29+
name
30+
------------
31+
inability
32+
abilities
33+
disability
34+
ability
35+
(4 rows)
36+
37+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
38+
@@ to_tsquery('public.english', 'ability');
39+
name
40+
------------
41+
inability
42+
abilities
43+
disability
44+
ability
45+
(4 rows)
3446

3547
DROP INDEX name_idx;
3648
CREATE INDEX name_idx ON table1 USING GIST (to_tsvector('public.english', "name"));
37-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.english', t.name) AS d;
38-
alias | description | token | dictionaries | dictionary | lexemes
39-
-----------+-----------------+-------------+---------------------------------+------------------+-------------------
40-
asciiword | Word, all ASCII | stories | {english_hunspell,english_stem} | english_hunspell | {story}
41-
asciiword | Word, all ASCII | traveled | {english_hunspell,english_stem} | english_hunspell | {traveled,travel}
42-
asciiword | Word, all ASCII | eaten | {english_hunspell,english_stem} | english_hunspell | {eaten,eat}
43-
asciiword | Word, all ASCII | Saturdays | {english_hunspell,english_stem} | english_hunspell | {saturday}
44-
asciiword | Word, all ASCII | healthcare | {english_hunspell,english_stem} | english_hunspell | {healthcare}
45-
asciiword | Word, all ASCII | generally | {english_hunspell,english_stem} | english_hunspell | {general}
46-
asciiword | Word, all ASCII | integrating | {english_hunspell,english_stem} | english_hunspell | {integrate}
47-
asciiword | Word, all ASCII | lankiness | {english_hunspell,english_stem} | english_hunspell | {lankiness,lanky}
48-
asciiword | Word, all ASCII | rewritten | {english_hunspell,english_stem} | english_hunspell | {written}
49-
(9 rows)
49+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
50+
@@ to_tsquery('public.english', 'leaving');
51+
name
52+
---------
53+
leaves
54+
leaved
55+
leaving
56+
(3 rows)
57+
58+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
59+
@@ to_tsquery('public.english', 'abilities');
60+
name
61+
------------
62+
inability
63+
abilities
64+
disability
65+
ability
66+
(4 rows)
67+
68+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
69+
@@ to_tsquery('public.english', 'ability');
70+
name
71+
------------
72+
inability
73+
abilities
74+
disability
75+
ability
76+
(4 rows)
5077

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
CREATE EXTENSION hunspell_en_us;
22

33
CREATE TABLE table1(name varchar);
4-
INSERT INTO table1 VALUES ('stories'), ('traveled'), ('eaten'),
5-
('Saturdays'), ('healthcare'), ('generally'),
6-
('integrating'), ('lankiness'), ('rewritten');
4+
INSERT INTO table1 VALUES ('leaves'), ('leaved'), ('leaving'),
5+
('inability'), ('abilities'), ('disability'), ('ability');
76

8-
SELECT ts_lexize('public.english_hunspell', name) FROM table1;
7+
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.english', t.name) AS d;
98

109
CREATE INDEX name_idx ON table1 USING GIN (to_tsvector('public.english', "name"));
11-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.english', t.name) AS d;
10+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
11+
@@ to_tsquery('public.english', 'leaving');
12+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
13+
@@ to_tsquery('public.english', 'abilities');
14+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
15+
@@ to_tsquery('public.english', 'ability');
1216

1317
DROP INDEX name_idx;
1418
CREATE INDEX name_idx ON table1 USING GIST (to_tsvector('public.english', "name"));
15-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.english', t.name) AS d;
19+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
20+
@@ to_tsquery('public.english', 'leaving');
21+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
22+
@@ to_tsquery('public.english', 'abilities');
23+
SELECT * FROM table1 WHERE to_tsvector('public.english', name)
24+
@@ to_tsquery('public.english', 'ability');
Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
CREATE EXTENSION hunspell_fr;
22
CREATE TABLE table1(name varchar);
3-
INSERT INTO table1 VALUES ('beau'), ('antérieur'), ('fraternel'),
4-
('plaît'), ('comprends'), ('désolée'),
5-
('cents'), ('grammairiens'), ('résistèrent'),
6-
('derniers'), ('rapprochent');
7-
SELECT ts_lexize('public.french_hunspell', name) FROM table1;
8-
ts_lexize
9-
-----------------
10-
{beau}
11-
{antérieure}
12-
{fraternelle}
13-
{plaire}
14-
{comprendre}
15-
{désoler}
16-
{cent}
17-
{grammairienne}
18-
{résister}
19-
{dernière}
20-
{rapprocher}
21-
(11 rows)
3+
INSERT INTO table1 VALUES ('batifoler'), ('batifolant'), ('batifole'), ('batifolait'),
4+
('consentant'), ('consentir'), ('consentiriez');
5+
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.french', t.name) AS d;
6+
alias | description | token | dictionaries | dictionary | lexemes
7+
-----------+-----------------+--------------+-------------------------------+-----------------+-------------------------
8+
asciiword | Word, all ASCII | batifoler | {french_hunspell,french_stem} | french_hunspell | {batifoler}
9+
asciiword | Word, all ASCII | batifolant | {french_hunspell,french_stem} | french_hunspell | {batifolante,batifoler}
10+
asciiword | Word, all ASCII | batifole | {french_hunspell,french_stem} | french_hunspell | {batifoler}
11+
asciiword | Word, all ASCII | batifolait | {french_hunspell,french_stem} | french_hunspell | {batifoler}
12+
asciiword | Word, all ASCII | consentant | {french_hunspell,french_stem} | french_hunspell | {consentante,consentir}
13+
asciiword | Word, all ASCII | consentir | {french_hunspell,french_stem} | french_hunspell | {consentir}
14+
asciiword | Word, all ASCII | consentiriez | {french_hunspell,french_stem} | french_hunspell | {consentir}
15+
(7 rows)
2216

2317
CREATE INDEX name_idx ON table1 USING GIN (to_tsvector('public.french', "name"));
24-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.french', t.name) AS d;
25-
alias | description | token | dictionaries | dictionary | lexemes
26-
-----------+-------------------+--------------+-------------------------------+-----------------+-----------------
27-
asciiword | Word, all ASCII | beau | {french_hunspell,french_stem} | french_hunspell | {beau}
28-
word | Word, all letters | antérieur | {french_hunspell,french_stem} | french_hunspell | {antérieure}
29-
asciiword | Word, all ASCII | fraternel | {french_hunspell,french_stem} | french_hunspell | {fraternelle}
30-
word | Word, all letters | plaît | {french_hunspell,french_stem} | french_hunspell | {plaire}
31-
asciiword | Word, all ASCII | comprends | {french_hunspell,french_stem} | french_hunspell | {comprendre}
32-
word | Word, all letters | désolée | {french_hunspell,french_stem} | french_hunspell | {désoler}
33-
asciiword | Word, all ASCII | cents | {french_hunspell,french_stem} | french_hunspell | {cent}
34-
asciiword | Word, all ASCII | grammairiens | {french_hunspell,french_stem} | french_hunspell | {grammairienne}
35-
word | Word, all letters | résistèrent | {french_hunspell,french_stem} | french_hunspell | {résister}
36-
asciiword | Word, all ASCII | derniers | {french_hunspell,french_stem} | french_hunspell | {dernière}
37-
asciiword | Word, all ASCII | rapprochent | {french_hunspell,french_stem} | french_hunspell | {rapprocher}
38-
(11 rows)
18+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
19+
@@ to_tsquery('public.french', 'batifolant');
20+
name
21+
------------
22+
batifoler
23+
batifolant
24+
batifole
25+
batifolait
26+
(4 rows)
27+
28+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
29+
@@ to_tsquery('public.french', 'consentiriez');
30+
name
31+
--------------
32+
consentant
33+
consentir
34+
consentiriez
35+
(3 rows)
3936

4037
DROP INDEX name_idx;
4138
CREATE INDEX name_idx ON table1 USING GIST (to_tsvector('public.french', "name"));
42-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.french', t.name) AS d;
43-
alias | description | token | dictionaries | dictionary | lexemes
44-
-----------+-------------------+--------------+-------------------------------+-----------------+-----------------
45-
asciiword | Word, all ASCII | beau | {french_hunspell,french_stem} | french_hunspell | {beau}
46-
word | Word, all letters | antérieur | {french_hunspell,french_stem} | french_hunspell | {antérieure}
47-
asciiword | Word, all ASCII | fraternel | {french_hunspell,french_stem} | french_hunspell | {fraternelle}
48-
word | Word, all letters | plaît | {french_hunspell,french_stem} | french_hunspell | {plaire}
49-
asciiword | Word, all ASCII | comprends | {french_hunspell,french_stem} | french_hunspell | {comprendre}
50-
word | Word, all letters | désolée | {french_hunspell,french_stem} | french_hunspell | {désoler}
51-
asciiword | Word, all ASCII | cents | {french_hunspell,french_stem} | french_hunspell | {cent}
52-
asciiword | Word, all ASCII | grammairiens | {french_hunspell,french_stem} | french_hunspell | {grammairienne}
53-
word | Word, all letters | résistèrent | {french_hunspell,french_stem} | french_hunspell | {résister}
54-
asciiword | Word, all ASCII | derniers | {french_hunspell,french_stem} | french_hunspell | {dernière}
55-
asciiword | Word, all ASCII | rapprochent | {french_hunspell,french_stem} | french_hunspell | {rapprocher}
56-
(11 rows)
39+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
40+
@@ to_tsquery('public.french', 'batifolant');
41+
name
42+
------------
43+
batifoler
44+
batifolant
45+
batifole
46+
batifolait
47+
(4 rows)
48+
49+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
50+
@@ to_tsquery('public.french', 'consentiriez');
51+
name
52+
--------------
53+
consentant
54+
consentir
55+
consentiriez
56+
(3 rows)
5757

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
CREATE EXTENSION hunspell_fr;
22

33
CREATE TABLE table1(name varchar);
4-
INSERT INTO table1 VALUES ('beau'), ('antérieur'), ('fraternel'),
5-
('plaît'), ('comprends'), ('désolée'),
6-
('cents'), ('grammairiens'), ('résistèrent'),
7-
('derniers'), ('rapprochent');
4+
INSERT INTO table1 VALUES ('batifoler'), ('batifolant'), ('batifole'), ('batifolait'),
5+
('consentant'), ('consentir'), ('consentiriez');
86

9-
SELECT ts_lexize('public.french_hunspell', name) FROM table1;
7+
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.french', t.name) AS d;
108

119
CREATE INDEX name_idx ON table1 USING GIN (to_tsvector('public.french', "name"));
12-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.french', t.name) AS d;
10+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
11+
@@ to_tsquery('public.french', 'batifolant');
12+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
13+
@@ to_tsquery('public.french', 'consentiriez');
1314

1415
DROP INDEX name_idx;
1516
CREATE INDEX name_idx ON table1 USING GIST (to_tsvector('public.french', "name"));
16-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.french', t.name) AS d;
17+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
18+
@@ to_tsquery('public.french', 'batifolant');
19+
SELECT * FROM table1 WHERE to_tsvector('public.french', name)
20+
@@ to_tsquery('public.french', 'consentiriez');
Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,54 @@
11
CREATE EXTENSION hunspell_nl_nl;
22
CREATE TABLE table1(name varchar);
3-
INSERT INTO table1 VALUES ('klimmen'), ('zitten'), ('dragen'),
4-
('mooie'), ('boekje'), ('ouders'), ('deuren'),
5-
('uitbetalen'), ('achtentwintig');
6-
SELECT ts_lexize('public.dutch_hunspell', name) FROM table1;
7-
ts_lexize
8-
------------------
9-
{klimmen,klim}
10-
{zitten,zit}
11-
{dragen,draag}
12-
{mooi}
13-
{boek,boeg}
14-
{ouder,oud}
15-
{deur}
16-
{betalen,betaal}
17-
{twintig}
18-
(9 rows)
3+
INSERT INTO table1 VALUES ('deuren'), ('deurtje'), ('deur'),
4+
('twee'), ('tweehonderd'), ('tweeduizend');
5+
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.dutch', t.name) AS d;
6+
alias | description | token | dictionaries | dictionary | lexemes
7+
-----------+-----------------+-------------+-----------------------------+----------------+---------
8+
asciiword | Word, all ASCII | deuren | {dutch_hunspell,dutch_stem} | dutch_hunspell | {deur}
9+
asciiword | Word, all ASCII | deurtje | {dutch_hunspell,dutch_stem} | dutch_hunspell | {deur}
10+
asciiword | Word, all ASCII | deur | {dutch_hunspell,dutch_stem} | dutch_hunspell | {deur}
11+
asciiword | Word, all ASCII | twee | {dutch_hunspell,dutch_stem} | dutch_hunspell | {twee}
12+
asciiword | Word, all ASCII | tweehonderd | {dutch_hunspell,dutch_stem} | dutch_hunspell | {twee}
13+
asciiword | Word, all ASCII | tweeduizend | {dutch_hunspell,dutch_stem} | dutch_hunspell | {twee}
14+
(6 rows)
1915

2016
CREATE INDEX name_idx ON table1 USING GIN (to_tsvector('public.dutch', "name"));
21-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.dutch', t.name) AS d;
22-
alias | description | token | dictionaries | dictionary | lexemes
23-
-----------+-----------------+---------------+-----------------------------+----------------+------------------
24-
asciiword | Word, all ASCII | klimmen | {dutch_hunspell,dutch_stem} | dutch_hunspell | {klimmen,klim}
25-
asciiword | Word, all ASCII | zitten | {dutch_hunspell,dutch_stem} | dutch_hunspell | {zitten,zit}
26-
asciiword | Word, all ASCII | dragen | {dutch_hunspell,dutch_stem} | dutch_hunspell | {dragen,draag}
27-
asciiword | Word, all ASCII | mooie | {dutch_hunspell,dutch_stem} | dutch_hunspell | {mooi}
28-
asciiword | Word, all ASCII | boekje | {dutch_hunspell,dutch_stem} | dutch_hunspell | {boek,boeg}
29-
asciiword | Word, all ASCII | ouders | {dutch_hunspell,dutch_stem} | dutch_hunspell | {ouder,oud}
30-
asciiword | Word, all ASCII | deuren | {dutch_hunspell,dutch_stem} | dutch_hunspell | {deur}
31-
asciiword | Word, all ASCII | uitbetalen | {dutch_hunspell,dutch_stem} | dutch_hunspell | {betalen,betaal}
32-
asciiword | Word, all ASCII | achtentwintig | {dutch_hunspell,dutch_stem} | dutch_hunspell | {twintig}
33-
(9 rows)
17+
SELECT * FROM table1 WHERE to_tsvector('public.dutch', name)
18+
@@ to_tsquery('public.dutch', 'deurtje');
19+
name
20+
---------
21+
deuren
22+
deurtje
23+
deur
24+
(3 rows)
25+
26+
SELECT * FROM table1 WHERE to_tsvector('public.dutch', name)
27+
@@ to_tsquery('public.dutch', 'twee');
28+
name
29+
-------------
30+
twee
31+
tweehonderd
32+
tweeduizend
33+
(3 rows)
3434

3535
DROP INDEX name_idx;
3636
CREATE INDEX name_idx ON table1 USING GIST (to_tsvector('public.dutch', "name"));
37-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.dutch', t.name) AS d;
38-
alias | description | token | dictionaries | dictionary | lexemes
39-
-----------+-----------------+---------------+-----------------------------+----------------+------------------
40-
asciiword | Word, all ASCII | klimmen | {dutch_hunspell,dutch_stem} | dutch_hunspell | {klimmen,klim}
41-
asciiword | Word, all ASCII | zitten | {dutch_hunspell,dutch_stem} | dutch_hunspell | {zitten,zit}
42-
asciiword | Word, all ASCII | dragen | {dutch_hunspell,dutch_stem} | dutch_hunspell | {dragen,draag}
43-
asciiword | Word, all ASCII | mooie | {dutch_hunspell,dutch_stem} | dutch_hunspell | {mooi}
44-
asciiword | Word, all ASCII | boekje | {dutch_hunspell,dutch_stem} | dutch_hunspell | {boek,boeg}
45-
asciiword | Word, all ASCII | ouders | {dutch_hunspell,dutch_stem} | dutch_hunspell | {ouder,oud}
46-
asciiword | Word, all ASCII | deuren | {dutch_hunspell,dutch_stem} | dutch_hunspell | {deur}
47-
asciiword | Word, all ASCII | uitbetalen | {dutch_hunspell,dutch_stem} | dutch_hunspell | {betalen,betaal}
48-
asciiword | Word, all ASCII | achtentwintig | {dutch_hunspell,dutch_stem} | dutch_hunspell | {twintig}
49-
(9 rows)
37+
SELECT * FROM table1 WHERE to_tsvector('public.dutch', name)
38+
@@ to_tsquery('public.dutch', 'deurtje');
39+
name
40+
---------
41+
deuren
42+
deurtje
43+
deur
44+
(3 rows)
45+
46+
SELECT * FROM table1 WHERE to_tsvector('public.dutch', name)
47+
@@ to_tsquery('public.dutch', 'twee');
48+
name
49+
-------------
50+
twee
51+
tweehonderd
52+
tweeduizend
53+
(3 rows)
5054

0 commit comments

Comments
 (0)