20 lines
536 B
Plaintext
20 lines
536 B
Plaintext
'use strict';
|
|
|
|
function factorial(n) {
|
|
if (n <= 1) return 1;
|
|
return n * factorial(n - 1);
|
|
}
|
|
var wordSequenceMatcher = match => {
|
|
if (match.pattern !== 'wordSequence') {
|
|
return 0;
|
|
}
|
|
// Base guesses: factorial of word count (number of ways to order the words)
|
|
const baseGuesses = factorial(match.wordCount);
|
|
// Additional penalty for longer sequences
|
|
const lengthPenalty = 2 ** (match.wordCount - 2);
|
|
return baseGuesses * lengthPenalty;
|
|
};
|
|
|
|
module.exports = wordSequenceMatcher;
|
|
//# sourceMappingURL=scoring.cjs.map
|