Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "wink-ner", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Language agnostic named entity recognizer", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -19,2 +19,38 @@ # wink-ner | ||
```javascript | ||
// Load wink ner. | ||
var ner = require( 'wink-ner' ); | ||
// Create your instance of wink ner & use defualt config. | ||
var myNER = ner(); | ||
// Define training data. | ||
var trainingData = [ | ||
{ text: 'manchester united', entityType: 'club', uid: 'manu' }, | ||
{ text: 'manchester', entityType: 'city' }, | ||
{ text: 'U K', entityType: 'country', uid: 'uk' } | ||
]; | ||
// Learn from the training data. | ||
myNER.learn( trainingData ); | ||
// Since recognize() requires tokens, use wink-tokenizer. | ||
var winkTokenizer = require( 'wink-tokenizer' ); | ||
// Instantiate it and extract tokenize() api. | ||
var tokenize = winkTokenizer().tokenize; | ||
// Tokenize the sentence. | ||
var tokens = tokenize( 'Manchester United is a football club based in Manchester, U. K.' ) | ||
// Simply Detect entities! | ||
myNER.recognize( tokens ); | ||
// -> [ | ||
// { entityType: 'club', uid: 'manu', originalSeq: [ 'Manchester', 'United' ], value: 'manchester united', tag: 'word' }, | ||
// { value: 'is', tag: 'word' }, | ||
// { value: 'a', tag: 'word' }, | ||
// { value: 'football', tag: 'word' }, | ||
// { value: 'club', tag: 'word' }, | ||
// { value: 'based', tag: 'word' }, | ||
// { value: 'in', tag: 'word' }, | ||
// { 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' }, | ||
// { value: '.', tag: 'punctuation' } | ||
// ] | ||
``` | ||
### Documentation | ||
@@ -21,0 +57,0 @@ Check out the [named entity recognizer API documentation](http://winkjs.org/wink-ner/) to learn more. |
@@ -36,3 +36,3 @@ // wink-ner | ||
* // Load wink ner. | ||
* var tagger = require( 'wink-ner' ); | ||
* var ner = require( 'wink-ner' ); | ||
* // Create your instance of wink ner. | ||
@@ -277,6 +277,6 @@ * var myNER = ner(); | ||
* | ||
* It can be use to learn or update learnings incrementally; but it can not be | ||
* It can be used to learn or update learnings incrementally; but it can not be | ||
* used to unlearn or delete one or more entities. | ||
* | ||
* If duplicated entity definitions are enountered then all the entries except | ||
* If duplicate entity definitions are enountered then all the entries except | ||
* the **last one** are ignored. | ||
@@ -286,3 +286,3 @@ * | ||
* should be added as `'u s a'` — this ensure correct detection of | ||
* `U S A` or `U. S. A.` or `U.S.A.` as `USA.` | ||
* `U S A` or `U. S. A.` or `U.S.A.` as `USA` \[Refer to the example below\]. | ||
* | ||
@@ -294,3 +294,3 @@ * @param {object[]} entities — where each element defines an entity via | ||
* | ||
* In addition to these two properties, you may optionally defined two more | ||
* In addition to these two properties, you may optionally define two more | ||
* properties as described in the table below. Apart from these **4 properties**, | ||
@@ -317,7 +317,7 @@ * if any additional property is defined, the same is copied to the output | ||
* var trainingData = [ | ||
* { text: 'manchester united', entityType: 'club' }, | ||
* { text: 'manchester united', entityType: 'club', uid: 'manu' }, | ||
* { text: 'manchester', entityType: 'city' }, | ||
* { text: 'uk', entityType: 'country' } | ||
* { text: 'U K', entityType: 'country', uid: 'uk' } | ||
* ]; | ||
* learn( trainingData ); | ||
* myNER.learn( trainingData ); | ||
* // -> 3 | ||
@@ -461,4 +461,25 @@ */ | ||
* | ||
* @return {object[]} of updated `tokens.` | ||
* @return {object[]} of updated `tokens` with entities tagged. | ||
* @example | ||
* // Use wink tokenizer. | ||
* var winkTokenizer = require( 'wink-tokenizer' ); | ||
* // Instantiate it and use tokenize() api. | ||
* var tokenize = winkTokenizer().tokenize; | ||
* var tokens = tokenize( 'Manchester United is a professional football club based in Manchester, U. K.' ) | ||
* // Detect entities. | ||
* myNER.recognize( tokens ); | ||
* // -> [ | ||
* // { entityType: 'club', uid: 'manu', originalSeq: [ 'Manchester', 'United' ], value: 'manchester united', tag: 'word' }, | ||
* // { value: 'is', tag: 'word' }, | ||
* // { value: 'a', tag: 'word' }, | ||
* // { value: 'professional', tag: 'word' }, | ||
* // { value: 'football', tag: 'word' }, | ||
* // { value: 'club', tag: 'word' }, | ||
* // { value: 'based', tag: 'word' }, | ||
* // { value: 'in', tag: 'word' }, | ||
* // { value: 'Manchester', tag: 'word', originalSeq: [ 'Manchester' ], uid: 'manchester', entityType: 'city' }, | ||
* // { value: ',', tag: 'punctuation' }, | ||
* // { entityType: 'country', uid: 'uk', originalSeq: [ 'U', '.', 'K' ], value: 'u k', tag: 'word' }, | ||
* // { value: '.', tag: 'punctuation' } | ||
* // ] | ||
*/ | ||
@@ -465,0 +486,0 @@ var recognize = function ( tokens ) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60205
547
68