question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

custom lexicon key with multiple words only partially matching

See original GitHub issue

Is this normal behavior? I was hoping any custom lexicon key of mine would override anything else. Any suggestions around it if it’s normal behavior?

let nlp = require('nlp_compromise');
let newLex = nlp.lexicon();
newLex['ser waymar royce'] = 'TARGETED_GUY';
console.log(nlp.sentence('Ser Waymar Royce asked cooly.', {lexicon: newLex}).terms);

is giving output

Noun {
    whitespace: { preceding: '', trailing: ' ' },
    text: 'Ser Waymar',
    normal: 'ser waymar',
    expansion: null,
    reasoning: [ 'fallback', 'capital_signal', 'chunked two-nouns' ],
    pos: { Noun: true },
    tag: 'Noun' },
  Person {
    whitespace: { preceding: '', trailing: ' ' },
    text: 'Royce',
    normal: 'royce',
    expansion: null,
    reasoning: [ 'capital_signal', 'lexicon_pass' ],
    pos: { Noun: true, Person: true, MalePerson: true },
    tag: 'MalePerson',
    honourific: null,
    firstName: 'Royce',
    middleName: '',
    lastName: null },
  Verb {
    whitespace: { preceding: '', trailing: ' ' },
    text: 'asked',
    normal: 'asked',
    expansion: null,
    reasoning: [ 'lexicon_pass' ],
    pos: { Verb: true, PastTense: true },
    tag: 'PastTense' },

etc…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Aug 26, 2017
1reaction
spencermountaincommented, Sep 13, 2016

hey brian, yuck. this seems like a bug for sure. it looks like the term ‘Royce’ is tripping it up because it’s already recognized as a first-name. There may be some lumping/splitting rule it’s colliding with, because of the first-name. Definitely not what it’s supposed to do… I can look at doing a hotfix this week. thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Is it possible to do a partial string match on a Dictionary ...
When you pull items out using two keys, you could use the LINQ Extension method Intersect() to get the items that match both...
Read more >
Smart Matching: Using a Dictionary | Using iKnow
Describes how iKnow can use a dictionary and a defined matching profile to identify full or partial matches with indexed text data.
Read more >
Create custom sensitive information types - Microsoft Learn
Prepare two files, like a Word document. One with content that matches the elements you specified in your sensitive information type and one ......
Read more >
Rule-based matching · spaCy Usage Documentation
Find phrases and tokens, and match entities. ... Each token can set multiple attributes like text value, part-of-speech tag or boolean flags.
Read more >
3 Processing Raw Text - NLTK
from __future__ import division # Python 2 users only >>> import nltk, re, ... 6 in the center row, and «^[a-fj-o]+$» will match...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found