ErlendEllingsen / ruter-cli

A command line tool for public transportation in Oslo, Norway
MIT License
45 stars 2 forks source link

Can't disambiguate stations with same name #2

Open olejorgenb opened 8 years ago

olejorgenb commented 8 years ago
$ ruter "Skøyen" "Forskningsparken (oslo)"
--------------------------------
REISEFORSLAG Skøyen -> Forskningsparken (oslo)
------- Forslag #1 -------
Departure:  Tue Nov 01 2016 20:04:00 GMT+0100
Arrival:  Tue Nov 01 2016 20:38:00 GMT+0100

[1]  Skøyen [tog] (20:04) L13 🚆  -> Lillestrøm [tog] (20:24)
[2] 🚶 Walk 00:03:00
[3]  Lillestrøm terminal (20:28) 401 🚌  -> Forskningsparken (20:38)

I'm after "Forskningsparken [T-bane] (Oslo)"

Maybe a ranking of the GetPlaces query result (eg. edit distance, adjusted so that [station type] is only one char) could work. Not sure why Ruter doesn't do that themself though.

Or just provide an option to add a offset in the result list. (an an option to print the list) Ruter's ranking probably doesn't change that often, and if I end up using this tool I'll use the shell history search 90% of the times. So as long as I can get the correct query into history I'm set.

ErlendEllingsen commented 8 years ago

I’ll take a look at this issue, however you can do the following:

ruter "Skøyen" "Forskningsparken T”

This will give you

--------------------------------
REISEFORSLAG Skøyen -> Forskningsparken T
------- Forslag #1 -------
Departure:  Tue Nov 01 2016 20:22:00 GMT+0100
Arrival:  Tue Nov 01 2016 20:39:00 GMT+0100

[1]  Skøyen [tog] (20:22) L22 🚆  -> Nationaltheatret [tog] (20:25)
[2] 🚶 Walk 00:02:38
[3]  Nationaltheatret [T-bane] (20:33) 4 🚇  -> Forskningsparken [T-bane] (20:39)
olejorgenb commented 8 years ago

Thanks, seems like Ruter considers the station type, but not area when ranking the list?

ErlendEllingsen commented 8 years ago

Everything is based on name searches I guess. Their search algorithm is quite smart (hence why it recognises "Forskningsparken [T-bane]" from "Forskningsparken T". I am not unsure wether this solution suits your needs @olejorgenb ?