Skip to content

Commit

Permalink
Merge pull request #944 from spencermountain/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
spencermountain authored Aug 3, 2022
2 parents 784b46f + 7a84c8f commit ab15882
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion builds/compromise.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/one/compromise-one.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/one/compromise-one.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/three/compromise-three.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/three/compromise-three.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/two/compromise-two.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/two/compromise-two.mjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ While all _Major_ releases should be reviewed, our only _large_ releases are **v

<!-- #### 14.5.0 [Unreleased]
-->
#### 14.4.4 [August 2022]
- **[fix]** - support {root} matches without compromise/two

#### 14.4.3 [August 2022]
- **[fix]** - guard for toRoot methods in root match
- **[update]** - compromise-stats
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Spencer Kelly <[email protected]> (http://spencermounta.in)",
"name": "compromise",
"description": "modest natural language processing",
"version": "14.4.3",
"version": "14.4.4",
"main": "./src/three.js",
"unpkg": "./builds/compromise.js",
"type": "module",
Expand Down Expand Up @@ -114,4 +114,4 @@
"_tests/**"
],
"license": "MIT"
}
}
21 changes: 14 additions & 7 deletions src/1-one/match/methods/parseMatch/04-inflect-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ const addAdjective = function (token, world) {
// turn '{walk}' into 'walking', 'walked', etc
const inflectRoot = function (regs, world) {
// do we have compromise/two?
if (world.methods.two && world.methods.two.transform) {
regs = regs.map(token => {
// a reg to convert '{foo}'
if (token.root) {
regs = regs.map(token => {
// a reg to convert '{foo}'
if (token.root) {
// check if compromise/two is loaded
if (world.methods.two && world.methods.two.transform && world.methods.two.transform.verbConjugate) {
let choices = []
if (!token.pos || token.pos === 'Verb') {
choices = choices.concat(addVerbs(token, world))
Expand All @@ -53,10 +54,16 @@ const inflectRoot = function (regs, world) {
token.operator = 'or'
token.fastOr = new Set(choices)
}
} else {
// if no compromise/two, drop down into 'machine' lookup
token.machine = token.root
delete token.id
delete token.root
}
return token
})
}
}
return token
})

return regs
}
export default inflectRoot
2 changes: 1 addition & 1 deletion src/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '14.4.3'
export default '14.4.4'

0 comments on commit ab15882

Please sign in to comment.