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 1mlCgA-0008Jp-0i for pgsql-novice@arkaria.postgresql.org; Thu, 11 Nov 2021 16:11:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mlCg8-0001HR-Vz for pgsql-novice@arkaria.postgresql.org; Thu, 11 Nov 2021 16:11:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlCg8-0001HG-NE for pgsql-novice@lists.postgresql.org; Thu, 11 Nov 2021 16:11:56 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mlCg6-0000vG-2h for pgsql-novice@lists.postgresql.org; Thu, 11 Nov 2021 16:11:55 +0000 Received: by mail-wr1-x431.google.com with SMTP id d3so10653920wrh.8 for ; Thu, 11 Nov 2021 08:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=7X0OPqNkFDRCjCfJMty1Y5OI3BepqXrmDazqEiJu7ks=; b=U5C6U+WSQUljUeBUvITMVvs6x6txOLUIghkQs0XRkDYjyTyY1Ms1FEt+8MFpuKnDT8 Tp6ykzaAdcQbWZW8yfaam5Js+J5EdN1XucbunSt5jg119vmSR5bPvJFTTht8jmr2grL/ TjtfWwMVQ6X6xKitLazXVJSS1wRZANn1u8U5FWmKXos3cTQhy1N30KjpVJndCyynUErv PY3inC6Es4THHEkItKj63XpSgUsynkkzWZwrglYZp1oFRBT6/zAAiD85yFES4DygU8AW OmRqbkR4Y4rPaw1W/PvHlz8mPOvOGuWRkOAEYZN0Glp+c9O0+hBMQWpJ21mKbpi3sWbq NaLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=7X0OPqNkFDRCjCfJMty1Y5OI3BepqXrmDazqEiJu7ks=; b=mUnHLrmtjrBQZHEa9HC77EDRA5GjiQ4neriAh7n03ybZvdTdFCxobvNK8IQb6J+XG4 omYJ0X/5a5R7x6Z1m+BbMhtgNFeIDY+j7edHwTlaui3IxUVWoG3DxcUKm9OmlgTedi/L coNOozj65eROE1UUraeXjjLAS5QdTCJbjfsrn28ASn7KZTW4NveLrz6mlcPeQYA/AL9r fBtsO3U7ikVShLYEaaiMerA+eaa6nXaRePOIhWjQVCzJBhFQA3t7yI/JeiizT0AdwKUw V7mNHzqlmepNacjFLm59mLbkHQNukbQ3QabjcDwb6k933FVFOR81NBxe5wquANShPOTM f85Q== X-Gm-Message-State: AOAM531Sru0cs1sXu0PoDpgXYQxjGABKiph3CYTRDQyGlpXG6BsNIqzE fLjCOXvhRE4KQUf7k3lV5CfcXFnHFmnMmw== X-Google-Smtp-Source: ABdhPJwPKw/lXRtEb7cVfqsXOCvQ7QJ7y5OgE6uC4KFPxdLCaNrKqsxjVr+DGm4qx2e9EGx9/6xp5g== X-Received: by 2002:adf:ef52:: with SMTP id c18mr10359714wrp.162.1636647112152; Thu, 11 Nov 2021 08:11:52 -0800 (PST) Received: from localhost.localdomain (dynamic-e1c0z20vi57wuq8r0-pd01.res.v6.highway.a1.net. [2001:871:5c:68d2:a027:6e5c:8e66:bccc]) by smtp.gmail.com with ESMTPSA id l11sm3214498wrp.61.2021.11.11.08.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 08:11:51 -0800 (PST) Message-ID: <773cc2b745a9cf18e9bebbdb4b32d8077c6d4ee4.camel@cybertec.at> Subject: Re: Phonetic representation LENGHT for DMETAPHONE, is there a way to make it longer? From: Laurenz Albe To: Jean Baro , pgsql-novice@lists.postgresql.org Date: Thu, 11 Nov 2021 17:11:50 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2021-11-11 at 11:26 -0300, Jean Baro wrote: > Please, I am working on a PoC for Real-time Person Identification, and one of the critical > aspects of it is to support both minor misspelling and phonetic variations of First, Middle, and Last name. > Like HarinGton == HarrinBton or RaphEAl == RafAEl. It's working for longer names, > but it's a bit more imprecise for names like Lee and John. I am using Double Metaphone through dmetaphone() and > dmetaphone_alt() in PostgreSQL 13.3 (Supabase.io). And although I appreciate Double Metaphone > it returns a (too?) short string as the phonetic representation compared to metaphone(string, length). > metaphone() has parameters to make the resulting phonetic representation longer. > I investigated dmetaphone() and couldn't find anything other than the default function. Is there a way of making > dmetaphone() and dmetaphone_alt() return a longer phonetic representation similar to metaphone()'s, but with a ALT variation?.  These functions focus on phonetic similarity. There are no other variants of these functions, but perhaps pattern matching (which focuses on spelling, *not* phonetics) can help: CREATE EXTENSION pg_trgm; -- now you can use the "similar to" operator SELECT * FROM tab WHERE name % 'lorenz'; Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com