Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abbreviations should have explicit case-sensitive or insensitive search option #232

Open
yuryleb opened this issue Mar 27, 2018 · 2 comments

Comments

@yuryleb
Copy link
Contributor

yuryleb commented Mar 27, 2018

Documentation for new Abbreviations stuff has following note:

The keys are in lowercase, to aid in case-insensitive matching

But Russian street names should be processed case-sensitively so as Russian status names are always in lower-case to distinct them from given names. Also some 'status names' could also be 'given names' in some cases like Набережная улица where first word could mean Embankment status name or just Seafront Street as here.

Please also look at other "multi-status" Russian streets collection prepared by streetmangler project.

Maybe it's better to explicitly add some meta block to abbreviation JSONs similar to other JSON files with a 'case sensitive' : true/false option?

@1ec5
Copy link
Member

1ec5 commented Mar 28, 2018

Now that we’re using JSON instead of the CSV format from mapbox-navigation-ios, we can introduce more data that allows clients to match words more contextually. Besides case sensitivity, some languages like English would benefit from a property that says whether the word is a prefix or suffix. That way the client doesn’t have to make assumptions about the role of classifications versus directions, for example.

Does the abbreviation customarily retain the same case as the spelled-out word? If so, we could document that the client is expected to preserve the case as it abbreviates a word. The logic would look something like this:

token = token.replace(wordRegExp, function (word) {
  let abbreviatedWord = abbreviations[word];
  if (word != word.toLowerCase()) {
    abbreviatedWord = capitalizeFirstLetter(abbreviatedWord);
  }
  return abbreviatedWord;
});

/cc @danpaz

@yuryleb
Copy link
Contributor Author

yuryleb commented Mar 28, 2018

No, I meant Набережная улица should be abbreviated as Набережная ул. not Наб. ул. 😉 But набережная Кутузова should be наб. Кутузова.

That's it's just enough to process abbreviations as is that's case-sensitively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants