Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id BCF91B5DBDA for ; Wed, 25 May 2011 19:21:17 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 01508-03 for ; Wed, 25 May 2011 22:21:10 +0000 (UTC) X-Greylist: delayed 00:05:19.402762 by SQLgrey-1.7.6 Received: from mail-vw0-f46.google.com (mail-vw0-f46.google.com [209.85.212.46]) by mail.postgresql.org (Postfix) with ESMTP id 30881B5DBBF for ; Wed, 25 May 2011 19:21:10 -0300 (ADT) Received: by vws1 with SMTP id 1so111252vws.19 for ; Wed, 25 May 2011 15:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2qPJYdKl06bLBckd3T/2uuTyejV9bKDqPWft/ILUeIs=; b=Hzi7K+MZKMzVlkRftgirDvmmYyecPnqfdRoeni/FBth1LcR1S+maG5ZBENlrc+3YeF A9N6lkVeZz76sPWD5LbgcNU4MbIJ4o1HRmqeZV2KPjO/Es/w1X6aVstw+jL0pfpIDh50 3znrx4G4+i/0XcFD4kv9ol/GD5XItv4rHx8jc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=xlVt6IIH18K5tYAoEFJvW1wbo4aoITG8VPb3TZxUnpinprA5oId03/9yksQM4sif6q tEI/6wLyid3uMuAv+QStw10q8e/vmIfoHKwat+b2kw+oh7+4+rfpzlhCp8S4QReejrF3 tyi33SYOjY54dOTPdgGmwDdu8yjkqHbLAP5oo= MIME-Version: 1.0 Received: by 10.52.175.197 with SMTP id cc5mr116251vdc.287.1306361750528; Wed, 25 May 2011 15:15:50 -0700 (PDT) Received: by 10.52.161.2 with HTTP; Wed, 25 May 2011 15:15:50 -0700 (PDT) In-Reply-To: <20110525221342.14e34046@dick.coachhouse> References: <20110522210526.0f8b66fa@dick.coachhouse> <20110522230041.28d1bc35@dick.coachhouse> <4DD9BB87.7070000@postnewspapers.com.au> <20110523163341.56edb1aa@dick.coachhouse> <4DDD1F7C.5040008@gmail.com> <20110525221342.14e34046@dick.coachhouse> Date: Thu, 26 May 2011 10:15:50 +1200 Message-ID: Subject: Re: extracting location info from string From: Andrej To: Tarlika Elisabeth Schmitz Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/161 X-Sequence-Number: 35445 On 26 May 2011 09:13, Tarlika Elisabeth Schmitz wrote: > On Wed, 25 May 2011 09:25:48 -0600 > Rob Sargent wrote: > >> >> >>On 05/24/2011 10:57 AM, Lew wrote: >>> Tarlika Elisabeth Schmitz wrote: >>> >>>> CREATE TABLE person >>>> ( >>>> id integer NOT NULL, >>>> "name" character varying(256) NOT NULL, >>>> "location" character varying(256), >>>> CONSTRAINT person_pkey PRIMARY KEY (id) >>>> ); >>>> >>>> this was just a TEMPORARY table I created for quick analysis >>>> of my CSV data (now renamed to temp_person). > > CREATE TABLE country > ( > =A0id character varying(3) NOT NULL, -- alpha-3 code > =A0"name" character varying(50) NOT NULL, > =A0CONSTRAINT country_pkey PRIMARY KEY (id) > ); > > >>To minimize the ultimately quite necessary human adjudication, one >>might make good use of what is often termed "crowd sourcing": =A0Keep >>all the distinct "hand entered" values and a map to the final human >>assessment. > > I was wondering how to do just that. I don't think it would be a good > idea to hard code this into the clean-up script. Take, for instance, > variations of COUNTRY.NAME spelling. Where would I store these? > > I could do with a concept for this problem, which applies to a lot of > string-type info. I'd start w/ downloading a list as mentioned here: http://answers.google.com/answers/threadview?id=3D596822 And run it through a wee perl script using http://search.cpan.org/~maurice/Text-DoubleMetaphone-0.07/DoubleMetaphone.p= m to make phonetic matches ... Then I'd run your own data through DoubleMetaphone, and clean up matches if not too many false positives show up. Cheers, Andrej