Socket
Socket
Sign inDemoInstall

wink-ner

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wink-ner - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "wink-ner",
"version": "1.0.0",
"version": "1.0.1",
"description": "Language agnostic named entity recognizer",

@@ -5,0 +5,0 @@ "keywords": [

@@ -18,3 +18,3 @@ # wink-ner

### Getting Started
#### Simple Named Entity Recognition
```javascript

@@ -40,5 +40,7 @@ // Load wink ner.

// Simply Detect entities!
myNER.recognize( tokens );
tokens = myNER.recognize( tokens );
console.log( tokens );
// -> [
// { entityType: 'club', uid: 'manu', originalSeq: [ 'Manchester', 'United' ], value: 'manchester united', tag: 'word' },
// { entityType: 'club', uid: 'manu', originalSeq: [ 'Manchester', 'United' ],
// value: 'manchester united', tag: 'word' },
// { value: 'is', tag: 'word' },

@@ -50,9 +52,43 @@ // { value: 'a', tag: 'word' },

// { value: 'in', tag: 'word' },
// { entityType: 'city', value: 'Manchester', tag: 'word', originalSeq: [ 'Manchester' ], uid: 'manchester' },
// { entityType: 'city', value: 'Manchester', tag: 'word',
// originalSeq: [ 'Manchester' ], uid: 'manchester' },
// { value: ',', tag: 'punctuation' },
// { entityType: 'country', uid: 'uk', originalSeq: [ 'U', '.', 'K' ], value: 'u k', tag: 'word' },
// { entityType: 'country', uid: 'uk', originalSeq: [ 'U', '.', 'K' ],
// value: 'u k', tag: 'word' },
// { value: '.', tag: 'punctuation' }
// ]
```
#### Integration with POS Tagging
The `tokens` returned from `recognize()` may be further passed down to
`tag()` api of [`wink-tokenizer`](https://www.npmjs.com/package/wink-pos-tagger) for pos tagging.
Just in case you need to assign
a specific pos tag to an entity, the same can be achieved by including a property
`pos` in the entity definition and assigning it the desired pos tag (e.g. `'NNP'`); the wink-pos-tagger
will automatically do the needful. For details please refer to [`learn()`](#learn) api of wink-ner.
```javascript
// Load pos tagger.
var tagger = require( 'wink-pos-tagger' );
// Instantiate it and extract tag api.
var tag = tagger().tag;
tokens = tag( tokens );
console.log( tokens );
// -> [ { entityType: 'club', uid: 'manu', originalSeq: [ 'Manchester', 'United' ],
// value: 'manchester united', tag: 'word', normal: 'manchester united', pos: 'NNP' },
// { value: 'is', tag: 'word', normal: 'is', pos: 'VBZ', lemma: 'be' },
// { value: 'a', tag: 'word', normal: 'a', pos: 'DT' },
// { value: 'football', tag: 'word', normal: 'football', pos: 'NN', lemma: 'football' },
// { value: 'club', tag: 'word', normal: 'club', pos: 'NN', lemma: 'club' },
// { value: 'based', tag: 'word', normal: 'based', pos: 'VBN', lemma: 'base' },
// { value: 'in', tag: 'word', normal: 'in', pos: 'IN' },
// { value: 'Manchester', tag: 'word', originalSeq: [ 'Manchester' ],
// uid: 'manchester', entityType: 'city', normal: 'manchester', pos: 'NNP' },
// { value: ',', tag: 'punctuation', normal: ',', pos: ',' },
// { entityType: 'country', uid: 'uk', originalSeq: [ 'U', '.', 'K' ],
// value: 'u k', tag: 'word', normal: 'u k', pos: 'NNP' },
// { value: '.', tag: 'punctuation', normal: '.', pos: '.' }
// ]
```
### Documentation

@@ -59,0 +95,0 @@ Check out the [named entity recognizer API documentation](http://winkjs.org/wink-ner/) to learn more.

@@ -292,6 +292,13 @@ // wink-ner

* In addition to these two properties, you may optionally define two more
* properties as described in the table below. Apart from these **4 properties**,
* if any additional property is defined, the same is copied to the output
* entity token as-is for consumption by your code to simplify processing.
* properties viz. `uid` and `value`, as described in the table below.
*
* <b>Note:</b> Apart from the above mentioned properties, you may also define additional properties .
* Such properties, along with their values, will be copied to the output token as-is for consumption
* by any down stream code in the NLP pipe. An example use-case is pos tagging.
* You can define **pos** property in an entity defition as
* `{ text: 'manchester united', entityType: 'club', pos: 'NNP' }`.
* The [wink-pos-tagger](https://www.npmjs.com/package/wink-pos-tagger) will
* automatically use the `pos` property (if available) to ensure correct
* tagging in your context by overriding its algorithm.
*
* @param {string} entities[].text that must be detected as entity and may

@@ -298,0 +305,0 @@ * consist of more than one word; for example, **`India`** or **`United Kindom.`**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc