[Schmitzm-commits] r2303 - in trunk/schmitzm-adresses/src: main/java/de/schmitzm/adresses test/java/de/schmitzm/adresses
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Sun Apr 28 01:36:41 CEST 2013
Author: alfonx
Date: 2013-04-28 01:36:41 +0200 (Sun, 28 Apr 2013)
New Revision: 2303
Modified:
trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
Log:
expected:<Gerst?\195?\164ckerstr. 1[]> but was:<Gerst?\195?\164ckerstr. 1[*]> fixed
Modified: trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
===================================================================
--- trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java 2013-04-24 12:42:45 UTC (rev 2302)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java 2013-04-27 23:36:41 UTC (rev 2303)
@@ -707,8 +707,20 @@
}
static public String saeubereStrassenname(final String orginal) {
- String strasse = RegexUtil.removeTags(orginal).toLowerCase();
+ /**
+ * Hack hack... removeTags entfernt ein freistendes + ... Das zerstört HN Angaben 34 + 56
+ *
+ */
+ String strasse = orginal;
+
+// strasse = strasse.replaceAll("(?i)(\\d[a-z]?)\\s*\\+\\s*(\\d)", "$1HIERSTEHTPLUS$2");
+ strasse = RegexUtil.removeTags(strasse).toLowerCase();
+// strasse = strasse.replaceAll("(?i)HIERSTEHTPLUS", "+");
+
+ // * irgendwo
+ strasse = RegexCache.getInstance().replaceAll(strasse, "\\s*?\\*\\s*?", " ");
+
// HN. am Ende
strasse = RegexCache.getInstance().replaceAll(strasse, "(\\d)\\s*\\.$", "$1");
@@ -774,6 +786,15 @@
strasse = strasse + s2;
}
+ // Weg- 11
+ strasse = RegexCache.getInstance().replaceAll(strasse, "(?!\\w)\\s*?-\\s*?(?>(?:\\d|\\s))", " ");
+
+ // 10b33 zu 10b 33
+ strasse = RegexCache.getInstance().replaceAll(strasse, "(?i)(\\d[a-z])(\\d)", "$1 $2");
+
+ // Endet
+ strasse = RegexCache.getInstance().replaceAll(strasse, "(?i)des 18\\.?\\s*?Oktobers?", "des 18. Oktober");
+
strasse = RegexCache.getInstance().replaceAll(strasse, " Dem ", " dem ");
strasse = RegexCache.getInstance().replaceAll(strasse, " Der ", " der ");
strasse = RegexCache.getInstance().replaceAll(strasse, " Des ", " des ");
Modified: trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
===================================================================
--- trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java 2013-04-24 12:42:45 UTC (rev 2302)
+++ trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java 2013-04-27 23:36:41 UTC (rev 2303)
@@ -315,6 +315,8 @@
@Test
public void testNormalizeOrt() {
+ assertEquals("weidenxxoberpfalz", AddrStringUtil.normalizeOrt("Weiden , Oberpf"));
+
assertEquals("weidenxxoberpfalz", AddrStringUtil.normalizeOrt("Weiden i.d.OPf."));
assertEquals("weidenxxoberpfalz", AddrStringUtil.normalizeOrt("Weiden in.d.OPf."));
assertEquals("weidenxxoberpfalz", AddrStringUtil.normalizeOrt("Weiden in der OPf."));
@@ -497,6 +499,10 @@
assertEquals("Südstr. 17", AddrStringUtil.saeubereStrassenname(" # Südstrasse 17"));
assertEquals("Südstr. 17", AddrStringUtil.saeubereStrassenname(" -#/Südstrasse 17"));
+ assertEquals("Alfred-Messel-Weg 10b 33", AddrStringUtil.saeubereStrassenname("Alfred-Messel-Weg- 10b33"));
+ assertEquals("Europa-Park-Str. 4+6", AddrStringUtil.saeubereStrassenname("Europa-Park-Str. 4+6"));
+ assertEquals("Europa-Park-Str. 4+6", AddrStringUtil.saeubereStrassenname("Europa-Park-Str. 4 + 6"));
+
}
}
More information about the Schmitzm-commits
mailing list