Repository navigation
Strings cleaner > FR > remove ligne from route long name & station from trip head-sign - #34
Conversation
…" from trip head-sign
ligne from route long name & station from trip head-sign
left a comment
There was a problem hiding this comment.
Code Review
This pull request introduces French language cleaning rules, specifically adding logic to remove the word 'ligne' from route names and 'station' from subway headsigns. The review feedback suggests using the cleanWordsFR utility for more robust pattern matching of 'ligne', updating the replacement logic to use EMPTY, and extending the removal of 'station' to light rail and train/rail types to ensure consistency with existing English cleaning rules.
I am having trouble creating individual review comments. Click here to see my feedback.
src/main/java/org/mtransit/commons/CleanUtils.java (736-737)
Instead of manually defining the regex and replacement for "ligne", you should use the cleanWordsFR utility. This is more robust as it uses word boundaries (via lookarounds) and handles Unicode characters correctly for French, which is consistent with how other patterns (like STATION or CLEAN_ET) are defined in this class. Note that when using cleanWords, the replacement should be an empty string (or EMPTY) because the lookarounds preserve surrounding whitespace.
static final Pattern LIGNE = cleanWordsFR("ligne");
src/main/java/org/mtransit/commons/StringsCleaner.kt (25)
If CleanUtils.LIGNE is updated to use cleanWordsFR, the replacement here should be changed to EMPTY. This is because cleanWords uses lookarounds to match the word without consuming the surrounding whitespace, making the $1$3 replacement unnecessary and potentially incorrect if punctuation is involved.
routeLongName = CleanUtils.LIGNE.matcher(routeLongName).replaceAll(EMPTY)src/main/java/org/mtransit/commons/StringsCleaner.kt (57-62)
For consistency with the English implementation (lines 47-54), consider removing "station" from French trip head-signs for light rail (0) and train/rail (2) as well, not just subway (1). In many French-speaking transit systems, "Station" is commonly used for tramways and sometimes for suburban rail, and removing it helps save valuable screen space.
if (languages?.contains(Locale.FRENCH) == true) {
when (routeType) {
0, // light rail
1, // subway
2, // train/rail
-> {
tripHeadsign = CleanUtils.STATION.matcher(tripHeadsign).replaceAll(EMPTY)
}
}
}
left a comment
There was a problem hiding this comment.
Pull request overview
Updates StringsCleaner to better normalize FR/EN transit text by removing redundant words in route long names and trip headsigns (intended for FR “ligne” and FR subway “station”), supported by new/adjusted regex patterns in CleanUtils.
Changes:
- Remove “line” (EN) and “ligne” (FR) from route long names during cleaning.
- Remove “station” from French subway (routeType=1) trip headsigns.
- Add new
CleanUtilspatterns to support the new removals and exposeFR_CA_STATIONfor reuse.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/java/org/mtransit/commons/StringsCleaner.kt | Adds EN/FR word-removal steps for route long names and FR subway trip headsigns. |
| src/main/java/org/mtransit/commons/CleanUtils.java | Introduces new patterns for “line”/“ligne” and exposes FR_CA_STATION for use by StringsCleaner. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
commented
May 6, 2026
|
/gemimi review |
commented
May 6, 2026
|
/gemini review |
left a comment
There was a problem hiding this comment.
Code Review
This pull request introduces French language cleaning logic for route names and trip headsigns, specifically targeting the words 'ligne' and 'station', while also refactoring the English 'line' cleaning process. The review feedback suggests expanding the French 'station' removal to include light rail and train route types to maintain consistency with the existing English cleaning logic.
Uh oh!
There was an error while loading. Please reload this page.