Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NerManager is not a constructor #1178

Closed
jamesst78 opened this issue Aug 28, 2022 · 12 comments
Closed

NerManager is not a constructor #1178

jamesst78 opened this issue Aug 28, 2022 · 12 comments

Comments

@jamesst78
Copy link

Hello, I'm currently using the code in the NER documentation page

const { NerManager } = require('node-nlp');

const manager = new NerManager({ threshold: 0.8 });

I get an error from node that NerManager is not a constructor. I can't even find the named import of NerManager in the node-nlp package. Can I please get some help?

@Apollon77
Copy link
Contributor

Yes, the nre manager is currently not exported on the main module. What you want to do?

@jamesst78
Copy link
Author

I'd like to setup some NER enums like the documentation page supplied here with the spiderman example
https://github.com/axa-group/nlp.js/blob/master/docs/v3/ner-manager.md

@Apollon77
Copy link
Contributor

Yes ... this is the v3 documentation :-)) I started providing v4 docs in one of my PRs ... maybe try like https://github.com/axa-group/nlp.js/pull/1171/files#diff-6e3a555ca9a8cfee3e84d492bc5db05702d7d2a6508afc7098a6ce9c60cf46da ... not reviewed so far, but working for me

@trsh
Copy link

trsh commented Nov 11, 2022

@Apollon77 the documentations is weak compared to v3. No full examples. No idea how to findEntities after setting up rules.

@Apollon77
Copy link
Contributor

@trsh Yes you are right ... In my PRs there is some more (doid you had a look?) but also this is hanging around now for months. In fact experiment and if you understood it then send in a PR to add documetation :-)

To your exact question: What exactly you want to do?

@trsh
Copy link

trsh commented Nov 11, 2022

@trsh Yes you are right ... In my PRs there is some more (doid you had a look?) but also this is hanging around now for months. In fact experiment and if you understood it then send in a PR to add documetation :-)

To your exact question: What exactly you want to do?

Set rules and get entities, just like in v3

@trsh
Copy link

trsh commented Nov 11, 2022

So far

const { dockStart } = require('@nlpjs/basic');

(async () => {
  const dock = await dockStart({ use: ['Basic'] });
  const manager = dock.get('nlp');
  manager.addNerRegexRule('en', 'ownEmail', '/\\b(\\w[-._\\w]*\\w@\\w[-._\\w]*\\w\\.\\w{2,3})\\b/gi');
  manager.findEntities(
    'I saw spiderman eating speghetti in the city and his mail is spiderman@gmial.com',
    'en',
  ).then(entities => console.log(entities));

but findEntities is from v3 and aint working.

@Apollon77
Copy link
Contributor

it shoudl be extractEntities(locale, utterance, context, settings)

@trsh
Copy link

trsh commented Nov 11, 2022

Looks like renamed to extractEntities. However the fact, that this repo maintainers do not care about updating documentation for months, makes me reach for alternatives. This will be blocker 1, then will fallow 2 and so on, ending up digging into the source code of the library.

@Apollon77
Copy link
Contributor

On one hand: "that this repo maintainers" is a bit "too short tought" ... you know ... open source projects ... community ... working together ;-) But you are right that there should be still time to check community contributions. I already send them an email

On other hand: If you find a maintained one in the JavaScript/Node.js language with a comparable featureset please tell me ... I was not able to find any

@trsh
Copy link

trsh commented Nov 11, 2022

@Apollon77 one more question. If I provide the rules in json, like

{
    ...,
    "entities": {
        "ownEmail": "/\\b(\\w[-._\\w]*\\w@\\w[-._\\w]*\\w\\.\\w{2,3})\\b/gi"
    },
    ...
}

how do I feed it to the manager?

@Apollon77
Copy link
Contributor

For complete usage use corpus jsons like https://github.com/axa-group/nlp.js/pull/1171/files#diff-eba11f3b2ea9073c83d911e970dd4c2d15d211fad3de2afee47d05e02a3c7f60R15

To just bring in entities then it could work using addEntities(entities, locale) (entities must be the JSON-parsed content of "entities")

@aigloss aigloss closed this as completed Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants