From c18478147e1657dee04b470cba266f7d08544437 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 10 Jan 2016 05:03:09 +0000 Subject: [PATCH] refactor number parsing --- source/net/filebot/similarity/NumericSimilarityMetric.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/net/filebot/similarity/NumericSimilarityMetric.java b/source/net/filebot/similarity/NumericSimilarityMetric.java index b8cc264f..9f685b18 100644 --- a/source/net/filebot/similarity/NumericSimilarityMetric.java +++ b/source/net/filebot/similarity/NumericSimilarityMetric.java @@ -1,10 +1,11 @@ package net.filebot.similarity; +import static net.filebot.util.StringUtilities.*; + import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.Set; import java.util.regex.Matcher; -import java.util.regex.Pattern; import uk.ac.shef.wit.simmetrics.similaritymetrics.AbstractStringMetric; import uk.ac.shef.wit.simmetrics.similaritymetrics.QGramsDistance; @@ -34,8 +35,6 @@ public class NumericSimilarityMetric implements SimilarityMetric { private static class NumberTokeniser implements InterfaceTokeniser { - private static final Pattern DIGIT = Pattern.compile("\\d+"); - @Override public ArrayList tokenizeToArrayList(String s) { ArrayList tokens = new ArrayList(); @@ -51,7 +50,7 @@ public class NumericSimilarityMetric implements SimilarityMetric { @Override public String getDelimiters() { - return "\\D+"; + return NON_DIGIT.pattern(); } @Override