use correct source text

This commit is contained in:
siikamiika 2019-10-30 18:13:45 +02:00
parent 408aa73cce
commit e6a1b78164

View File

@ -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);