hafas-client icon indicating copy to clipboard operation
hafas-client copied to clipboard

Collect (And Remove) Prefixes in Train Names

Open nixmeer opened this issue 4 years ago • 5 comments

Hello. For some time, the MMM-PublicTransportHafas on my magic mirror displays ugly train names. Instead of "S3", it now says "ABR S3" which tells me the train is being operated by a private company named abellio.

This issue is about collecting trains and connections that have this issue to parse them (I guess)

nixmeer avatar Mar 26 '20 20:03 nixmeer

I see two ways to tackle this:

  1. Manually maintain a list a list of rules (e.g. /^abr\s+/i -> ''). Will be easy to implement, but a lot of work to maintain.
  2. attempt to clean the line names using context (line.operator, OpenStreetMap, Wikidata, etc). Will likely be complex and "heavy" (require many dependencies, pull a lot of data, etc).

Probably both will be need to achieve reasonable coverage; @juliuste implemented this combination for DB station names, let's do the same with line names.

For Germany/Deutsche Bahn for example, this logic is useful far beyond the scope of hafas-client, so I'd like to do this in a separate repo which db-hafas. Let's create a repo for this and compile a list there!

derhuerst avatar Mar 27 '20 17:03 derhuerst

Ok, so what’s the Plan Right now? Where and how to help?

For the list part: it might be easier to work backwards and take a look at the private team operators and check which of these do have their own prefix. Wikipedia provides a long list. It might miss some operators but is still a good source

nixmeer avatar Apr 06 '20 19:04 nixmeer

For the list part: it might be easier to work backwards and take a look at the private team operators and check which of these do have their own prefix. Wikipedia provides a long list. It might miss some operators but is still a good source

Sure, if you want to help, start a list with prefixes! Your contribution is appreciated!

For each prefix, note down a link to their Wikipedia page, website or at least a name of the operator.

derhuerst avatar Apr 06 '20 20:04 derhuerst

At the DB Reiseauskunft, I could confirm the use of the following prefixes:

At the same time, I can confirm that the following operators operate connections without such prefixes:

That's it for now.

nixmeer avatar May 02 '20 09:05 nixmeer

@derhuerst what's up next? when do you expect to implement the list?

nixmeer avatar May 13 '20 09:05 nixmeer