rebuild_metaphones

32 views
Skip to first unread message

Kevin Galligan

unread,
Feb 8, 2010, 9:08:38 AM2/8/10
to GeoCommons Geocoder
I'm plugging along here and making steady progress on getting things
set up. I have built the c++ code, installed ruby, the gems "Text"
package, and downloaded and installed the ruby-sqlite3 code (I cloned
the git instead of using the gem installer).

I downloaded Delaware, and imported that. My db file comes out to
about 21 meg.

So, when I try to run the metaphones, I get an error about opening the
db...

kevin@kevin-ubuntu-hp:~/devel_git/geocoder$ bin/rebuild_metaphones /
home/kevin/temp/tiger/geocoder.db
/usr/local/lib/site_ruby/1.8/sqlite3/errors.rb:62:in `check': could
not open database: unable to open database file
(SQLite3::CantOpenException)
from /usr/local/lib/site_ruby/1.8/sqlite3/database.rb:79:in
`initialize'
from bin/rebuild_metaphones:7:in `new'
from bin/rebuild_metaphones:7

The file exists, and that's the right path. Any thoughts?

Thanks in advance.

Kevin Galligan

unread,
Feb 8, 2010, 1:00:22 PM2/8/10
to GeoCommons Geocoder
I figured that out. There's a hard reference to the database in the
code. It doesn't use the argument passed in. The offending line can
be fixed as follows...

@db = SQLite3::Database.new(ARGV[0])

Now I'm on to the crazy lat/lon values. I searched for something in
Delaware, and it seems to find the record, but then gives really wide
lat/lon values. for example:

p db.geocode("120 East Market Street, Georgetown, DE")
[{:state=>"DE", :fips_county=>"10005", :score=>0.902, :lon=>972.628262, :zip=>"19947", :lat=>754.739879, :city=>"Georgetown", :number=>"120", :street=>"E
Market St", :precision=>:range, :prenum=>""}]

There's another discussion of this elsewhere. Considering it finds
the range/st record, its got to be a relatively simple issue
(hopefully).

-Kevin

Kate Chapman

unread,
Feb 8, 2010, 1:04:12 PM2/8/10
to geocommon...@googlegroups.com
Sorry about that.

If people find things like this and submit patches I will add them to the repo.

-Kate

Donald Harter

unread,
Feb 24, 2011, 6:32:28 AM2/24/11
to geocommon...@googlegroups.com
I am just getting started on this.   I did the fix for the hard coded database file.
But I get this when I run the command:
bin/rebuild_metaphones /mnt/opt/tiger/geocoder.db
/usr/lib64/ruby/site_ruby/1.8/sqlite3/errors.rb:62:in `check': no such table: place (SQLite3::SQLException)
        from /usr/lib64/ruby/site_ruby/1.8/sqlite3/statement.rb:39:in `initialize'
        from /usr/lib64/ruby/site_ruby/1.8/sqlite3/database.rb:154:in `new'
        from /usr/lib64/ruby/site_ruby/1.8/sqlite3/database.rb:154:in `prepare'
        from /usr/lib64/ruby/site_ruby/1.8/sqlite3/database.rb:181:in `execute'
        from bin/rebuild_metaphones:21
I have built the indexes but did not cluster the database.

Here is what I get when I run the tests:
Finished in 0.185562 seconds.

  1) Failure:
test_international_place(TestDatabase)
    [./tests/database.rb:80:in `test_international_place'
     ./tests/database.rb:75:in `each'
     ./tests/database.rb:75:in `test_international_place']:
<0> expected but was
<1>.

  2) Failure:
test_sample(TestDatabase)
    [./tests/database.rb:95:in `test_sample'
     ./tests/database.rb:91:in `each'
     ./tests/database.rb:91:in `test_sample'
     /usr/lib64/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1545:in `each'
     /usr/lib64/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1048:in `foreach'
     /usr/lib64/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1222:in `open'
     /usr/lib64/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1047:in `foreach'
     ./tests/database.rb:87:in `test_sample']:
row: #<FasterCSV::Row "address":"93 NORTH 9TH STREET, BROOKLYN NY 11211" "number":"93" "street":"N 9th St" "city":"Brooklyn" "state":"NY" "zip":"11211" "lon":"-73.95892" "lat":"40.720361" "count":"1" "comment":nil>
field: "lon" sample: -73.95892, given: -764.169184.
<-73.95892> expected but was
<-764.169184>.

30 tests, 231 assertions, 2 failures, 0 errors

Reply all
Reply to author
Forward
0 new messages