From 6712ac3b67064bcc5c9b7fa3b893bd7078848d2d Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Fri, 3 Apr 2020 10:33:59 -0600 Subject: [PATCH] Account for refs and non-default names having separators Signed-off-by: Taylor Smock --- .../data/validation/tests/StreetAddressTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java index 784a2da..ba500b2 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.openstreetmap.josm.data.osm.BBox; import org.openstreetmap.josm.data.osm.DataSet; @@ -90,9 +91,11 @@ public class StreetAddressTest extends Test { } public static Collection getWayNames(Collection ways) { - return ways.parallelStream().flatMap(w -> w.getInterestingTags().entrySet().parallelStream()).filter( - e -> (e.getKey().contains("name") || e.getKey().contains("ref")) && !e.getKey().contains("tiger")) - .map(Map.Entry::getValue).collect(Collectors.toSet()); + return ways.parallelStream().flatMap(w -> w.getInterestingTags().entrySet().parallelStream()) + .filter(e -> (e.getKey().contains("name") || e.getKey().contains("ref")) + && !e.getKey().contains("tiger")) + .map(Map.Entry::getValue).flatMap(s -> Stream.of(s.split(";", -1))).map(String::trim) + .filter(s -> !s.isEmpty()).collect(Collectors.toSet()); } public static Collection getSurroundingHighways(OsmPrimitive address) {