Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Bad match ? #4

Closed
metal3d opened this issue Sep 18, 2017 · 2 comments
Closed

Bad match ? #4

metal3d opened this issue Sep 18, 2017 · 2 comments
Assignees
Labels

Comments

@metal3d
Copy link

metal3d commented Sep 18, 2017

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

@shixzie
Copy link
Owner

shixzie commented Sep 18, 2017

I'm looking into that, I'll let you know when it's fixed.

@shixzie shixzie self-assigned this Sep 18, 2017
@shixzie shixzie added the bug label Sep 18, 2017
@shixzie
Copy link
Owner

shixzie commented Sep 18, 2017

Release 0.1.9 is out, fixes this issue and adds some more additional tests.

@shixzie shixzie closed this as completed Sep 18, 2017
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants