shixzie / nlp Goto Github PK
View Code? Open in Web Editor NEW[UNMANTEINED] Extract values from strings and fill your structs with nlp.
License: MIT License
[UNMANTEINED] Extract values from strings and fill your structs with nlp.
License: MIT License
Try run function ExampleClassifier_Classify from file
examples_test.go
and fail with error
panic: register at least one class before learning
in place
err = cls.Learn()
if err != nil {
panic(err)
}
How much RAM does this awesome library consume in most cases?
Hello,
I'm now facing another problem, I wanted to register several models to find many information, here is the problem:
package main
import (
"fmt"
"time"
"github.com/shixzie/nlp"
)
type Person struct {
Name string
}
type Job struct {
Name string
Since time.Time
}
func main() {
nl := nlp.New()
jobSample := []string{
"I'm {Name}",
"I'm {Name} since {Since}",
}
persSample := []string{
"my name is {Name}",
"call me {Name}",
}
err := nl.RegisterModel(Job{}, jobSample, nlp.WithTimeFormat("2006"))
if err != nil {
panic(err)
}
err = nl.RegisterModel(Person{}, persSample, nlp.WithTimeFormat("2006"))
if err != nil {
panic(err)
}
err = nl.Learn()
if err != nil {
panic(err)
}
p := nl.P("Hi, my name is Patrice")
fmt.Printf("%T, %+v\n", p, p)
p = nl.P("Hi, I'm engeneer")
fmt.Printf("%T, %+v\n", p, p)
p = nl.P("Hi, my name is Patrice and I'm engeneer since 2001")
fmt.Printf("%T, %+v\n", p, p)
}
That sounds ok becaus nl.P() doesn't return a slice. But that cans be problematic if we want to fetch many information to bind them together.
So I have that responses:
*main.Person, &{Name:Patrice}
*main.Job, &{Name:engeneer Since:0001-01-01 00:00:00 +0000 UTC}
*main.Job, &{Name:engeneer Since:2001-01-01 00:00:00 +0100 CET}
One more time, I will try to find some time to help if I can, but is there any plan to change that kind of behavior ?
Hi!
Thank you for pulling together this awesome library.
I have a question related to trailing text.
Let's say that I'm using the model from the README, and I have the following input:
s := nl.P("hello sir can you pleeeeeease play King by Lauren Aquilina ????")
I would like ????
to be considered trash so the artist remains Lauren Aquilina
. Is there a way to train the model in that way ? I was trying to play with the limits, but no luck.
Assuming that I can have many models and each one with a lot of samples, how I can store the learned things, so I can store it in some file and later on i can read from the file?
the current Learn option learns off a fixed set of data if i understand this ?
this is also at design time, which makes sense.
what about at runtime though where we have a HITL (Human in the loop).
With any learning algo, it can be helpful for the NLP to get feedback on how well it is learning from the user. This is more run time learning.
There are lots of subtle ways of getting that positive or negative feedback.
This is just an idea i have seen on other machine learning systems. Curious what you think.
There is something that goes wrong when I use that example:
package main
import (
"fmt"
"time"
"github.com/shixzie/nlp"
)
type Need struct {
Name string
Since time.Time
}
func main() {
nl := nlp.New()
needSample := []string{
"I need {Name} since {Since}",
}
err := nl.RegisterModel(Need{}, needSample, nlp.WithTimeFormat("2006"))
if err != nil {
panic(err)
}
err = nl.Learn()
if err != nil {
panic(err)
}
p := nl.P("Hi, I am Patrice, I need water since 2001")
fmt.Println(p)
It only get "since" for a "Need" but doesn't match "water". If I remove "I am", or "I" from "I am", so I get "water" and "2001".
I don't have the time to check what goes wrong, if you can...
I've tried and all I seem to get out of the parser is the type and model that was registered with the parser first. For example:
nl = nlp.New()
checkErr(nl.RegisterModel(ShutdownAction{}, rundata.Samples["shutdown"]))
checkErr(nl.RegisterModel(MuteAction{}, rundata.Samples["mute"]))
nl.Learn()
nl.P()
will always return a ShutdownAction{}
, regardless of whether or not the text fed to nl.P()
matched any part of the samples provided in rundata.Samples["shutdown"]
.
It's not that big of a hardship if I can't, it's just that I would prefer to do it this way and use a type switch than try to use keywords to determine which model I should use to evaluate the input. (I'm working on a chatbot for a Discord server and I'd prefer interactions to be more conversational than having a strict command syntax.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.