[Schmitzm-commits] r2328 - 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
Thu Jun 6 13:46:12 CEST 2013


Author: alfonx
Date: 2013-06-06 13:46:12 +0200 (Thu, 06 Jun 2013)
New Revision: 2328

Modified:
   trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
   trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
Log:
mehr stressen

Modified: trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
===================================================================
--- trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2013-06-06 11:44:51 UTC (rev 2327)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2013-06-06 11:46:12 UTC (rev 2328)
@@ -742,7 +742,7 @@
 
 		strasse = RegexCache.getInstance().replaceAll(strasse, "\\\\+", "\\\\");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "\\s\\s+", " ");
-		strasse = RegexCache.getInstance().replaceAll(strasse, "(\\d)\\s", "$1");
+		strasse = RegexCache.getInstance().replaceAll(strasse, "(\\d)\\s(?!\\d)", "$1");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "-\\s+", "-");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "\\s+-", "-");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "tra(ss|ß)e( |\\d)", "tr.$2");
@@ -752,6 +752,20 @@
 		strasse = RegexCache.getInstance().replaceAll(strasse, "(?i-)^\\s*[^a-züäö0-9]*\\s*", "");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "str$", "str.");
 
+		// Ludwigsstädter Str. 95 97 => Ludwigsstädter Str. 95+97
+		// Ludwigsstädter Str. 95u.97 => Ludwigsstädter Str. 95+97
+		// Ludwigsstädter Str. 95u 97 => Ludwigsstädter Str. 95+97
+		// Ludwigsstädter Str. 95u97 => Ludwigsstädter Str. 95+97
+		Matcher m = RegexCache.getInstance().getMatcher("^(.{9,})\\b(\\d+)(?:\\s*u|u\\.?\\s*|\\s)(\\d+).?\\b", strasse);
+		if (m.find()) {
+			String base = m.group(1);
+			Integer n1 = Integer.valueOf(m.group(2));
+			Integer n2 = Integer.valueOf(m.group(3));
+			if (n2 > n1 && n2 - n1 < 6) {
+				strasse = base + n1 + "+" + n2;
+			}
+		}
+
 		strasse = RegexCache.getInstance().replaceAll(strasse, "^Str\\.$", "");
 
 		strasse = RegexCache.getInstance().replaceFirst(strasse,

Modified: trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
===================================================================
--- trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2013-06-06 11:44:51 UTC (rev 2327)
+++ trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2013-06-06 11:46:12 UTC (rev 2328)
@@ -116,6 +116,8 @@
 
 		// TODO
 		// checkSplit("Kocherstrasse", "Kocherstrasse 15 1", "15", null, "1", null);
+		// checkSplit("Auf dem Loh", "Auf dem Loh 77 und 79", "77 und 79", null, null, null);
+		// //https://alfonx.ath.cx/immobrain-web/web/iaSuche.xhtml?id=3017601109
 
 		// checkSplit("Kosselstr.2 u 4", "Kosselstr.","2 u 4", null);
 		checkSplit("Kollau Str. 2.reihe 90a", "Kollau Str.", "90", "a");
@@ -490,7 +492,6 @@
 		assertEquals("Lindenweg 12/0402", AddrStringUtil.saeubereStrassenname("Lindenweg 12/ 0402"));
 		assertEquals("Knobelsdorfstr. 6a-d", AddrStringUtil.saeubereStrassenname("Knobelsdorfstr. 6  a- d"));
 		assertEquals("Knobelsdorfstr. 6a-d", AddrStringUtil.saeubereStrassenname("Knobelsdorfstr. 6a- D"));
-		assertEquals("78er-Str. 45a-d", AddrStringUtil.saeubereStrassenname("78 er - Straße   45 A - d"));
 
 		assertEquals("Bettinastr.", AddrStringUtil.saeubereStrassenname("BETTINASTR."));
 		assertEquals("Franz-Mehring-Str.", AddrStringUtil.saeubereStrassenname("Franz- Mehring- Straße"));
@@ -511,6 +512,13 @@
 		assertEquals("Bergstr. 3-9", AddrStringUtil.saeubereStrassenname("Bergstraße 3-9"));
 		assertEquals("Bergstr. 3-9", AddrStringUtil.saeubereStrassenname("Bergstraße 3 - 9"));
 
+		assertEquals("78er-Str. 45a-d", AddrStringUtil.saeubereStrassenname("78 er - Straße   45 A - d"));
+		// https://alfonx.ath.cx/immobrain-web/web/iaSuche.xhtml?id=3007927506
+		assertEquals("Ludwigsstädter Str. 95+97", AddrStringUtil.saeubereStrassenname("Ludwigsstädter Str. 95 97"));
+
+		assertEquals("Gerstäckerstr. 1", AddrStringUtil.saeubereStrassenname("Gerstäckerstr. 1*"));
+		assertEquals("Kosselstr. 2+4", AddrStringUtil.saeubereStrassenname("Kosselstr. 2u 4"));
+
 	}
 
 }



More information about the Schmitzm-commits mailing list