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

Add type definitions for node-nlp #1369

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Aziz-AXG
Copy link

Add type definitions for node-nlp

This PR adds TypeScript type definitions for the node-nlp library.

What is included

  • Type definitions for the NlpManager class and its methods (addDocument, addAnswer, process, train).
  • Interfaces for Explanation, Classification, Answer, Sentiment, NluAnswer, and NlpResult.
  • A tsconfig.json for the type definitions.
  • Tests for the type definitions in node-nlp-tests.ts.

Why

Providing type definitions for node-nlp will improve type safety and developer experience for TypeScript users.

Reference

Copy link

sonarcloud bot commented Jun 15, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@Apollon77
Copy link
Contributor

Hi, Why you provider the types in a separate directory? This is a monorepo with many packages included, so types need to go into the relevant package directories and also added there to the package.json to be picked up at all, else they are not published and are not used at all

@Aziz-AXG
Copy link
Author

Aziz-AXG commented Jun 20, 2024

Hi, Why you provider the types in a separate directory? This is a monorepo with many packages included, so types need to go into the relevant package directories and also added there to the package.json to be picked up at all, else they are not published and are not used at all

do you mean I must add in
https://github.com/axa-group/nlp.js/tree/master/packages/node-nlp/src
as @types/index.d.ts file ?
and add "types": "src/@types/index.d.ts", to package.json ?

@Apollon77
Copy link
Contributor

Apollon77 commented Jun 20, 2024

Just do as index.d.ts in the src of that project. no need (in my eyes) for another types directly ... in my eyes types should be where the soitce files are if they should "match" them ... OR we ned to have one types file then we could also call it types.d.ts and use this ... that would be also clear. so easier to find and easier to see and keep current. And yes add then to package.json

@Aziz-AXG
Copy link
Author

Just do as index.d.ts in the src of that project. no need (in my eyes) for another types directly ... in my eyes types should be where the soitce files are if they should "match" them ... OR we ned to have one types file then we could also call it types.d.ts and use this ... that would be also clear. so easier to find and easier to see and keep current. And yes add then to package.json

like this ?

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

Successfully merging this pull request may close these issues.

None yet

2 participants