Use common pattern

This commit is contained in:
Reinhard Pointner 2016-04-05 18:06:02 +00:00
parent e8c89ed3c7
commit 94417623be
1 changed files with 3 additions and 5 deletions

View File

@ -590,7 +590,6 @@ public enum EpisodeMetrics implements SimilarityMetric {
RegionHint(new SimilarityMetric() {
private final Pattern hint = compile("[(](\\p{Alpha}+|\\p{Digit}+)[)]$");
private final Pattern punctuation = compile("[\\p{Punct}\\p{Space}]+");
private final SeriesNameMatcher seriesNameMatcher = getSeriesNameMatcher(true);
@ -614,10 +613,9 @@ public enum EpisodeMetrics implements SimilarityMetric {
Set<String> h = new HashSet<String>();
for (File f : listPathTail((File) o, 3, true)) {
// try to focus on series name
String n = f.getName();
String sn = seriesNameMatcher.matchByEpisodeIdentifier(n);
String[] tokens = punctuation.split(sn != null ? sn : n);
String fn = f.getName();
String sn = seriesNameMatcher.matchByEpisodeIdentifier(fn);
String[] tokens = PUNCTUATION_OR_SPACE.split(sn != null ? sn : fn);
for (String s : tokens) {
if (s.length() > 0) {
h.add(s.trim().toLowerCase());