Re: making tsearch2 dictionaries - Mailing list pgsql-general

From Ben
Subject Re: making tsearch2 dictionaries
Date
Msg-id 1076916535.20254.10.camel@purple
Whole thread Raw
In response to making tsearch2 dictionaries  (Ben <bench@silentmedia.com>)
Responses Re: making tsearch2 dictionaries
List pgsql-general
Okay, so I was actually able to answer this question on my own, in a
manner of speaking. It seems the way to do this is to merely return a
larger char** array, with one element for each word. But I was having
trouble with postgres crashing, because (I think) it tries to free each
element independently before using all of them. I had set each element
to a different null-terminated chunk of the same palloc'd memory
segment. Having never written C stored procs before, I take it that's
bad practice?

Anyway, now that this is working, my next question is: can I take the
lexemes from one dictionary lookup and pipe them into another
dictionary? I see that I can have redundant dictionaries, such that if
lexemes aren't found in one it'll try another, but that's not quite the
same.

For instance, the en_stem dictionary converts "hundred" into "hundr".
Right now, my dictionary converts "100" into "one" and "hundred", but
I'd like it to filter both one and hundred through the en_stem
dictionary to arrive at "one" and "hundr".

It also occurs to me I could pipe things through an ispell dictionary
and be able to handle misspellings....

On Sun, 2004-02-15 at 15:35, Ben wrote:
> I'm trying to make myself a dictionary for tsearch2 that converts
> numbers to their english word equivalents. This seems to be working
> great, except that I can't figure out how to make my lexize function
> return multiple lexemes. For instance, I'd like "100" to get converted
> to {one,hundred}, not {"one hundred"} as is currently happening.
>
> How do I specify the output of the lexize function so that this will
> happen?


pgsql-general by date:

Previous
From: Ben
Date:
Subject: making tsearch2 dictionaries
Next
From: Carlos Ojea Castro
Date:
Subject: Re: Connect to PostgreSQL with kylix3