From 94417623bee1a0ab2af80ee48ace6fb8a0cbec0b Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 5 Apr 2016 18:06:02 +0000 Subject: [PATCH] Use common pattern --- source/net/filebot/similarity/EpisodeMetrics.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/net/filebot/similarity/EpisodeMetrics.java b/source/net/filebot/similarity/EpisodeMetrics.java index f50194df..3cde2e08 100644 --- a/source/net/filebot/similarity/EpisodeMetrics.java +++ b/source/net/filebot/similarity/EpisodeMetrics.java @@ -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 h = new HashSet(); 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());