Skip to content

Commit

Permalink
Remove London Overground
Browse files Browse the repository at this point in the history
- Remove "London Overground" and replace with the new rebranded individual lines.
- Add "liz" and "lizzy" as synonyms for the Elizabeth Line.
  • Loading branch information
martincostello committed Nov 28, 2024
1 parent dee8e78 commit 0517901
Show file tree
Hide file tree
Showing 8 changed files with 482 additions and 83 deletions.
37 changes: 13 additions & 24 deletions src/LondonTravel.Skill/Lines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ public static bool IsElizabethLine(string name)
return name.Contains("elizabeth", StringComparison.OrdinalIgnoreCase);
}

/// <summary>
/// Returns whether the specified line name refers to the London Overground.
/// </summary>
/// <param name="name">The name of the line as reported from the TfL API.</param>
/// <returns>
/// A boolean indicating whether the line is the London Overground.
/// </returns>
public static bool IsOverground(string name)
{
return name.Contains("overground", StringComparison.OrdinalIgnoreCase);
}

/// <summary>
/// Maps the specified line name to a TfL API line Id.
/// </summary>
Expand All @@ -69,30 +57,30 @@ public static bool IsOverground(string name)
case "dlr":
case "hammersmith-city":
case "jubilee":
case "liberty":
case "lioness":
case "london-overground":
case "metropolitan":
case "mildmay":
case "northern":
case "piccadilly":
case "suffragette":
case "tfl-rail":
case "victoria":
case "waterloo-city":
case "weaver":
case "windrush":
return normalized;

case "crossrail":
case "elizabeth":
case "elizabeth line":
case "liz":
case "liz line":
case "lizzy":
case "lizzy line":
return "elizabeth";

case "london overground":
case "overground":
case "liberty":
case "lioness":
case "mildmay":
case "suffragette":
case "weaver":
case "windrush":
return "london-overground";

case "met":
return "metropolitan";

Expand All @@ -114,6 +102,8 @@ public static bool IsOverground(string name)
case "waterloo & city":
return "waterloo-city";

case "london overground":
case "overground":
default:
return null;
}
Expand All @@ -131,8 +121,7 @@ public static string ToCardTitle(string name)
{
bool isNameWithoutLine =
IsDlr(name) ||
IsElizabethLine(name) ||
IsOverground(name);
IsElizabethLine(name);

string suffix = isNameWithoutLine ? Strings.LineSuffixUpper : string.Empty;
return string.Format(CultureInfo.CurrentCulture, StatusIntentCardTitleFormat, name, suffix);
Expand Down
9 changes: 1 addition & 8 deletions src/LondonTravel.Skill/Verbalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,20 @@ internal static class Verbalizer
/// </returns>
internal static string LineName(string name, bool asTitleCase = false)
{
string prefix = string.Empty;
string prefix = Strings.ThePrefix;
string suffix = string.Empty;
string spokenName;

if (Lines.IsDlr(name))
{
prefix = Strings.ThePrefix;
spokenName = Verbalize("DLR");
}
else if (Lines.IsElizabethLine(name))
{
prefix = Strings.ThePrefix;
spokenName = name;
}
else if (Lines.IsOverground(name))
{
spokenName = name;
}
else
{
prefix = Strings.ThePrefix;
spokenName = name;
suffix = asTitleCase ? Strings.LineSuffixUpper : Strings.LineSuffixLower;
}
Expand Down
44 changes: 36 additions & 8 deletions static/interaction-model.json
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,11 @@
"value": "elizabeth",
"synonyms": [
"crossrail",
"elizabeth line"
"elizabeth line",
"liz",
"liz line",
"lizzie",
"lizzie line"
]
}
},
Expand All @@ -892,17 +896,21 @@
"value": "jubilee"
}
},
{
"name": {
"value": "liberty"
}
},
{
"name": {
"value": "lioness"
}
},
{
"name": {
"value": "london overground",
"synonyms": [
"liberty",
"lioness",
"overground",
"mildmay",
"suffragette",
"weaver",
"windrush"
"overground"
]
}
},
Expand All @@ -914,6 +922,11 @@
]
}
},
{
"name": {
"value": "mildmay"
}
},
{
"name": {
"value": "northern"
Expand All @@ -924,6 +937,11 @@
"value": "piccadilly"
}
},
{
"name": {
"value": "suffragette"
}
},
{
"name": {
"value": "victoria"
Expand All @@ -937,6 +955,16 @@
"waterloo"
]
}
},
{
"name": {
"value": "weaver"
}
},
{
"name": {
"value": "windrush"
}
}
]
}
Expand Down
1 change: 0 additions & 1 deletion test/LondonTravel.Skill.EndToEndTests/SkillTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class SkillTests(ITestOutputHelper outputHelper)
[InlineData("Alexa, ask London Travel if there is any disruption today.")]
[InlineData("Alexa, ask London Travel about the DLR.")]
[InlineData("Alexa, ask London Travel about the Elizabeth line.")]
[InlineData("Alexa, ask London Travel about London Overground.")]
[InlineData("Alexa, ask London Travel about the Victoria line.")]
[InlineData("Alexa, ask London Travel about the Windrush line.")]
public async Task Can_Invoke_Skill_And_Get_Valid_Response(string content)
Expand Down
Loading

0 comments on commit 0517901

Please sign in to comment.