Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #747

Merged
merged 25 commits into from
Apr 25, 2020
Merged

Dev #747

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8b2c23a
actual 13.1.1 release - remove dry-run flag on github workflow
spencermountain Feb 29, 2020
db28863
move compromise-redact to ./plugins
spencermountain Mar 3, 2020
b9fd552
fix filesize links in readmes
spencermountain Mar 3, 2020
0895b34
money tagger, hasBefore, hasAfter, looser untag
spencermountain Mar 3, 2020
f54bb65
9 number tests failing
spencermountain Mar 3, 2020
cdff2ec
more abbreviations
spencermountain Mar 3, 2020
b15e3eb
more abbreviations, 9 number tests still failing
spencermountain Mar 3, 2020
5452d8b
move abbreviations and units around
spencermountain Mar 3, 2020
d227dca
safer slash regex #726
spencermountain Mar 9, 2020
262a788
Bump acorn from 7.1.0 to 7.1.1
dependabot[bot] Mar 14, 2020
1b1a967
Merge pull request #727 from spencermountain/dependabot/npm_and_yarn/…
spencermountain Mar 14, 2020
fd85e5c
some toSIngular fixes
spencermountain Apr 14, 2020
e4583b5
minor tagging issues
spencermountain Apr 14, 2020
ea1592c
remove irregulars data from tokenize build
spencermountain Apr 16, 2020
b67bf94
remove sourcemaps from build
spencermountain Apr 16, 2020
4c40b18
remove transforms from tokenize build
spencermountain Apr 16, 2020
4df4cd9
four money tests failing
spencermountain Apr 22, 2020
81c19a8
fix issues with money and units, tests passing
spencermountain Apr 22, 2020
b627b38
fix for #744
spencermountain Apr 25, 2020
ec61359
support the only reason
spencermountain Apr 25, 2020
44d6e00
update deps, 13.2.0 rc
spencermountain Apr 25, 2020
ee261d3
publish redact and numbers plugins
spencermountain Apr 25, 2020
bc1f428
add package-lock for redact
spencermountain Apr 25, 2020
2c864df
drop node 8 building for new rollup features
spencermountain Apr 25, 2020
db8bdba
remove babel from redact plugin
spencermountain Apr 25, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [8.x, 10.x, 13.x]
node-version: [10.x, 13.x]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -49,6 +49,6 @@ jobs:
run: |
npm run test:smoke
npm run testb
npm run test:perf
npm run perf
npm run test:types
# npm run test:stress
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
run: |
npm run test:smoke
npm run testb
npm run test:perf
npm run perf
npm run test:types
# npm run test:stress

Expand All @@ -61,6 +61,6 @@ jobs:
- name: publish
run: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
npm publish --dry-run
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ _(these methods are on the `nlp` object)_
- **[.fromJSON()](https://observablehq.com/@spencermountain/compromise-constructor-methods)** - load a compromise object from `.json()` result
- **[.verbose()](https://observablehq.com/@spencermountain/compromise-constructor-methods)** - log our decision-making for debugging
- **[.version()](https://observablehq.com/@spencermountain/compromise-constructor-methods)** - current semver version of the library
- **[.world()](https://observablehq.com/@spencermountain/compromise-constructor-methods)** - grab all current linguistic data

##### Utils

Expand Down Expand Up @@ -446,7 +447,6 @@ _(all match methods use the [match-syntax](https://docs.compromise.cool/compromi
- **[.clauses()](https://observablehq.com/@spencermountain/compromise-selections)** - split-up sentences into multi-term phrases
- **[.hyphenated()](https://observablehq.com/@spencermountain/compromise-selections)** - all terms connected with a hyphen or dash like `'wash-out'`
- **[.phoneNumbers()](https://observablehq.com/@spencermountain/compromise-selections)** - things like `'(939) 555-0113'`
- **[.money()](https://observablehq.com/@spencermountain/compromise-values)** - things like `'$2.50'`
- **[.hashTags()](https://observablehq.com/@spencermountain/compromise-selections)** - things like `'#nlp'`
- **[.emails()](https://observablehq.com/@spencermountain/compromise-selections)** - things like `'[email protected]'`
- **[.emoticons()](https://observablehq.com/@spencermountain/compromise-selections)** - things like `:)`
Expand Down Expand Up @@ -555,6 +555,7 @@ These are some helpful extensions:
- **[.numbers().isOrdinal()](https://observablehq.com/@spencermountain/compromise-values)** - return only ordinal numbers
- **[.numbers().isCardinal()](https://observablehq.com/@spencermountain/compromise-values)** - return only cardinal numbers
- **[.numbers().toLocaleString()](https://observablehq.com/@spencermountain/compromise-values)** - add commas, or nicer formatting for numbers
- **[.money()](https://observablehq.com/@spencermountain/compromise-values)** - things like `'$2.50'`

##### Export

Expand Down Expand Up @@ -667,16 +668,18 @@ import ngrams from 'compromise-ngrams'
import numbers from 'compromise-numbers'

// .extend() can be chained
const nlpEx = nlp.extend(ngrams).extend(numbers)
const nlpEx = nlp.extend(ngrams).extend(numbers)

nlpEx('This is type safe!').ngrams({ min: 1 })
nlpEx('This is type safe!').numbers()
```

#### Type-safe Plugins

The `.extend()` function returns an nlp type with updated Document and World types (Phrase, Term and Pool are not currently supported). While the global nlp also recieves the plugin from a runtime perspective; it's type will not be updated - this is a limitation of Typescript.

Typesafe plugins can be created by using the `nlp.Plugin` type:

```ts
interface myExtendedDoc {
sayHello(): string
Expand All @@ -695,13 +698,12 @@ const myPlugin: nlp.Plugin<myExtendedDoc, myExtendedWorld> = (Doc, world) => {
const _nlp = nlp.extend(myPlugin)
const doc = _nlp('This is safe!')
doc.sayHello()
doc.world.hello = "Hello again!"

doc.world.hello = 'Hello again!'
```

#### Known Issues

* `compromise_1.default is not a function` - This is a problem with your `tsconfig.json` it can be solved by adding `"esModuleInterop": true`. Make sure to run `tsc --init` when starting a new Typescript project.
- `compromise_1.default is not a function` - This is a problem with your `tsconfig.json` it can be solved by adding `"esModuleInterop": true`. Make sure to run `tsc --init` when starting a new Typescript project.

### Docs:

Expand All @@ -716,7 +718,7 @@ doc.world.hello = "Hello again!"

- **[Geocoding Social Conversations with NLP and JavaScript](http://compromise.cool)** - by Microsoft
- **[Microservice Recipe](https://eventn.com/recipes/text-parsing-with-nlp-compromise)** - by Eventn
- **[Adventure Game Sentence Parsing with Compromise](https://killalldefects.com/2020/02/20/adventure-game-sentence-parsing-with-compromise/)
- \*\*[Adventure Game Sentence Parsing with Compromise](https://killalldefects.com/2020/02/20/adventure-game-sentence-parsing-with-compromise/)
- **[Building Text-Based Games](https://killalldefects.com/2019/09/24/building-text-based-games-with-compromise-nlp/)** - by Matt Eland
- **[Fun with javascript in BigQuery](https://medium.com/@hoffa/new-in-bigquery-persistent-udfs-c9ea4100fd83#6e09)** - by Felipe Hoffa
- **[Natural Language Processing... in the Browser???](https://dev.to/charlesdlandau/natural-language-processing-in-the-browser-52hj)** - by Charles Landau
Expand Down
2 changes: 1 addition & 1 deletion builds/compromise-tokenize.js

Large diffs are not rendered by default.

Loading