From 6bc8119feb5829d5e323bc80e305f139e79bd59e Mon Sep 17 00:00:00 2001 From: agneskleinhans Date: Mon, 24 Jul 2023 16:53:19 +0200 Subject: [PATCH] [de] improve LineExpander.java --- .../src/main/java/org/languagetool/rules/de/LineExpander.java | 3 +++ .../test/java/org/languagetool/rules/de/LineExpanderTest.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/LineExpander.java b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/LineExpander.java index c081bbaf46d9..9d8daf26bede 100644 --- a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/LineExpander.java +++ b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/LineExpander.java @@ -127,6 +127,9 @@ private List handleLineWithFlags(String line) { if (word.endsWith("straße") || word.endsWith("strasse")) { result.add(word.replaceAll("stra(ß|ss)e", "str.")); } + if (word.endsWith("Straße") || word.endsWith("Strasse")) { + result.add(word.replaceAll("Stra(ß|ss)e", "Str.")); + } } else if (c == 'A' || c == 'P') { // Adjektiv / Partizip add(result, word); if (word.endsWith("e")) { diff --git a/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/LineExpanderTest.java b/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/LineExpanderTest.java index fd673ffcd75a..3d1ceaae4a51 100644 --- a/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/LineExpanderTest.java +++ b/languagetool-language-modules/de/src/test/java/org/languagetool/rules/de/LineExpanderTest.java @@ -43,6 +43,8 @@ public void testExpansion() { assertThat(expand("Tisch/E #bla #foo"), is("[Tisch, Tische]")); assertThat(expand("Goethestraße/T"), is("[Goethestraße, Goethestr.]")); assertThat(expand("Goethestrasse/T"), is("[Goethestrasse, Goethestr.]")); + assertThat(expand("Zwingenberger Stra\u00DFe/T"), is("[Zwingenberger Stra\u00DFe, Zwingenberger Str.]")); + assertThat(expand("Zwingenberger Strasse/T"), is("[Zwingenberger Strasse, Zwingenberger Str.]")); assertThat(expand("Escape\\/N"), is("[Escape/N]")); //assertThat(expand("Escape\\/N/S"), is("[Escape/N, Escape/Ns]")); // combination of escape and flag not supported yet