mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 08:25:02 -04:00
* 1/3 emphasis on numberic patterns when sorting by similarity in order to help match movies by name and year
This commit is contained in:
parent
0a4b68f289
commit
bc14bf6fc0
@ -391,8 +391,14 @@ public class MediaDetection {
|
||||
|
||||
|
||||
public static <T> List<T> sortBySimilarity(Collection<T> options, Collection<String> terms) throws IOException {
|
||||
SimilarityMetric metric = new MetricAvg(new SequenceMatchSimilarity(), new NameSimilarityMetric());
|
||||
List<String> paragon = stripReleaseInfo(terms, true);
|
||||
SimilarityMetric metric = new MetricAvg(new SequenceMatchSimilarity(), new NameSimilarityMetric(), new NameSimilarityMetric() {
|
||||
|
||||
@Override
|
||||
protected String normalize(Object object) {
|
||||
return super.normalize(stripReleaseInfo(object.toString()).replaceAll("\\D+", " ")); // similarity of number patterns
|
||||
}
|
||||
});
|
||||
|
||||
List<T> sorted = new ArrayList<T>(options);
|
||||
sort(sorted, new SimilarityComparator(metric, paragon.toArray()));
|
||||
@ -537,11 +543,13 @@ public class MediaDetection {
|
||||
}
|
||||
|
||||
|
||||
public static String stripReleaseInfo(String name) throws IOException {
|
||||
public static String stripReleaseInfo(String name) {
|
||||
try {
|
||||
return releaseInfo.cleanRelease(singleton(name), true).iterator().next();
|
||||
} catch (NoSuchElementException e) {
|
||||
return ""; // default value in case all tokens are stripped away
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||
|
||||
// add repeat button
|
||||
JCheckBox checkBox = new JCheckBox();
|
||||
checkBox.setToolTipText("Auto-Repeat");
|
||||
checkBox.setToolTipText("Select / Ignore for all");
|
||||
checkBox.setCursor(getPredefinedCursor(HAND_CURSOR));
|
||||
checkBox.setIcon(ResourceManager.getIcon("button.repeat"));
|
||||
checkBox.setSelectedIcon(ResourceManager.getIcon("button.repeat.selected"));
|
||||
|
Loading…
Reference in New Issue
Block a user