Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73183

Re: Python's re module and genealogy problem

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <simon@bleah.co.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'languages.': 0.04; 'subject:Python': 0.06; 'expressions': 0.07; 'mentioned,': 0.07; 'problem:': 0.07; 'string': 0.09; '[1]:': 0.09; '[2]:': 0.09; '[3]:': 0.09; 'mentions': 0.09; 'references,': 0.09; 'spelled': 0.09; 'subject:module': 0.09; 'language.': 0.14; 'aiming': 0.16; 'expressions,': 0.16; 'fuzzy': 0.16; 'intersection': 0.16; 'wrote:': 0.18; "python's": 0.19; 'header:User-Agent:1': 0.23; 'subject:problem': 0.24; 'decide': 0.24; '(see': 0.26; 'purposes': 0.26; 'header:In-Reply-To:1': 0.27; 'matching': 0.30; 'url:wiki': 0.31; 'names.': 0.31; 'sets.': 0.31; 'url:wikipedia': 0.31; 'probably': 0.32; 'supposed': 0.32; 'regular': 0.32; 'another': 0.32; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'module.': 0.36; 'similar': 0.36; 'url:org': 0.36; 'two': 0.37; 'represent': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'algorithms': 0.60; 'truly': 0.60; 'url:about': 0.61; 'back': 0.62; 'more': 0.64; 'mail.': 0.69; 'received:109': 0.72; 'received:btcentralplus.com': 0.84
User-Agent Kaiten Mail
In-Reply-To <bvr01iFu926U1@mid.individual.net>
References <bvr01iFu926U1@mid.individual.net>
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Content-Type text/plain; charset=UTF-8
Subject Re: Python's re module and genealogy problem
From Simon Ward <simon@bleah.co.uk>
Date Wed, 11 Jun 2014 18:21:26 +0100
To python-list@python.org
X-Spam-Flag NO
X-Spam-Score -2.9
X-Spam-Level --
X-Spam-Report No, score=-2.9 required=5.0 tests=ALL_TRUSTED, BAYES_00 autolearn=ham version=3.3.2
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11017.1402508398.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1402508398 news.xs4all.nl 2966 [2001:888:2000:d::a6]:39820
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73183

Show key headers only | View raw



On 11 June 2014 13:23:14 BST, BrJohan <brjohan@gmail.com> wrote:
>For some genealogical purposes I consider using Python's re module.
>
>Rather many names can be spelled in a number of similar ways, and in 
>order to match names even if they are spelled differently, I will build
>
>regular expressions, each of which is supposed to match  a number of 
>similar names.

As has been mentioned, you probably want to look at fuzzy matching algorithms rather than aiming at regular expressions, although a quick search suggests there has been some work on fuzzy matching with regular expressions[1].

>Now, my problem: Is there a way to decide whether any two - or more -
>of 
>those regular expressions will match the same string?

If your regexes are truly regular expressions (see [2]*) then they represent regular languages[3], which are really sets. The intersection of these,  is another regular language. If you test the string against this it will also match both original languages.

(*this only mentions back references, but I think the look-ahead/behind assertions are also non-regular)

[1]: http://laurikari.net/tre/about/
[2]: https://en.wikipedia.org/wiki/Regular_expression#Patterns_for_non-regular_languages
[3]: https://en.wikipedia.org/wiki/Regular_language

Simon
-- 
Sent from Kaiten Mail. Please excuse my brevity.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python's re module and genealogy problem BrJohan <brjohan@gmail.com> - 2014-06-11 14:23 +0200
  Re: Python's re module and genealogy problem Robert Kern <robert.kern@gmail.com> - 2014-06-11 14:26 +0100
    Re: Python's re module and genealogy problem Mark H Harris <harrismh777@gmail.com> - 2014-06-11 09:08 -0500
  Re: Python's re module and genealogy problem Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-06-11 15:55 +0200
  Re: Python's re module and genealogy problem Michael Torrie <torriem@gmail.com> - 2014-06-11 09:34 -0600
  Re: Python's re module and genealogy problem Nick Cash <nick.cash@npcinternational.com> - 2014-06-11 16:21 +0000
  Re: Python's re module and genealogy problem Simon Ward <simon@bleah.co.uk> - 2014-06-11 18:21 +0100
  Re: Python's re module and genealogy problem Vlastimil Brom <vlastimil.brom@gmail.com> - 2014-06-11 20:09 +0200
  Re: Python's re module and genealogy problem BrJohan <brjohan@gmail.com> - 2014-06-13 17:17 +0200
    Re: Python's re module and genealogy problem Peter Otten <__peter__@web.de> - 2014-06-13 18:26 +0200
    Re: Python's re module and genealogy problem Dan Sommers <dan@tombstonezero.net> - 2014-06-14 05:14 +0000
  Re: Python's re module and genealogy problem Tony the Tiger <tony@tiger.invalid> - 2014-06-14 08:35 +0000

csiph-web