refactor number parsing

This commit is contained in:
Reinhard Pointner 2016-01-10 05:03:09 +00:00
parent 9cc353e981
commit c18478147e
1 changed files with 3 additions and 4 deletions

View File

@ -1,10 +1,11 @@
package net.filebot.similarity; package net.filebot.similarity;
import static net.filebot.util.StringUtilities.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
import java.util.regex.Matcher; 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.AbstractStringMetric;
import uk.ac.shef.wit.simmetrics.similaritymetrics.QGramsDistance; 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 class NumberTokeniser implements InterfaceTokeniser {
private static final Pattern DIGIT = Pattern.compile("\\d+");
@Override @Override
public ArrayList<String> tokenizeToArrayList(String s) { public ArrayList<String> tokenizeToArrayList(String s) {
ArrayList<String> tokens = new ArrayList<String>(); ArrayList<String> tokens = new ArrayList<String>();
@ -51,7 +50,7 @@ public class NumericSimilarityMetric implements SimilarityMetric {
@Override @Override
public String getDelimiters() { public String getDelimiters() {
return "\\D+"; return NON_DIGIT.pattern();
} }
@Override @Override