diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-04-07 21:17:13 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-04-07 21:17:13 -0700 |
commit | c4b1a4a5b4811d7aaa70b3b83f740c9e3d2b86be (patch) | |
tree | 0bb0caf5b506ea90555b79ae2ccda54da8756506 /ext/fg/js/util.js | |
parent | bbe4afecf6a56f4bdaaafe083a3bf67191fd9cde (diff) |
wip
Diffstat (limited to 'ext/fg/js/util.js')
-rw-r--r-- | ext/fg/js/util.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js index 59060221..445efa5b 100644 --- a/ext/fg/js/util.js +++ b/ext/fg/js/util.js @@ -152,7 +152,7 @@ function docRangeFromPoint(point, imposter) { return null; } -function docClozeExtract(source, extent) { +function docSentenceExtract(source, extent) { const quotesFwd = {'「': '」', '『': '』', "'": "'", '"': '"'}; const quotesBwd = {'」': '「', '』': '『', "'": "'", '"': '"'}; const terminators = '…。..??!!'; @@ -204,11 +204,11 @@ function docClozeExtract(source, extent) { } } - const sentence = content.substring(startPos, endPos); - const padding = sentence.length - sentence.replace(/^\s+/, ''); + const text = content.substring(startPos, endPos); + const padding = text.length - text.replace(/^\s+/, ''); return { - sentence: sentence.trim(), + text: text.trim(), offset: position - startPos - padding }; } |