nlp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package nlp enables natural language processing through functions around tokenization and stemming.

Index

Constants

This section is empty.

Variables

View Source
var QuoteEscapeRegex = regexp.MustCompile(`([^\\]([\\]{2})*)\\"`)

QuoteEscapeRegex replaces escaped quotes except if it is preceded by a literal backslash, e.g. "\\" should translate to a quoted element whose value is \

Functions

func StemTokens

func StemTokens(tokens []string) []string

StemTokens returns the porter2 (snowball) stems for each token passed into it.

func TokenizeSentence

func TokenizeSentence(sent string) []string

TokenizeSentence returns a sentence broken into tokens. Tokens are individual words as well as punctuation. For example, "Hi! How are you?" becomes []string{"Hi", "!", "How", "are", "you", "?"}

Types

type SIT

type SIT int

SIT is a Structured Input Type. It corresponds to either a Command or an Object with additional Structured Input Types to be added later.

type StringSlice

type StringSlice []string

StringSlice replaces []string, adding custom sql support for arrays in lieu of pq.

func (StringSlice) Last

func (s StringSlice) Last() string

Last safely returns the last item in a StringSlice, which is most often the target of a pronoun, e.g. (In "Where is that?", "that" will most often refer to the last Object named in the previous sentence.

func (*StringSlice) Scan

func (s *StringSlice) Scan(src interface{}) error

Scan converts to a slice of strings. See: http://www.postgresql.org/docs/9.1/static/arrays.html#ARRAYS-IO

func (StringSlice) String

func (s StringSlice) String() string

String converts a StringSlice into a string with each word separated by spaces.

func (StringSlice) StringSlice

func (s StringSlice) StringSlice() []string

StringSlice converts a StringSlice into a []string.

func (StringSlice) Value

func (s StringSlice) Value() (driver.Value, error)

Value converts to a slice of strings. See: http://www.postgresql.org/docs/9.1/static/arrays.html#ARRAYS-IO

type StructuredInput

type StructuredInput struct {
	Commands StringSlice
	Objects  StringSlice
}

StructuredInput is generated by Ava and sent to plugins as a helper tool. Additional fields should be added, covering Times, Places, etc. to make plugin development even easier. Note that right now People is unused.

Jump to

Keyboard shortcuts

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