Fix inconsistent SubstringFields metric behaviour
This commit is contained in:
parent
4333193b98
commit
bdc81b3501
|
@ -208,10 +208,13 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
||||||
return stream(objects).map(EpisodeMetrics::normalizeObject).toArray(String[]::new);
|
return stream(objects).map(EpisodeMetrics::normalizeObject).toArray(String[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static final int MAX_FIELDS = 5;
|
||||||
|
|
||||||
protected Object[] fields(Object object) {
|
protected Object[] fields(Object object) {
|
||||||
if (object instanceof Episode) {
|
if (object instanceof Episode) {
|
||||||
Episode e = (Episode) object;
|
Episode e = (Episode) object;
|
||||||
return StreamEx.of(e.getSeriesName(), e.getTitle()).append(e.getSeriesNames()).filter(Objects::nonNull).map(Normalization::removeTrailingBrackets).distinct().limit(5).toArray();
|
Object[] names = StreamEx.of(e.getSeriesName(), e.getTitle()).append(e.getSeriesNames()).filter(Objects::nonNull).map(Normalization::removeTrailingBrackets).distinct().limit(MAX_FIELDS).toArray();
|
||||||
|
return copyOf(names, MAX_FIELDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object instanceof File) {
|
if (object instanceof File) {
|
||||||
|
|
Loading…
Reference in New Issue