old-parser: Penalized async suggestions' scores to prevent disorder.

This commit is contained in:
satyr 2009-10-15 23:13:46 +09:00
Родитель ae78ad4f72
Коммит 2ee5754667
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -452,7 +452,7 @@ ParsedSentence.prototype = {
get score PS_getScore() {
if (!this.argMatchScore) {
// argument match score starts at 0 and increased for each
// argument match score starts at 1 and increased for each
// argument where a specific nountype (i.e. non-arbitrary-text)
// matches user input.
let ams = 1, {_argFlags, _argSuggs} = this;
@ -534,11 +534,13 @@ PartiallyParsedSentence.prototype = {
// Callback function for asynchronously generated suggestions:
function callback(suggs) {
var suggestions = self._handleSuggestions(argName, suggs);
var {length} = suggestions;
if (!length) return;
for each (let [pps, arg] in callback.otherSentences)
for (let i = 0; i < length; ++i)
pps.addArgumentSuggestion(arg, suggestions[i]);
if (!suggestions.length) return;
for each (let sugg in suggestions) {
sugg.score = (sugg.score || 1) / 4;
for each (let [pps, arg] in callback.otherSentences)
pps.addArgumentSuggestion(arg, sugg);
}
self._query.onNewParseGenerated();
}
try {