Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pCScm-00045u-4R for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Jan 2023 21:45:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pCScj-0007jm-W0 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Jan 2023 21:45:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pCScj-0007jd-It for pgsql-hackers@lists.postgresql.org; Mon, 02 Jan 2023 21:45:37 +0000 Received: from sid.nimrod.no ([2001:8c0:9340:1::2]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pCSch-00037k-7D for pgsql-hackers@lists.postgresql.org; Mon, 02 Jan 2023 21:45:36 +0000 Received: from sid.nimrod.no (sid.nimrod.no [195.139.160.2]) by sid.nimrod.no (8.14.7/8.14.7) with ESMTP id 302Kh1OA009021; Mon, 2 Jan 2023 21:43:01 +0100 DKIM-Filter: OpenDKIM Filter v2.11.0 sid.nimrod.no 302Kh1OA009021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nimrod.no; s=n20181209; t=1672692182; bh=T6a/BmCA8oqFzlGyFYUe0p8y+GBgNkgDvh9dX8d/3eg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=HvQ9wk/yXHO9DIiQSgxCWZ4/trmrhDIQf0lGJXXlf+9gnMbBcUEyn2JQzsNEfm8qS rnEfOUgphCmWR96KVhr9zAKC/F4G4JurslrZRVNL8YXk7h1n+2FlYy33tDw0Gc9HLq CFcGQp4NBiq0OCCNNOPKn1o58aigXzOaXuU9BwKkcXV+xYHkoTMcTdIHSsgg6nzsIS nzEKNr5JKW8sfzFmsjvqaYVtDXiYd6H1NBFPmQoylavAkQy+DoYstPz64HOEd5lden 5lL12vX4pXYWQidYsfXyGeMX65fvdZcnA9qxHgJ1TWKOnBu5H/+eVfBM2lx0DmPI+p H3xAC4Y1GO5JA== From: Dag Lem To: Alvaro Herrera Cc: PostgreSQL Hackers Subject: Re: daitch_mokotoff module Organization: Nimrod References: <20221225130136.oyfh5jcw3xxkvq34@alvherre.pgsql> Date: Mon, 02 Jan 2023 21:43:01 +0100 In-Reply-To: <20221225130136.oyfh5jcw3xxkvq34@alvherre.pgsql> (Alvaro Herrera's message of "Sun, 25 Dec 2022 14:01:36 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > Hello > > On 2022-Dec-23, Dag Lem wrote: > [...] > So, yes, I'm proposing that we returns those as array elements and that > @> is used to match them. Looking into the array operators I guess that to match such arrays directly one would actually use && (overlaps) rather than @> (contains), but I digress. The function is changed to return an array of soundex codes - I hope it is now to your liking :-) I also improved on the documentation example (using Full Text Search). AFAIK you can't make general queries like that using arrays, however in any case I must admit that text arrays seem like more natural building blocks than space delimited text here. Search to perform is the best match for Daitch-Mokotoff, however , but in any case I've changed it into return arrays now. I hope it is to your liking. > >> Daitch-Mokotoff Soundex indexes alternative sounds for the same name, >> however if I understand correctly, you want to index names by single >> sounds, linking all alike sounding names to the same soundex code. I >> fail to see how that is useful - if you want to find matches for a name, >> you simply match against all indexed names. If you only consider one >> sound, you won't find all names that match. > > Hmm, I think we're saying the same thing, but from opposite points of > view. No, I want each name to return multiple codes, but that those > multiple codes can be treated as a multiple-value array of codes, rather > than as a single string of space-separated codes. > >> In any case, as explained in the documentation, the implementation is >> intended to be a companion to Full Text Search, thus text is the natural >> representation for the soundex codes. > > Hmm, I don't agree with this point. The numbers are representations of > the strings, but they don't necessarily have to be strings themselves. > > >> BTW Vera 790000 does not match Veras 794000, because they don't sound >> the same (up to the maximum soundex code length). > > No, and maybe that's okay because they have different codes. But they > are both similar, in Daitch-Mokotoff, to Borja, which has two codes, > 790000 and 794000. (Any Spanish speaker will readily tell you that > neither Vera nor Veras are similar in any way to Borja, but D-M has > chosen to say that each of them matches one of Borjas' codes. So they > *are* related, even though indirectly, and as a genealogist you *may* be > interested in getting a match for a person called Vera when looking for > relatives to a person called Veras. And, as a Spanish speaker, that > would make a lot of sense to me.) > > > Now, it's true that I've chosen to use Spanish names for my silly little > experiment. Maybe this isn't terribly useful as a practical example, > because this algorithm seems to have been designed for Jew surnames and > perhaps not many (or not any) Jews had Spanish surnames. I don't know; > I'm not a Jew myself (though Noah Gordon tells the tale of a Spanish Jew > called Josep =C3=81lvarez in his book "The Winemaker", so I guess it's not > impossible). Anyway, I suspect if you repeat the experiment with names > of other origins, you'll find pretty much the same results apply there, > and that is the whole reason D-M returns multiple codes and not just > one. > > > Merry Christmas :-) --=20 Dag