assocentity

package module
v2.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2019 License: MIT Imports: 3 Imported by: 0

README

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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Make

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

Make accepts a text, entities including aliases and a tokenizer which defaults to an English tokenizer.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL