Skip to content

Instantly share code, notes, and snippets.

@jdkato
Created July 15, 2018 23:27
Show Gist options
  • Select an option

  • Save jdkato/099632098e3273fa56e2a5be77e7932c to your computer and use it in GitHub Desktop.

Select an option

Save jdkato/099632098e3273fa56e2a5be77e7932c to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"gopkg.in/jdkato/prose.v2"
)
func main() {
// Load our model, which we saved to a directory named "PRODUCT".
model := prose.ModelFromDisk("PRODUCT")
doc, err := prose.NewDocument(
"Windows 10 is a computer operating system released in 2015.",
prose.WithSegmentation(false),
prose.UsingModel(model))
if err != nil {
panic(err)
}
// Iterate over the doc's named-entities:
for _, ent := range doc.Entities() {
fmt.Println(ent.Text, ent.Label)
// Windows 10 PRODUCT
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment