Simple question: can NLP.js be used for the app I describe?
wktdev opened this issue · 0 comments
I am learning about thr NLP/LLM/AI domain and I have a small app I want to attempt to complete as a learning exercise. I simply want to know if nlp.js can be used to create the app. If not, what would I need?
Description
The app takes a small subset of user input text and transforms it into a reliable small useable JSON or JS data structure.
Details
The app revolves around these three words:
- site
- switch
- port
These three words reflect the following relationship:
Sites contain switches and switches contain ports. Ports of different switches connect to one another.
User Input
When the user inputs text involving the three key words above, the app needs to transform the text into simple code that reflects the users intent.
Example
If the user says a variation of this:
“On site 2 take switch 4 and connect it’s 3rd port to the 5th port on switch 9”
such as...
"On switch 4 connect port 3 to to port 5 on switch 9. Do this on site number 2 "
It should convert to something in code that reflects the relationship and can easily be parsed.
Both phrases would convert to the same thing. Something like this:
{
site: 2,
switches: [{
number: 4,
port: 3
}, {
number: 9,
port: 5
}],
connections: switches[0].to(switches[1])
}
The code above can be anything as long as it is a data structure that is consistent and keeps the same shape.
First, I am curious if nlp.js can accomplish this, my second question is, is there anything outside the instructions that might be useful or needed?
I know how to write JS and wire up web API's so I should be fine on that end.
Thank you