Code Monkey home page Code Monkey logo

nlp's People

Contributors

shixzie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlp's Issues

error in examples_test.go

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)
	}

Multiple models ?

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 ?

Question around ignoring trailing text

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.

How I can save/load the learned things?

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?

extension to allow learning feedback loop at runtime.

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.

  • if the user immediately pressed the back button after the result was given.
  • ask the user with a thumb up or down occasionally.
  • maybe some others

This is just an idea i have seen on other machine learning systems. Curious what you think.

Bad match ?

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...

Can you register multiple models for one parser?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.