[Schmitzm-commits] r2186 - 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
Wed Jan 9 18:28:36 CET 2013


Author: alfonx
Date: 2013-01-09 18:28:36 +0100 (Wed, 09 Jan 2013)
New Revision: 2186

Modified:
   trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
   trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
Log:
Strassendeducer, sch?\195?\164nschreibweise etc.

Modified: trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
===================================================================
--- trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2013-01-09 14:59:53 UTC (rev 2185)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2013-01-09 17:28:36 UTC (rev 2186)
@@ -681,11 +681,9 @@
 
 		strasse = RegexCache.getInstance().replaceFirst(strasse,
 				"([\\d\\s])(?:(?i)eg|og|vh|hh)\\s*(?:(?i)li|re|links|rechts)$", "$1");
-		
-		strasse = RegexCache.getInstance().replaceAll(strasse, "\\.,", ".");		
-		strasse = RegexCache.getInstance().replaceAll(strasse, "(?i)des 4\\.?\\s*?Julis?", "des 4. Juli");		
-		strasse = RegexCache.getInstance().replaceAll(strasse, "(?i)des 18\\.?\\s*?Oktobers?", "des 18. Oktober");		
 
+		strasse = RegexCache.getInstance().replaceAll(strasse, "\\.,", ".");
+
 		{
 			// Großschreibung aller Anfangsbuchstaben, AUSSER in den Hausnummerzusätzen
 
@@ -695,7 +693,7 @@
 			if (firstNumM.find()) {
 				firstNumIdx = firstNumM.start();
 				boolean moreFound = true;
-				while (moreFound && firstNumM.start() <= 2) {
+				while (moreFound && (firstNumM.start() <= 2 || regexCache.matches("(?i:18. okt|4. Juli)", strasse))) {
 					moreFound = firstNumM.find();
 					if (moreFound)
 						firstNumIdx = firstNumM.start();
@@ -715,7 +713,15 @@
 
 		strasse = RegexCache.getInstance().replaceAll(strasse, " Dem ", " dem ");
 		strasse = RegexCache.getInstance().replaceAll(strasse, " Der ", " der ");
+		strasse = RegexCache.getInstance().replaceAll(strasse, " Des ", " des ");
+		strasse = RegexCache.getInstance().replaceAll(strasse, "-Von-", "-von-");
+		
+		strasse = RegexCache.getInstance().replaceAll(strasse, "\\s*amautohof", " Am Autohof");
+		strasse = RegexCache.getInstance().replaceAll(strasse, "Autobahn\\s*A\\s*(\\d)", "Autobahn A$1");
 
+		strasse = RegexCache.getInstance().replaceAll(strasse, "(?i)des 4\\.?\\s*?Julis?", "des 4. Juli");
+		strasse = RegexCache.getInstance().replaceAll(strasse, "(?i)des 18\\.?\\s*?Oktobers?", "des 18. Oktober");
+
 		return 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-01-09 14:59:53 UTC (rev 2185)
+++ trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2013-01-09 17:28:36 UTC (rev 2186)
@@ -438,6 +438,12 @@
 
 	@Test
 	public void testSaeubereStrassenname() {
+		assertEquals("Autobahn A6 Am Autohof", AddrStringUtil.saeubereStrassenname("Autobahn A 6AmAutohof"));
+		
+		assertEquals("Str. des 18. Oktober 2", AddrStringUtil.saeubereStrassenname("Str. des 18. Oktober 2"));
+		assertEquals("Str. des 18. Oktober 2", AddrStringUtil.saeubereStrassenname("Str. des 18. Oktobers 2"));
+		assertEquals("Str. des 18. Oktober 2", AddrStringUtil.saeubereStrassenname("Str. des 18.oktobers 2"));
+		
 		assertEquals("Rückertstr. 3", AddrStringUtil.saeubereStrassenname("(Gartenhaus) Rückertstr. 3"));
 
 		assertEquals("Wildenbruchstr.", AddrStringUtil.saeubereStrassenname("Wildenbruchstr. /am Bastionsplatz"));



More information about the Schmitzm-commits mailing list