[Schmitzm-commits] r2195 - trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Wed Jan 23 21:59:23 CET 2013
Author: alfonx
Date: 2013-01-23 21:59:23 +0100 (Wed, 23 Jan 2013)
New Revision: 2195
Modified:
trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
Log:
Schablonen gemastert
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-23 19:47:40 UTC (rev 2194)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java 2013-01-23 20:59:23 UTC (rev 2195)
@@ -187,18 +187,26 @@
String[] s = splitInternal1(stringStrHnZusatz);
+ String[] nervigeZusaetzeAnFalscherStelle = new String[] {
+// "(?i)^(.*\\d.*)(\\d\\.\\d\\d)(.*)$",
+ "(?i)^(.*?)\\s*((?:\\d+\\.?)?\\s*(?:reihe|og\\s*(?:rechts|links|zi\\.?|zimmer|li|re|hinten|vorne|)+\\s*(?:\\d+\\.?)?))+\\s*+(.*?)$",
+ };
+
if (s[0] != null) {
RegexCache rC = RegexCache.getInstance();
- Matcher matcher = rC.getMatcher("^(.*?)\\s*+(\\d+\\.\\s*reihe)\\s*+(.*?)$", s[0]);
- if (matcher.find()) {
- s[0] = matcher.group(1);
- if (matcher.group(3).length() > 0)
- s[0] += " " + matcher.group(3);
- if (s[2] == null)
- s[2] = "";
- if (s[2].length() > 0)
- s[2] += " ";
- s[2] += matcher.group(2);
+ for (String nZ : nervigeZusaetzeAnFalscherStelle) {
+ Matcher matcher = rC.getMatcher(nZ, s[0]);
+ if (matcher.find()) {
+ s[0] = matcher.group(1);
+ if (matcher.group(3).length() > 0)
+ s[0] += " " + matcher.group(3);
+ // Reihen-Information wegschmeissen
+ // if (s[2] == null)
+ // s[2] = "";
+ // if (s[2].length() > 0)
+ // s[2] += " ";
+ // s[2] += matcher.group(2);
+ }
}
}
@@ -241,6 +249,9 @@
String zusammen = origStrasse + " " + (origHn != null ? " " + origHn : "")
+ (origZusatz != null ? " " + origZusatz : "");
zusammen = zusammen.replaceAll("3. Juni", "Dritten Juni");
+ zusammen = zusammen.replaceAll("(?i)^(.*\\d.*)\\b((?:zi?\\.?|zimmer)\\s*\\d+)(.*)$", "$1 $3");
+ zusammen = zusammen.replaceAll("(?i)^(.*\\d.*)\\b(we\\s*\\d\\.\\d\\d)(.*)$", "$1 $3");
+ zusammen = zusammen.replaceAll("(?i)^(.*\\d.*)(\\d\\.\\d\\d)(.*)$", "$1 $3");
zusammen = trimQuotes(zusammen);
zusammen = removeKommataAfterStreetname(zusammen);
@@ -675,6 +686,9 @@
static public String saeubereStrassenname(final String orginal) {
String strasse = LangUtil.removeTags(orginal).toLowerCase();
+
+ // HN. am Ende
+ strasse = RegexCache.getInstance().replaceAll(strasse, "(\\d)\\s*\\.$", "$1");
// Forststr. , 3
strasse = RegexCache.getInstance().replaceAll(strasse, "(\\D\\D\\D)\\s*[,](\\s*\\d+\\D*)$", "$1 $2");
More information about the Schmitzm-commits
mailing list