|
|
@ -22,7 +22,7 @@ public class PlayCommand extends YoshiCommand { |
|
|
|
|
|
|
|
private static final Map<User, Long> cooldownChecker = new HashMap<>(); |
|
|
|
|
|
|
|
private static final int SECOND_DELAY = 10; |
|
|
|
private static final int SECOND_DELAY = 5; |
|
|
|
|
|
|
|
|
|
|
|
public PlayCommand(YoshiCommandContext context) { |
|
|
@ -113,17 +113,9 @@ public class PlayCommand extends YoshiCommand { |
|
|
|
} |
|
|
|
|
|
|
|
private String getBestMatch(String word, List<String> choices) { |
|
|
|
double bestScore = 1.0; |
|
|
|
String bestMatching = null; |
|
|
|
for (String file : choices) { |
|
|
|
double score = (new JaccardDistance()).apply(word, file); |
|
|
|
if (score < bestScore) { |
|
|
|
bestScore = score; |
|
|
|
bestMatching = file; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return bestMatching; |
|
|
|
Optional<String> match = choices.parallelStream().filter(word::equals).findAny(); |
|
|
|
return match.orElse(choices.parallelStream().max( |
|
|
|
Comparator.comparingDouble(file -> new JaccardDistance().apply(word, file))).orElse(null)); |
|
|
|
} |
|
|
|
|
|
|
|
private List<String> getAllFiles() { |
|
|
|