class CoordinateTagger implements Tagger {

    @Override
    public List<LocationAnnotation> getAnnotations(String text) {
        List<LocationAnnotation> annotations = new ArrayList<>();
        Matcher matcher = PATTERN_DEG.matcher(text);
        while (matcher.find()) {
            try {
                double lat = Double.parseDouble(matcher.group(2));
                double lng = Double.parseDouble(matcher.group(5));
                lat = "S".equals(matcher.group(3)) ? -lat : lat;
                lng = "W".equals(matcher.group(6)) ? -lng : lng;
                if (GeoUtils.isValidCoordinateRange(lat, lng)) {
                    annotations.add(createAnnotation(matcher.start(), matcher.group(), lat, lng));
                }
            } catch (NumberFormatException e) {
                LOGGER.debug("NumberFormatException while parsing " + matcher.group() + ": " + e.getMessage());
            }
        }

        matcher = PATTERN_DMS.matcher(text);
        while (matcher.find()) {
            try {
                double lat = GeoUtils.parseDms(matcher.group(1));
                double lng = GeoUtils.parseDms(matcher.group(6));
                if (GeoUtils.isValidCoordinateRange(lat, lng)) {
                    annotations.add(createAnnotation(matcher.start(), matcher.group(), lat, lng));
                }
            } catch (NumberFormatException e) {
                LOGGER.debug("NumberFormatException while parsing " + matcher.group() + ": " + e.getMessage());
            }
        }
        return annotations;
    }

    private  CoordinateTagger();

}