Changeset 5299ace in osmose-backend


Ignore:
Timestamp:
Feb 8, 2014 12:36:31 PM (6 years ago)
Author:
Jocelyn Jaubert <jocelyn.jaubert@…>
Branches:
master
Children:
7e0bc56
Parents:
f18b68f
git-author:
Jocelyn Jaubert <jocelyn.jaubert@…> (03/02/2014 00:04:52)
git-committer:
Jocelyn Jaubert <jocelyn.jaubert@…> (08/02/2014 12:36:31)
Message:

Switch to dmetaphone() instead of fn_soundex2() in non-french language

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • README

    r3775255 r5299ace  
    4343 
    4444 
    45 The local postgresql database should be configured with postgis extensions, and 
    46 the following parameters changed in osmose_config.py: 
     45The local postgresql database should be configured in osmose_config.py: 
    4746 
    4847  - db_base = database name 
     
    5049  - db_password = database password 
    5150 
     51The following postgresql extensions should be enabled: 
     52  postgis 
     53  fuzzymatchstr 
    5254 
    5355Connection to the "official" frontend at http://osmose.openstreetmap.fr 
  • analysers/analyser_osmosis_soundex.py

    ra6719c9 r5299ace  
    2424from Analyser_Osmosis import Analyser_Osmosis 
    2525 
    26 sql01 = u""" 
     26sql01_fr = u""" 
    2727-- http://www-lium.univ-lemans.fr/~carlier/recherche/soundex.html 
    2828-- 
     
    143143""" 
    144144 
    145 sql02 = u""" 
     145sql02_fr = u""" 
    146146DROP FUNCTION IF EXISTS FN_UTF82ASCII(name VARCHAR (1024)); 
    147147 
     
    160160SELECT 
    161161    id AS way_id, 
    162     fn_soundex2(ways.tags -> 'name') AS phonic_all, 
     162    {0}(ways.tags -> 'name') AS phonic_all, 
    163163    substring(ways.tags -> 'name' for position(' ' in ways.tags -> 'name')-1) AS name_1, 
    164     fn_soundex2(substring(ways.tags -> 'name' for position(' ' in ways.tags -> 'name')-1)) AS phonic_1, 
     164    {0}(substring(ways.tags -> 'name' for position(' ' in ways.tags -> 'name')-1)) AS phonic_1, 
    165165    substring(ways.tags -> 'name' from position(' ' in ways.tags -> 'name')+1) AS name_2oo, 
    166     fn_soundex2(substring(ways.tags -> 'name' from position(' ' in ways.tags -> 'name')+1)) AS phonic_2oo 
     166    {0}(substring(ways.tags -> 'name' from position(' ' in ways.tags -> 'name')+1)) AS phonic_2oo 
    167167FROM 
    168168    ways 
     
    247247 
    248248    def analyser_osmosis(self): 
    249         self.run(sql01) 
    250         self.run(sql02) 
    251         self.run(sql03) 
     249        if self.config.options["language"] == "fr": 
     250            self.run(sql01_fr) 
     251            self.run(sql02_fr) 
     252            self.run(sql03.format("fn_soundex2")) 
     253        else: 
     254            self.run(sql03.format("dmetaphone")) 
    252255        self.run(sql03i) 
    253256        self.run(sql04) 
Note: See TracChangeset for help on using the changeset viewer.