Skip to content
Package assocentity returns the average distance from words to a given entity
Branch: master
Clone or download
Latest commit 804bdec May 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore feat: allow aliases Mar 25, 2019
.travis.yml ci: enable go modules May 12, 2019
LICENSE docs: add license Apr 7, 2019
README.md docs: add print result May 12, 2019
assocentity.go style: fix wording Mar 26, 2019
assocentity_test.go refactor: remove public error, function Mar 25, 2019
go.mod fix: version Mar 25, 2019
go.sum feat: allow aliases Mar 25, 2019

README.md

assocentity

Package assocentity returns the average distance from words to a given entity.

Features

  • Accepts a custom tokenizer
  • pass aliases to entity
  • provides a default tokenzier

Installation

$ go get github.com/ndabAP/assocentity/v2

API

Make(text string, entities []string, tokenizer func(string) ([]string, error)) (map[string]float64, error)

Usage

import (
    "fmt"

    "github.com/ndabAP/assocentity/v2"
)

func main() {
    text := "The quick brown fox jumps over the lazy dog"
    res, _ := assocentity.Make(text, []string{"fox"}, nil)

    fmt.Println(res) // map[The:3 brown:1 dog:5 jumps:1 lazy:4 over:2 quick:2 the:3]
}

Author

Julian Claus and contributors.

License

MIT

You can’t perform that action at this time.