You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bit of an odd one, when using capture groups with the . syntax, the last word is always missing:
'use strict'/** @type {import('compromise').default} */constnlp=require('compromise')constnlpDates=require('compromise-dates')nlp.plugin(nlpDates)consttext='I ate some cheeseburgers with Mr. Lahey'constdoc=nlp(text)letresult=doc.match('[#PastTense .{0,10} cheeseburgers] with',0)console.log(result.out('text'))// Outputs 'ate some', expected 'ate some cheeseburgers'result=doc.match('[#PastTense some cheeseburgers] with',0)console.log(result.out('text'))// Outputs 'ate some cheeseburgers' as expectedresult=doc.match('[#PastTense .{0,10} cheeseburgers] with').groups(0)console.log(result.out('text'))// Outputs 'ate some', expected 'ate some cheeseburgers'
The text was updated successfully, but these errors were encountered:
Fdawgs
changed the title
Last word missing from capture groups
Last word missing from capture groups when . syntax used
Aug 16, 2024
constdoc=nlp('one match after')// works without capturedoc.match('one .* after').debug()// incomplete match with capturedoc.match('[one .* after]',0).debug()// and strangely, this works finedoc.match('[one match+ after]',0).debug()
Node version: 20.16.0
Compromise version: 14.14.0
Compromise-dates version: 3.6.0
Bit of an odd one, when using capture groups with the
.
syntax, the last word is always missing:The text was updated successfully, but these errors were encountered: