-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #945 from spencermountain/dev
Dev
- Loading branch information
Showing
18 changed files
with
138 additions
and
23 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"author": "Spencer Kelly <[email protected]> (http://spencermounta.in)", | ||
"name": "compromise", | ||
"description": "modest natural language processing", | ||
"version": "14.4.4", | ||
"version": "14.4.5", | ||
"main": "./src/three.js", | ||
"unpkg": "./builds/compromise.js", | ||
"type": "module", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/1-one/match/methods/match/steps/logic/negative-greedy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import doesMatch from '../../term/doesMatch.js' | ||
|
||
const negGreedy = function (state, reg, nextReg) { | ||
let skip = 0 | ||
for (let t = state.t; t < state.terms.length; t += 1) { | ||
let found = doesMatch(state.terms[t], reg, state.start_i + state.t, state.phrase_length) | ||
// we don't want a match, here | ||
if (found) { | ||
break//stop going | ||
} | ||
// are we doing 'greedy-to'? | ||
// - "!foo+ after" should stop at 'after' | ||
if (nextReg) { | ||
found = doesMatch(state.terms[t], nextReg, state.start_i + state.t, state.phrase_length) | ||
if (found) { | ||
break | ||
} | ||
} | ||
skip += 1 | ||
// is it max-length now? | ||
if (reg.max !== undefined && skip === reg.max) { | ||
break | ||
} | ||
} | ||
if (skip === 0) { | ||
return false //dead | ||
} | ||
// did we satisfy min for !foo{min,max} | ||
if (reg.min && reg.min > skip) { | ||
return false//dead | ||
} | ||
state.t += skip | ||
// state.r += 1 | ||
return true | ||
} | ||
|
||
export default negGreedy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export default '14.4.4' | ||
export default '14.4.5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters