[Schmitzm-commits] r2084 - 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 Sep 9 23:23:51 CEST 2012


Author: alfonx
Date: 2012-09-09 23:23:50 +0200 (Sun, 09 Sep 2012)
New Revision: 2084

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

Modified: trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
===================================================================
--- trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2012-09-08 22:10:05 UTC (rev 2083)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2012-09-09 21:23:50 UTC (rev 2084)
@@ -484,11 +484,10 @@
 		strasse = strasse.toLowerCase();
 
 		strasse = RegexCache.getInstance().replaceAll(strasse, "\\(.*?\\)", "");
-		
+
 		strasse = RegexCache.getInstance().replaceAll(strasse, "x{2,}$", "");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "\\sx+$", "");
 
-		
 		strasse = RegexCache.getInstance().replaceAll(strasse, "wegx$", "weg");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "strassex$", "strasse");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "alleex$", "allee");
@@ -580,7 +579,7 @@
 		ort = RegexCache.getInstance().replaceAll(ort, ".\\bi[\\.\\s]", "xx");
 		ort = RegexCache.getInstance().replaceAll(ort, ".\\ba[\\.\\s]", "xx");
 		ort = RegexCache.getInstance().replaceAll(ort, ".\\bb[\\.\\s]", "xx");
-		
+
 		ort = RegexCache.getInstance().replaceAll(ort, " oberlausitz$", "xxoberlausitz"); // 3.9.2012
 
 		ort = norm(ort);
@@ -611,6 +610,10 @@
 	static public String saeubereStrassenname(String orginal) {
 		String strasse = LangUtil.removeTags(orginal).toLowerCase();
 
+		strasse = RegexCache.getInstance().replaceAll(strasse, "(\\s+/[^\\d]++)$", "");
+
+		strasse = RegexCache.getInstance().replaceAll(strasse, "\\s*\\(.*?\\)\\s*", "");
+		
 		strasse = RegexCache.getInstance().replaceAll(strasse, "str\\.ße", "str.");
 
 		strasse = RegexCache.getInstance().replaceAll(strasse, "\\bStr\\./hausnummer:?", "");
@@ -619,7 +622,7 @@
 		strasse = RegexCache.getInstance().replaceAll(strasse, "egli", " ");
 		strasse = RegexCache.getInstance().replaceAll(strasse, "\\*ort", " ");
 
-		strasse = RegexCache.getInstance().replaceAll(strasse, "\\+", " ");
+		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, "-\\s+", "-");

Modified: trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
===================================================================
--- trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2012-09-08 22:10:05 UTC (rev 2083)
+++ trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2012-09-09 21:23:50 UTC (rev 2084)
@@ -363,6 +363,13 @@
 
 	@Test
 	public void testSaeubereStrassenname() {
+		assertEquals("Rückertstr. 3", AddrStringUtil.saeubereStrassenname("(Gartenhaus) Rückertstr. 3"));
+		
+		assertEquals("Wildenbruchstr.", AddrStringUtil.saeubereStrassenname("Wildenbruchstr. /am Bastionsplatz"));
+		assertEquals("Wildenbruchstr. 11/a", AddrStringUtil.saeubereStrassenname("Wildenbruchstr. 11/a"));
+		
+		assertEquals("Wildkamp 93\\95", AddrStringUtil.saeubereStrassenname(" Wildkamp 93\\\\95"));
+		
 		assertEquals("Taubenstr. 45", AddrStringUtil.saeubereStrassenname("Taubenstraße45"));
 		assertEquals("Taubenstr. 45", AddrStringUtil.saeubereStrassenname("Taubenstr.ße 45"));
 



More information about the Schmitzm-commits mailing list