Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 2.0.2 to 2.1.0

8

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

@@ -33,8 +33,8 @@ "keywords": [

"coveralls": "^3.0.3",
"docdash": "winkjs/docdash",
"docdash": "github:winkjs/docdash",
"docker": "^1.0.0",
"eslint": "^5.16.0",
"eslint": "^6.8.0",
"istanbul": "^1.1.0-alpha.1",
"jsdoc": "^3.5.5",
"mocha": "^6.1.3",
"mocha": "^7.0.0",
"mocha-lcov-reporter": "^1.3.0"

@@ -41,0 +41,0 @@ },

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

var ner = require( 'wink-ner' );
// Create your instance of wink ner & use defualt config.
// Create your instance of wink ner & use default config.
var myNER = ner();

@@ -100,4 +100,4 @@ // Define training data.

**wink-ner** is copyright 2017-19 [GRAYPE Systems Private Limited](http://graype.in/).
**wink-ner** is copyright 2017-20 [GRAYPE Systems Private Limited](http://graype.in/).
It is licensed under the terms of the MIT License.
// wink-ner
// Language agnostic named entity recognizer
//
// Copyright (C) 2017-19 GRAYPE Systems Private Limited
// Copyright (C) 2017-20 GRAYPE Systems Private Limited
//

@@ -141,2 +141,3 @@ // This file is part of “wink-ner”.

validTags.unknown = true;
validTags.symbol = true;

@@ -408,40 +409,31 @@ cfg.tagsToIgnore = Object.create( null );

// If ignorable then simply follow the next iteration, after saving the
// current value into the original sequence of tokens; otherwise if
// token is a word or number save it in words else just reset & break!
// current value into the original sequence of tokens; otherwise
// save it in words else just reset & break!
if ( isIgnorable( value, tag ) ) {
originalSeq.push( value );
} else if ( tag === 'word' || tag === 'number' ) {
// `word` and `number` tags form entities, include them in `words`,
// while ensuring `words` receive normalized value.
words.push( normalize( value ) );
// Here `value` must go **as is**.
originalSeq.push( value );
} else {
// Can not be ignored: reset & break!
words = [];
originalSeq = [];
break;
}
} else {
// Ensure `words` receive normalized value.
words.push( normalize( value ) );
// Here `value` must go **as is**.
originalSeq.push( value );
}
} // for ( k = i... )
if ( words.length > 0 ) {
entity = multiWordEntities[ words.join( ' ' ) ];
if ( !entity ) {
words.push( singularize( words.pop() ) );
entity = multiWordEntities[ words.join( ' ' ) ];
if ( !entity ) {
words.push( singularize( words.pop() ) );
}
entity = multiWordEntities[ words.join( ' ' ) ];
}
if ( entity ) {
// Copy the entity into the merged token.
mergedToken = copyKVPs( Object.create( null ), entity );
// Save original sequence of tokens that were detected as an entity.
mergedToken.originalSeq = originalSeq;
// If id is missing, create id by joining `words`.
mergedToken.uid = entity.uid || words.join( '_' );
// If value was not defined, default to words.
mergedToken.value = mergedToken.value || words.join( ' ' );
// move the next token's index — `nti` to `k`.
return { token: mergedToken, nti: k };
}
if ( entity ) {
// Copy the entity into the merged token.
mergedToken = copyKVPs( Object.create( null ), entity );
// Save original sequence of tokens that were detected as an entity.
mergedToken.originalSeq = originalSeq;
// If id is missing, create id by joining `words`.
mergedToken.uid = entity.uid || words.join( '_' );
// If value was not defined, default to words.
mergedToken.value = mergedToken.value || words.join( ' ' );
// move the next token's index — `nti` to `k`.
return { token: mergedToken, nti: k };
}

@@ -529,3 +521,3 @@

t = tokens[ i ];
if ( t.tag === 'word' ) {
if ( !cfg.tagsToIgnore || !cfg.tagsToIgnore[ t.tag ] ) {
// Look up for the word; if not found try its base form.

@@ -720,1 +712,10 @@ let value = t.value;

module.exports = ner;
var x = ner();
var t = require( 'wink-tokenizer' )().tokenize;
x.learn(
[
{ text: 'f - 16', entityType: 'plane' }
]
);
x.recognize( t( '-p' ) );

Sorry, the diff of this file is not supported yet

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