-
Notifications
You must be signed in to change notification settings - Fork 654
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 #722 from spencermountain/dev
Dev
- Loading branch information
Showing
27 changed files
with
633 additions
and
138 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CI: true | ||
|
||
# Note that these steps are *identical* to build-and-test (with the caveat | ||
# that build-and-test uses several versions of Node, and Release only uses | ||
# 10.x) at least until the actual publishing happens. Ideally, we could | ||
# delegate to the build- and-test workflow, but I haven't found a way to do | ||
# that yet. | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 10.x | ||
|
||
- name: cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-npm-10.x-${{ hashFiles('package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-npm-10.x- | ||
${{ runner.os }}-npm- | ||
- name: install | ||
run: | | ||
npm ci | ||
npm i --no-save eslint ts-node typescript | ||
npm run plugins:ci | ||
- name: static checks | ||
run: | | ||
npm run lint | ||
- name: build | ||
run: | | ||
npm run build | ||
npm run plugins:build | ||
- name: test | ||
run: | | ||
npm run test:smoke | ||
npm run testb | ||
npm run test:perf | ||
npm run test:types | ||
# npm run test:stress | ||
# And finally... publish it! Note that we create the .npmrc file | ||
# "just in time" so that `npm publish` can get the auth token from the | ||
# environment | ||
- name: publish | ||
run: | | ||
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc | ||
npm publish --dry-run | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "compromise-scan", | ||
"description": "plugin for nlp-compromise", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"author": "Spencer Kelly <[email protected]> (http://spencermounta.in)", | ||
"main": "./builds/compromise-scan.js", | ||
"unpkg": "./builds/compromise-scan.min.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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// cache the easier conditions up-front | ||
const cacheRequired = function(reg) { | ||
let needTags = [] | ||
let needWords = [] | ||
reg.forEach(obj => { | ||
if (obj.optional === true || obj.negative === true) { | ||
return | ||
} | ||
if (obj.tag !== undefined) { | ||
needTags.push(obj.tag) | ||
} | ||
if (obj.word !== undefined) { | ||
needWords.push(obj.word) | ||
} | ||
}) | ||
return { tags: needTags, words: needWords } | ||
} | ||
|
||
const failFast = function(doc, regs) { | ||
if (doc._cache && doc._cache.set === true) { | ||
let { words, tags } = cacheRequired(regs) | ||
//check required words | ||
for (let i = 0; i < words.length; i++) { | ||
if (doc._cache.words[words[i]] === undefined) { | ||
return false | ||
} | ||
} | ||
//check required tags | ||
for (let i = 0; i < tags.length; i++) { | ||
if (doc._cache.tags[tags[i]] === undefined) { | ||
return false | ||
} | ||
} | ||
} | ||
return true | ||
} | ||
module.exports = failFast |
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
Oops, something went wrong.