Skip to content

Commit

Permalink
Merge pull request #966 from spencermountain/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
spencermountain authored Oct 16, 2022
2 parents cde976e + 1755a15 commit 980dca3
Show file tree
Hide file tree
Showing 24 changed files with 84 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/[email protected]
with:
node-version: '12'
node-version: '16'

- uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: 15.x
node-version: 16.x

- name: cache dependencies
uses: actions/cache@v2
Expand Down
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.

6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ While all _Major_ releases should be reviewed, our only _large_ releases are **v
<!-- #### 14.5.0 [Unreleased]
-->

#### 14.5.2 [Oct 2022]
- **[fix]** - runtime error #965
- **[fix]** - misc possessive tagging issues
- **[update]** - dependencies

#### 14.5.1 [Oct 2022]
- **[fix]** - .remove() fixes
- **[change]** - support « angle quotes »
- **[update]** - dependencies

#### 14.5.0 [August 2022]
Expand Down
1 change: 1 addition & 0 deletions data/lexicon/people/lastnames.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ export default [
'moreau',
'moreira',
'moreno',
'monroe',
'moretti',
'mori',
'morin',
Expand Down
1 change: 1 addition & 0 deletions data/lexicon/verbs/infinitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default [
'adorn',
'adsorb',
'affix',
'afford',
'agree',
'align',
'allege',
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 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.5.1",
"version": "14.5.2",
"main": "./src/three.js",
"unpkg": "./builds/compromise.js",
"type": "module",
Expand Down Expand Up @@ -101,7 +101,7 @@
"eslint": "8.25.0",
"eslint-plugin-regexp": "1.9.0",
"nlp-corpus": "4.4.0",
"rollup": "3.1.0",
"rollup": "3.2.1",
"rollup-plugin-filesize-check": "0.0.1",
"rollup-plugin-terser": "7.0.2",
"shelljs": "0.8.5",
Expand All @@ -115,4 +115,4 @@
"_tests/**"
],
"license": "MIT"
}
}
15 changes: 8 additions & 7 deletions scratch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import nlp from './src/three.js'
// import plg from './plugins/dates/src/plugin.js'
// nlp.plugin(plg)
// nlp.verbose('tagger')
nlp.verbose('tagger')

// let txt = ''
// let doc
Expand Down Expand Up @@ -31,15 +31,16 @@ import nlp from './src/three.js'
// doc.match('* some text$').forEach((m) => m.prepend('prefix'))
// console.log(doc.out())

// remove bug 1
// const txt = `before SW1A 2AA Remove me after`
// const txt = `before Remove 500mg of paracetamol`
// const doc = nlp(txt)
// const matches = doc.match('Remove me')
// matches.forEach((m) => doc.remove(m))
// doc.remove('Remove')
// console.log(doc.text())

let doc = nlp("he said I am a boy")
console.log(doc.verbs().json().map(obj => obj.verb.grammar))
const doc = nlp("demanding his rights").debug()

// let doc = nlp("he said I am a boy")
// console.log(doc.sentences().json())

// [ { form: 'simple-present', tense: 'PresentTense', copula: true } ]

// let doc = nlp(`Remove me 1. A some text. B some text. C some text`)
Expand Down
6 changes: 5 additions & 1 deletion src/1-one/change/api/insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const getTerms = function (input, world) {
}
//allow a view object
if (typeof input === 'object' && input.isView) {
return input.clone().docs[0] //assume one sentence
return input.clone().docs[0] || [] //assume one sentence
}
//allow an array of terms, too
if (isArray(input)) {
Expand All @@ -49,6 +49,10 @@ const insert = function (input, view, prepend) {
// add-in the words
let home = document[n]
let terms = getTerms(input, world)
// are we inserting nothing?
if (terms.length === 0) {
return
}
terms = addIds(terms)
if (prepend) {
expand(view.update([ptr]).firstTerm())
Expand Down
9 changes: 5 additions & 4 deletions src/1-one/sweep/methods/tagger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ const tagger = function (list, document, world) {
if (todo.tag !== undefined) {
setTag(terms, todo.tag, world, todo.safe, `[post] '${reason}'`)
// quick and dirty plural tagger
if (terms.length === 1 && todo.tag === 'Noun') {
if (looksPlural(terms[0].text)) {
setTag(terms, 'Plural', world, todo.safe, 'quick-plural')
if (todo.tag === 'Noun') {
let term = terms[terms.length - 1]
if (looksPlural(term.text)) {
setTag([term], 'Plural', world, todo.safe, 'quick-plural')
} else {
setTag(terms, 'Singular', world, todo.safe, 'quick-singular')
setTag([term], 'Singular', world, todo.safe, 'quick-singular')
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/2-two/postTagger/model/nouns/nouns.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export default [
{ match: '#Organization+ #Possessive', tag: 'Possessive', reason: 'org-possessive' },
//Los Angeles's fundraiser
{ match: '#Place+ #Possessive', tag: 'Possessive', reason: 'place-possessive' },
// Ptolemy's experiments
{ match: '#Possessive #PresentTense', ifNo: '#Gerund', tag: 'Noun', reason: 'possessive-verb' }, // anna's eating vs anna's eating lunch
// 10th of a second
{ match: '#Value of a [second]', group: 0, unTag: 'Value', tag: 'Singular', reason: '10th-of-a-second' },
// 10 seconds
Expand Down
2 changes: 1 addition & 1 deletion src/2-two/postTagger/model/verbs/verb-noun.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default [
// hope i helped
{ match: '^[(hope|guess|thought|think)] #Pronoun #Verb', group: 0, tag: 'Infinitive', reason: 'suppose-i' },
//pursue its dreams
{ match: '#PresentTense #Possessive [#PresentTense]', group: 0, tag: 'Plural', reason: 'pursue-its-dreams' },
{ match: '#PresentTense #Possessive [#PresentTense]', ifNo: '#Gerund', group: 0, tag: 'Plural', reason: 'pursue-its-dreams' },
// our unyielding support
{ match: '#Possessive #Adjective [#Verb]', group: 0, tag: 'Noun', reason: 'our-full-support' },
// they do serve fish
Expand Down
Loading

0 comments on commit 980dca3

Please sign in to comment.