Is it possible to leverage a repeated pattern as a custom entity? #69
-
The question is ambiguous, so let me provide an example. I, effectively, want to leverage the Example: Custom Entity: The above custom entity will detect each proper noun as a separate custom entity. I would like a single entity that represents the entire list, which can have an arbitrary length. Is this possible? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Currently As a work around, you may like to try following code: const winkNLP = require( 'wink-nlp' );
const its = require( 'wink-nlp/src/its.js' );
const model = require( 'wink-eng-lite-web-model' );
const nlp = winkNLP( model );
const p = [
{ name: 'firstNameList', patterns: ['[PROPN] [|PUNCT|CCONJ] [|CCONJ]'] }
];
nlp.learnCustomEntities( p );
const text = 'Tom, Dana, James, Lily, and Ronan went to park. They met John and Mike in the park.';
const doc = nlp.readDoc( text );
doc.sentences().each( ( s ) => console.log( s.customEntities().out().join( ' ' ) ) )
// -> "Tom, Dana, James, Lily, and Ronan"
// -> "John and Mike" Note, the above code will work only if there is a single list per sentence! |
Beta Was this translation helpful? Give feedback.
Currently
+
regex operator like operation is not supported; it is there in our ToDos but so far we have not been able to devote time on this.As a work around, you may like to try following code: