This project is a light backend service made with Express.js & Fuse.js, to extract device, component, and issue information from user input. It is intended to work as an entity extraction layer for IBM watsonx Assistant.
- Data used to identify devices, components, and issues are stored in the issueDefinitions.json
- First, it uses regular experessions with word boundaries (
\b) to identify the device - If a specific component exists, it is also identified in the same manner from the user's text. (Case insensitive)
- Once a device and component is identified, it narrows down list of possible items
- Fuse.js library is used to find most relevent issue keyword from the filtered list within user input. Hence flexbilitiy of phrasing and misspellings are allowed.
- The detected device, component, and best matched issue with description and solution is returned.
POST endpoint: https://mai-entity-extraction.vercel.app/extract
GET endpoint: https://mai-entity-extraction.vercel.app/health
To use the /extract endpoint, send a JSON payload with a text field in the body:
{
"text": "my laptop battery drains fast"
}
GET endpoint: https://mai-entity-extraction.vercel.app/studentId