diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2019-10-30 18:13:45 +0200 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2019-11-23 17:44:31 +0200 |
commit | e6a1b781648b8ab965a4508ea29ab85f0e070b35 (patch) | |
tree | 673fd1a39fb03d2a6c4b386a44b0054d96dbe1b9 /ext/bg/js | |
parent | 408aa73cced09e1d4fd00cfd193d7f3bcb18b689 (diff) |
use correct source text
Diffstat (limited to 'ext/bg/js')
-rw-r--r-- | ext/bg/js/api.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 174a439e..dbbe7368 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -85,10 +85,11 @@ async function apiTextParse(text, optionsContext) { const results = []; while (text) { - let [definitions, length] = await translator.findTerms(text, {}, options); + let [definitions, sourceLength] = await translator.findTerms(text, {}, options); if (definitions.length > 0) { definitions = dictTermsSort(definitions); - const {expression, source, reading} = definitions[0]; + const {expression, reading} = definitions[0]; + const source = text.slice(0, sourceLength); let stemLength = 0; const shortest = Math.min(source.length, expression.length); |