Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Text search dictionary template for translation

NotificationsYou must be signed in to change notification settings

za-arthur/dict_translate

Repository files navigation

This dictionary normalizes input word into lexems and replaces them with groupsof their translations.

Installation

Here the example of installation of the module:

$ git clone https://github.com/select-artur/dict_translate$ cd dict_translate$ make USE_PGXS=1$ sudo make USE_PGXS=1 install$ make USE_PGXS=1 installcheck$ psql DB -c "CREATE EXTENSION dict_translate;"

Usage

You can use this template in the following way.

Create the file $SHAREDIR/tsearch_data/test_trn.trn:

$ forest wald forst holz$ home haus heim

Create text search dictionary and configuration:

=> CREATETEXT SEARCH DICTIONARY test_trn ( Template=translate, DictFile= test_trn, InputDict=pg_catalog.english_stem);=> CREATETEXT SEARCH CONFIGURATION test_cfg(COPY='simple');=> ALTERTEXT SEARCH CONFIGURATION test_cfg ALTER MAPPING FOR asciiword, asciihword, hword_asciipart,   word, hword, hword_part WITH test_trn, english_stem;

You can test this dictionary using this table:

=> CREATE TABLE test (ttext);=>INSERT INTO testVALUES ('homes'), ('home'), ('forest'), ('haus');

Query examples:

=>SELECT*FROM testWHERE to_tsvector('test_cfg', t) @@ to_tsquery('test_cfg','forests');   t--------forest(1 row)=>SELECT*FROM testWHERE to_tsvector('test_cfg', t) @@ to_tsquery('test_cfg','home');   t------- homes home haus(3 rows)

About

Text search dictionary template for translation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp