Example Date/Time Extraction

node v14.20.1
version: master
endpointsharetweet
const winkNLP = require( 'wink-nlp' ); const its = require( 'wink-nlp/src/its.js' ); // Use web model for RunKit. const model = require( 'wink-eng-lite-web-model' ); const nlp = winkNLP( model ); const text = 'She was born in 1869. She died in 1940 at 4:32 AM PDT.'; const doc = nlp.readDoc( text ); // Print tokens. console.log( doc.tokens().out() ); // Print each token's type. console.log( doc.tokens().out( its.type ) ); // Print details of each entity. console.log( doc.entities().out( its.detail ) ); // Markup entities along with their type for highlighting them in the text. doc.entities().each( ( e ) => { e.markup( '<mark>', `<sub style="font-weight:900"> ${e.out(its.type)}</sub></mark>` ); } ); // Render them as HTML via RunKit doc.out( its.markedUpText );
Loading…

no comments

    sign in to comment