Skip to content

Respect tag rules for custom tags #1155

@tony-scio

Description

@tony-scio

I'd like to be able to define custom tags that are applied only if their allowed parts of speech are respected. It looks like the plugin interface tries to support that, but it doesn't seem to be working. Wondering if this is a bug, feature request, or if there's another way to accomplish this. Here's what I tried:

nlp.plugin({
  tags: {
    Employee: {
      also: ['ProperNoun'],
      not: ['Verb', 'Adverb', 'Adjective'],
    },
  },
  words: {
    will: 'Employee',
  },
})

nlp('Will is an employee').match('#Employee') // Matches like I expect.
nlp('I will go to the store').match('#Employee') // Matches, but I expected not to match since "will" is used as a verb and "Employee" is defined not to be a verb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions