-
Notifications
You must be signed in to change notification settings - Fork 620
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
Question - How to run Entity extraction #1345
Comments
Here is an example using trimmed entity extraction - hope this helps. import { containerBootstrap } from "https://cdn.skypack.dev/@nlpjs/core@4.26.1";
import { Nlp } from "https://cdn.skypack.dev/@nlpjs/nlp@4.26.1";
import { LangEn } from "https://cdn.skypack.dev/@nlpjs/lang-en-min@4.26.1";
(async () => {
const container = await containerBootstrap();
container.use(Nlp);
container.use(LangEn);
const nlp = container.get('nlp');
nlp.settings.autoSave = false;
nlp.addLanguage('en');
nlp.slotManager.addSlot('travel', 'fromCity', true);
nlp.addDocument('en', 'I want to travel from %fromCity% to @toCity', 'travel')
nlp.addNerBetweenLastCondition('en', 'fromCity', 'from', 'to');
nlp.addNerAfterLastCondition('en', 'fromCity', 'from');
nlp.addNerBetweenLastCondition('en', 'toCity', 'to', 'from');
nlp.addNerAfterLastCondition('en', 'toCity', 'to');
nlp.slotManager.addSlot('travel', 'fromCity', true);
nlp.slotManager.addSlot('travel', 'toCity', true);
await nlp.train();
const response = await nlp.process('en', 'I want to travel from here to you go bro!');
console.log(response.entities[0].utteranceText); // Outputs: here
console.log(response.entities[1].utteranceText); // Outputs: you go bro!
})(); |
I have something in my mind, I'm not sure whether its right or not, what do you think about this https://vimeo.com/manage/videos/754241914 ? |
I have an idea and I’d like to experiment it with a model. Idea : teach a language or text based model with custom truths. Prompt - Give me list of words in the model At this point, you have built a system that can take your natural language as instruction to model, and we can instruct it to take a shape that we intend to. In other words, if I feed it grammar of a language, and the language, it runs against the grammar. If I feed it information on how to trace a control flow, then given a program, it can return information on the control flow that happens. So what I’m trying to ask is, a way to make the model programmable, in natural language, force tell it to correct itself. If I try to correct it, I would want to visually see it happening. so having a fact tree will help me understand the model and be sure whether it actually learnt or not. This also helps me to build a truth finder. First step is to build a fact tree, where, subject part of a sentence is an action that happened in the past, and verb part of a sentence is action. At the very core of this fact tree is an ultimate truth, which is movement, time, space, and more units can appear above from it. Since we define a fundamental unit to this fact tree, and making the fact tree visual, it has information about its visual structure in itself, giving an opportunity to make it reach the state of singularity, In the beginning it may be just a visual singularity or consiousness, just to make the focus ring of the model to always remain in the core because thats where the truth is. The more the focus ring spends time on a node, more the memory get strengthened. Terminology Fact tree - It changes shape visually. This is not performant technique. |
@imvetri - you will need to define a array and set context / memory to the bot. You can do something like define a utterance with slots like example "@thing is my @value". // GitHub is my favorite - let's say is the input and Use a statement to add those slots to your "memory". Then define another intent and utterance like something. "What is @value". If found in memory (ie: your array), return it. Else say "I do not know what @value is". For showing the memory - define another intent for that and call the function you create to show the memory. For a more advanced approach you could use another library to find all nouns etc, check if in list & see if any context. And if not in list. Return ``What is an experiment ``` - await input and add to memory etc. Hope this helps. Tho I highly doubt this will be added as a feature / implemented for you etc. You will need to do it yourself. Best of luck! |
No description provided.
The text was updated successfully, but these errors were encountered: