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


Groups > comp.lang.python > #73170

Re: Python's re module and genealogy problem

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'algorithm': 0.04; 'subject:Python': 0.06; 'expressions': 0.07; 'problem:': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'spelled': 0.09; 'subject:module': 0.09; 'url:github': 0.09; 'translate': 0.10; 'python': 0.11; 'anyways,': 0.16; 'approaches.': 0.16; 'decision,': 0.16; 'expressions,': 0.16; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'library': 0.18; "python's": 0.19; 'this?': 0.23; 'header :User-Agent:1': 0.23; 'interpret': 0.24; 'subject:problem': 0.24; 'decide': 0.24; 'purposes': 0.26; 'least': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'matching': 0.30; 'robert': 0.30; 'url:wiki': 0.31; 'names.': 0.31; 'anyone': 0.31; 'this.': 0.32; 'probably': 0.32; 'supposed': 0.32; 'regular': 0.32; 'guess': 0.33; 'possible.': 0.35; 'there': 0.35; 'module.': 0.36; 'possible': 0.36; 'similar': 0.36; 'url:org': 0.36; 'should': 0.36; 'two': 0.37; 'implement': 0.38; 'to:addr :python-list': 0.38; 'rather': 0.38; 'little': 0.38; 'expect': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'expression': 0.60; 'is.': 0.60; 'most': 0.60; 'new': 0.61; 'such': 0.63; 'decided': 0.64; 'our': 0.64; 'more': 0.64; 'different': 0.65; 'world': 0.66; 'believe': 0.68; 'yes': 0.68; 'stated': 0.69; 'differently:': 0.84; 'eco': 0.84; 'terrible': 0.84; 'hundred': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robert Kern <robert.kern@gmail.com>
Subject Re: Python's re module and genealogy problem
Date Wed, 11 Jun 2014 14:26:42 +0100
References <bvr01iFu926U1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 213.1.240.226
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <bvr01iFu926U1@mid.individual.net>
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.11008.1402493220.18130.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1402493220 news.xs4all.nl 2895 [2001:888:2000:d::a6]:60747
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73170

Show key headers only | View raw


On 2014-06-11 13:23, BrJohan 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.
>
> I guess that there will be a few hundred such regular expressions covering most
> popular names.
>
> Now, my problem: Is there a way to decide whether any two - or more - of those
> regular expressions will match the same string?
>
> Or, stated a little differently:
>
> Can it, for a pair of regular expressions be decided whether at least one string
> matching both of those regular expressions, can be constructed?
>
> If it is possible to make such a decision, then how? Anyone aware of an
> algorithm for this?

And if that isn't the best straight line for the old saying, I don't know what is.

   http://en.wikiquote.org/wiki/Jamie_Zawinski

Anyways, to your new problem, yes it's possible. Search for "regular expression 
intersection" for possible approaches. You will probably have to translate the 
regular expression to a different formalism or at least a different library to 
implement this.

Consider just listing out the different possibilities. All of your regexes 
should be "well-behaved" given the constraints of the domain (tightly bounded, 
at least). There are tools that help generate matching strings from a Python 
regex. This will help you QA your regexes, too, to be sure that they match what 
you expect them to and not match non-names.

   https://github.com/asciimoo/exrex

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

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