File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 4848 "nyc" : " ^15.1.0" ,
4949 "mocha" : " ^8.2.1"
5050 },
51+ "runkitExampleFilename" : " ./runkit-example.js" ,
5152 "dependencies" : {}
5253}
Original file line number Diff line number Diff line change 1+ const winkNLP = require ( 'wink-nlp' ) ;
2+ const its = require ( 'wink-nlp/src/its.js' ) ;
3+ // Use web model for RunKit.
4+ const model = require ( 'wink-eng-lite-web-model' ) ;
5+ const nlp = winkNLP ( model ) ;
6+
7+ const text = 'Its quarterly profits jumped 76% to $1.13 billion for the three months to December, from $639million of previous year.' ;
8+ const doc = nlp . readDoc ( text ) ;
9+ // Print tokens.
10+ console . log ( doc . tokens ( ) . out ( ) ) ;
11+ // Print each token's type.
12+ console . log ( doc . tokens ( ) . out ( its . type ) ) ;
13+ // Print details of each entity.
14+ console . log ( doc . entities ( ) . out ( its . detail ) ) ;
15+ // Markup entities along with their type for highlighting them in the text.
16+ doc . entities ( ) . each ( ( e ) => {
17+ e . markup ( '<mark>' , `<sub style="font-weight:900"> ${ e . out ( its . type ) } </sub></mark>` ) ;
18+ } ) ;
19+ // Render them as HTML via RunKit
20+ doc . out ( its . markedUpText ) ;
You can’t perform that action at this time.
0 commit comments