From 64def09592535dc043741fb46f16eb37e152d90f Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Tue, 11 Sep 2007 11:54:42 +0000 Subject: Add regression tests for ispell, synonym and thesaurus dictionaries. Rename synonym.syn.sample and thesaurs.ths.sample to synonym_sample.syn and thesaurs_sample.ths accordingly to be able to use they in regression test. Ispell dictionary uses synthetic simple dictionary files. --- src/backend/tsearch/Makefile | 5 +++-- src/backend/tsearch/hunspell_sample.affix | 24 ++++++++++++++++++++++++ src/backend/tsearch/ispell_sample.affix | 26 ++++++++++++++++++++++++++ src/backend/tsearch/ispell_sample.dict | 8 ++++++++ src/backend/tsearch/synonym.syn.sample | 3 --- src/backend/tsearch/synonym_sample.syn | 4 ++++ src/backend/tsearch/thesaurus.ths.sample | 20 -------------------- src/backend/tsearch/thesaurus_sample.ths | 18 ++++++++++++++++++ 8 files changed, 83 insertions(+), 25 deletions(-) create mode 100644 src/backend/tsearch/hunspell_sample.affix create mode 100644 src/backend/tsearch/ispell_sample.affix create mode 100644 src/backend/tsearch/ispell_sample.dict delete mode 100644 src/backend/tsearch/synonym.syn.sample create mode 100644 src/backend/tsearch/synonym_sample.syn delete mode 100644 src/backend/tsearch/thesaurus.ths.sample create mode 100644 src/backend/tsearch/thesaurus_sample.ths (limited to 'src/backend') diff --git a/src/backend/tsearch/Makefile b/src/backend/tsearch/Makefile index d5076ef18d4..720a5366677 100644 --- a/src/backend/tsearch/Makefile +++ b/src/backend/tsearch/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 2006-2007, PostgreSQL Global Development Group # -# $PostgreSQL: pgsql/src/backend/tsearch/Makefile,v 1.2 2007/08/22 06:11:56 tgl Exp $ +# $PostgreSQL: pgsql/src/backend/tsearch/Makefile,v 1.3 2007/09/11 11:54:42 teodor Exp $ # #------------------------------------------------------------------------- subdir = src/backend/tsearch @@ -13,7 +13,8 @@ include $(top_builddir)/src/Makefile.global DICTDIR=tsearch_data -DICTFILES=synonym.syn.sample thesaurus.ths.sample +DICTFILES=synonym_sample.syn thesaurus_sample.ths hunspell_sample.affix \ + ispell_sample.affix ispell_sample.dict OBJS = ts_locale.o ts_parse.o wparser.o wparser_def.o dict.o \ dict_simple.o dict_synonym.o dict_thesaurus.o \ diff --git a/src/backend/tsearch/hunspell_sample.affix b/src/backend/tsearch/hunspell_sample.affix new file mode 100644 index 00000000000..d1984c295fb --- /dev/null +++ b/src/backend/tsearch/hunspell_sample.affix @@ -0,0 +1,24 @@ +COMPOUNDFLAG Z +ONLYINCOMPOUND L + +PFX B Y 1 +PFX B 0 re . + +PFX U N 1 +PFX U 0 un . + +SFX J Y 1 +SFX J 0 INGS [^E] + +SFX G Y 1 +SFX G 0 ING [^E] + +SFX S Y 1 +SFX S 0 S [^SXZHY] + +SFX A Y 1 +SFX A Y IES [^AEIOU]Y + +SFX \ N 1 +SFX \ 0 Y/L [^Y] + diff --git a/src/backend/tsearch/ispell_sample.affix b/src/backend/tsearch/ispell_sample.affix new file mode 100644 index 00000000000..f29004ff1da --- /dev/null +++ b/src/backend/tsearch/ispell_sample.affix @@ -0,0 +1,26 @@ +compoundwords controlled Z + +prefixes + +flag *B: + . > RE # As in enter > reenter + +flag U: + . > UN # As in natural > unnatural + +suffixes + +flag *J: + [^E] > INGS # As in cross > crossings + +flag *G: + [^E] > ING # As in cross > crossing + +flag *S: + [^SXZHY] > S # As in bat > bats + +flag *A: + [^AEIOU]Y > -Y,IES # As in imply > implies + +flag ~\\: + [^Y] > Y #~ advarsel > advarsely- diff --git a/src/backend/tsearch/ispell_sample.dict b/src/backend/tsearch/ispell_sample.dict new file mode 100644 index 00000000000..44df1967a6c --- /dev/null +++ b/src/backend/tsearch/ispell_sample.dict @@ -0,0 +1,8 @@ +book/GJUS +booking/SB +footballklubber +foot/ZS +football/Z +ball/SZ\ +klubber/Z +sky/A diff --git a/src/backend/tsearch/synonym.syn.sample b/src/backend/tsearch/synonym.syn.sample deleted file mode 100644 index fdccca102b4..00000000000 --- a/src/backend/tsearch/synonym.syn.sample +++ /dev/null @@ -1,3 +0,0 @@ -skies sky -booking book -bookings book diff --git a/src/backend/tsearch/synonym_sample.syn b/src/backend/tsearch/synonym_sample.syn new file mode 100644 index 00000000000..4e2eaeec0c1 --- /dev/null +++ b/src/backend/tsearch/synonym_sample.syn @@ -0,0 +1,4 @@ +postgres pgsql +postgresql pgsql +postgre pgsql +gogle googl diff --git a/src/backend/tsearch/thesaurus.ths.sample b/src/backend/tsearch/thesaurus.ths.sample deleted file mode 100644 index 7e7702e2ae4..00000000000 --- a/src/backend/tsearch/thesaurus.ths.sample +++ /dev/null @@ -1,20 +0,0 @@ -# -# Theasurus config file. Character ':' separates string from replacement, eg -# sample-words : substitute-words -# -# Any substitute-word can be marked by preceding '*' character, -# which means do not lexize this word -# Docs: http://www.sai.msu.su/~megera/oddmuse/index.cgi/Thesaurus_dictionary - -one two three : *123 -one two : *12 -one : *1 -two : *2 - -#foo bar : blah blah -#f bar : fbar -#e bar : ebar -#g bar bar : gbarbar -#asd:sdffff -#qwerty:qwer wert erty - diff --git a/src/backend/tsearch/thesaurus_sample.ths b/src/backend/tsearch/thesaurus_sample.ths new file mode 100644 index 00000000000..b83d8f1452a --- /dev/null +++ b/src/backend/tsearch/thesaurus_sample.ths @@ -0,0 +1,18 @@ +# +# Theasurus config file. Character ':' separates string from replacement, eg +# sample-words : substitute-words +# +# Any substitute-word can be marked by preceding '*' character, +# which means do not lexize this word +# Docs: http://www.sai.msu.su/~megera/oddmuse/index.cgi/Thesaurus_dictionary + +one two three : *123 +one two : *12 +one : *1 +two : *2 + +supernovae stars : *sn +supernovae : *sn +booking tickets : order invitation cards +booking the tickets : order invitation Cards + -- cgit v1.2.3