-
Notifications
You must be signed in to change notification settings - Fork 665
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
Extend roundabout phrases #2378
Conversation
…street names and signs
Added roundabout instructions gurka tests Fixed street name assignemtn in the NarrativeBuilder::FormEnterRoundaboutInstruction method
…rbal phrase blocks. Updated the narrative dictionary and builder for the new phrases. Added named roundabout gurka tests.
…tend_roundabout_phrases
…tend_roundabout_phrases
DirectionsLeg_Maneuver_Type_kDestination}); | ||
int maneuver_index = 1; | ||
|
||
// TODO: known issue - future update to end on a roundabout |
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.
What instruction is announced when you end on a roundabout now?
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.
It has the ordinal exit value included
* @param maneuver_index the specified maneuver index to inspect | ||
* @param expected_instructions the set of four instructions expected in the DirectionsLeg for the | ||
* route at specified maneuver index. | ||
* The four instructions shall be in this order: |
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: how about using an unordered_map instead of a vector so that order doesn't matter?
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.
but then the function call would have more clutter with it - looks nice and simple now:
gurka::assert::raw::expect_instructions_at_maneuver_index(
result, maneuver_index,
{"Enter Dupont Circle and take the 1st exit toward A 95/B 2/München/Kürten.",
"Enter Dupont Circle and take the 1st exit toward A 95.",
"Enter Dupont Circle and take the 1st exit toward A 95, München.", ""});
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.
The downside of using a vector is that the caller needs to know/remember the order in which the items need to be put. Using a hashmap makes it a bit more explicit:
gurka::assert::raw::expect_instructions_at_maneuver_index(
result, maneuver_index,
{{"text", "Enter Dupont Circle and take the 1st exit toward A 95/B 2/München/Kürten."},
{"verbal_transition", "Enter Dupont Circle and take the 1st exit toward A 95."},
{"verbal_pre_transition", "Enter Dupont Circle and take the 1st exit toward A 95, München."},
{"verbal_post_transition", ""}});
But I leave it to you. I guess its okay with vector too. We'll learn the order :)
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.
Let's discuss Monday - we can add an issue to switch it if needed
…tend_roundabout_phrases
… enter_roundabout_verbal, exit_roundabout, exit_roundabout_verbal
…tend_roundabout_phrases
…tend_roundabout_phrases
…tend_roundabout_phrases
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 have only minor comments. Approving it since I don't want to hold you up.
@@ -353,7 +353,21 @@ | |||
"enter_roundabout": { | |||
"phrases": { | |||
"0": "Enter thee Cap'n wheel.", | |||
"1": "Enter thee Cap'n wheel and take th' <ORDINAL_VALUE> spoke." | |||
"1": "Enter thee Cap'n wheel and take th' <ORDINAL_VALUE> spoke.", |
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.
What does ...-x-pirate
mean?
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.
non standard language extension - pirate language narrative FTW 🏴☠️
@@ -353,7 +353,21 @@ | |||
"enter_roundabout": { | |||
"phrases": { | |||
"0": "सर्कल प्रवेश करें.", | |||
"1": "सर्कल प्रवेश करें और <ORDINAL_VALUE> निकास लें." | |||
"1": "सर्कल प्रवेश करें और <ORDINAL_VALUE> निकास लें.", |
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.
Not a comment for this PR, but this caught my eye - spelling out "circle" in Hindi seems a bit odd for roundabout. The colloquial term for traffic circle is "roundabout" (or "Gol Chakkra" in Hindi). Anyway, we dont need to change anything in this PR.
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.
please fix anything that is incorrect
roundabout_exit_begin_street_names_ = std::move(roundabout_exit_begin_street_names); | ||
} | ||
|
||
bool Maneuver::HasRoundaboutExitBeginStreetNames() const { |
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.
Why is this camel-case while the others snake-case? Looking at maneuver.h, it seems like only getters/setters use camel-case? I must say its a strange convention.
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.
when we started we followed the google spec - similar to how protobuf files are
const std::string& delim, | ||
const VerbalTextFormatter* verbal_formatter) const { | ||
std::string guide_string; | ||
if (HasGuideBranch() && HasGuideToward() && ((max_count == 0) || (max_count > 1))) { |
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 dont follow the max_count
check. Since its an unsigned int, it'll always be >0 or >1.
A slightly more concise version of what this function is doing:
std::string guide_string;
if (HasGuideBranch()) {
guide_string += GetGuideBranchString(static_cast<uint32_t>(std::round(max_count / 2)),
limit_by_consecutive_count, delim, verbal_formatter);
if (HasGuideToward())
guide_string += delim;
}
if (HasGuideToward()) {
guide_string +=
GetGuideTowardString(max_count, limit_by_consecutive_count, delim, verbal_formatter);
}
But you can leave it as-is too (except for maybe the max_count
check?)
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.
max_count == 0 means no limit
so this is checking if there is no limit or greater than one
we want to split the max_count between branch and toward
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 get the split, but not the need for the check (((max_count == 0) || (max_count > 1))
is always true). Also std::round
isn't doing anything, since we're using integer division which will return an integer.
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.
A slightly more concise version of what this function is doing:
This is different functionality
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 get the split, but not the need for the check (
((max_count == 0) || (max_count > 1))
is always true).
It is not true if max_count == 1
I was trying to be explicit about either unlimited count or greater than one
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.
Also
std::round
isn't doing anything, since we're using integer division which will return an integer.
@mandeepsandhu good catch - I will fix, thanks
* @param maneuver_index the specified maneuver index to inspect | ||
* @param expected_instructions the set of four instructions expected in the DirectionsLeg for the | ||
* route at specified maneuver index. | ||
* The four instructions shall be in this order: |
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.
The downside of using a vector is that the caller needs to know/remember the order in which the items need to be put. Using a hashmap makes it a bit more explicit:
gurka::assert::raw::expect_instructions_at_maneuver_index(
result, maneuver_index,
{{"text", "Enter Dupont Circle and take the 1st exit toward A 95/B 2/München/Kürten."},
{"verbal_transition", "Enter Dupont Circle and take the 1st exit toward A 95."},
{"verbal_pre_transition", "Enter Dupont Circle and take the 1st exit toward A 95, München."},
{"verbal_post_transition", ""}});
But I leave it to you. I guess its okay with vector too. We'll learn the order :)
Issue
Extend roundabout phrase to include street names and toward signs.
Example#1
Example#2
Example#3
Impacts 49% of routes
Tasklist