Duplication between CARDINAL and PERCENT entities #102
Replies: 1 comment
-
Hello @atwright147 The current code is detecting the following custom entities: Given the custom entity examples & the configuration — Now if you want to detect const winkNLP = require( 'wink-nlp' );
const model = require( 'wink-eng-lite-web-model' );
const nlp = winkNLP( model );
const its = nlp.its;
const as = nlp.as;
const examples = [
{
name: 'maths',
patterns: [
'CARDINAL',
'CCONJ',
'NUM',
'SYM',
'MONEY',
'plus',
'add',
'+',
'subtract',
'minus',
'-',
'multiply',
'times',
'x',
'divide',
'/',
'^PERCENT'
]
}
];
nlp.learnCustomEntities(examples, { matchValue: false, usePOS: true, useEntity: false });
const text = 'I want to know what 5 percent of 5 plus 10 minus 2 is';
const doc = nlp.readDoc( text );
doc.customEntities().each( ( e ) => {
e.markup( '<mark>', `<sub style="font-weight:900; font-size:0.6em"> ${e.out(its.type)}</sub></mark>` );
} );
doc.out( its.markedUpText ); The above code will produce the following output: While traversing tokens you can always use the For more details, please refer to the documentation. Best, |
Beta Was this translation helpful? Give feedback.
-
Given the following code:
I get the following:
The issue that I have is that the
5
is duplicated between index0
and1
. Is there a way to determine that the5
is from5 percent
?Is there a way to stop that
5
from appearing in the list if it was already captured by the'PERCENT'
entity?Beta Was this translation helpful? Give feedback.
All reactions