-
Notifications
You must be signed in to change notification settings - Fork 318
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
Limit interpret-as=address to numbers in road names #552
Conversation
What if the street is named This is symptomatic of a broader issue we have with Polly, which is that it keeps trying to expand abbreviations even though abbreviations are already expanded in OpenStreetMap. Can you look into whether there’s a way to specify in SSML that abbreviation expansion should be disabled? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably roll back #418, since it was address
that was causing parentheses to be read aloud.
/ref #286 (comment)
MapboxCoreNavigation/String.swift
Outdated
@@ -52,4 +52,8 @@ extension String { | |||
var isUppercased: Bool { | |||
return self == uppercased() && self != lowercased() | |||
} | |||
|
|||
var isInt: Bool { | |||
return Int(self) != nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will miss route numbers like NY 120A
, in which 120A
should be wrapped in interpret-as="address"
in order to say “one-twenty a” instead of “one hundred twenty a”. How about wrapping a word in address
if it contains a digit?
let refComponents = value.addingXMLEscapes.components(separatedBy: .whitespaces) | ||
guard var firstRefComponent = refComponents.first else { return value.asSSMLAddress } | ||
case .wayName, .destination, .rotaryName, .code: | ||
let stringComponents = value.addingXMLEscapes.components(separatedBy: .whitespaces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this will miss any codes like A-35
. OSM tagging conventions call for a space, as in I 35
, but I do see some other regions using hyphens. We could harden this code by enumerating the string with String.enumerateSubstrings(in:options:_:)
and byWord
, or with String.replacingOccurrences(of:with:options:range:)
and regularExpression
.
@1ec5 current code produces something like given the names above:
|
link to mp3: https://cloudup.com/c_X5YsKdCFh |
MapboxCoreNavigation/String.swift
Outdated
@@ -52,4 +52,8 @@ extension String { | |||
var isUppercased: Bool { | |||
return self == uppercased() && self != lowercased() | |||
} | |||
|
|||
var containsInt: Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: containsDecimalDigit
would be more accurate.
Came across a case where polly speaks
N Street NW
asNorth Street NW
. The if-first-word-in-ref code we had in place for refs should also be applied to.wayName, .destination, .rotaryName
./cc @ericrwolfe @frederoni @1ec5