本文整理匯總了TypeScript中fuzzaldrin.score函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript score函數的具體用法?TypeScript score怎麽用?TypeScript score使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了score函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
var all = _.map(Aliases.all, (alias: string, expanded: string) => {
return {
value: expanded,
score: 2 * (score(alias, lastLexeme) + (score(expanded, lastLexeme) * 0.5)),
synopsis: alias,
description: `Aliased to â${expanded}â.`,
type: 'alias',
}
});
示例2:
const scores = keys.map((key) => {
const ck = candidate[key]
if (ck) {
return FZ.score(ck.toString(), prefix)
} else {
return 0
}
})
示例3: score
var all = _.map(executables, (executable: string) => {
return {
value: executable,
score: 1.5 * score(executable, lastArgument),
synopsis: '',
description: descriptions[executable],
type: 'executable'
};
});
示例4: score
var all = ExecutionHistory.all.filter(entry => entry.raw.length > 3).map(entry => {
return {
value: entry.raw,
score: 0.1 * score(entry.raw, lastArgument),
synopsis: '',
description: '',
replaceAll: true,
type: 'history'
};
});
示例5: filter
import { match, filter, score } from 'fuzzaldrin';
let number = 0;
const string = '' as string;
let strings: string[] = [];
let objects: Array<{name: string, speed: number}> = [];
strings = filter(strings, string);
strings = filter(strings, string, {maxResults: number});
objects = filter(objects, string, {key: 'name'});
objects = filter(objects, string, {key: 'name', maxResults: number});
number = score(string, string);
match(string, string);
// These should be type errors! Uncomment to verify.
// objects = filter(objects, string);
// objects = filter(objects, string, {key: 'speed'});
// strings = filter(strings, string, {key: 'speed'});
示例6: score
var prepared = _._(all).each(suggestion => suggestion.score = score(suggestion.value, baseName))