ngram

package
v0.0.0-...-45b5b11 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ngram

type Ngram struct {
	// contains filtered or unexported fields
}

Ngram is a struct for holding an ngram defined by the New() function below

func New

func New(n int, s string) *Ngram

New creates a new n, ngram over string s and fills in the appropriate data struct

func (*Ngram) Bytes

func (n *Ngram) Bytes() [32]byte

Bytes returns the byte represetation of the ngram hash

func (*Ngram) CalculateGrams

func (n *Ngram) CalculateGrams()

CalculateGrams will count and order the ngrams if they haven't been ordered yet, filling in the appropriate fields in the Ngram struct

func (*Ngram) Campbell4Hash

func (n *Ngram) Campbell4Hash() [32]byte

func (*Ngram) Campbell5Hash

func (n *Ngram) Campbell5Hash() [32]byte

func (*Ngram) NSpacedRareGrams

func (n *Ngram) NSpacedRareGrams(spacing, i int) []string

NSpacedRareGrams will return the i rarest ngrams that are at least spacing edit distance apart from each other

func (*Ngram) NthFrequentGram

func (n *Ngram) NthFrequentGram(i int) string

NthFrequentGram will return the ith most frequent ngram. For instance if the most frequent ngrams were ['asdf', 'sdfg', 'dfgh', ...] then NthFrequentGram(0) == 'asdf'

func (*Ngram) NthRareGram

func (n *Ngram) NthRareGram(i int) string

NthFrequentGram will return the ith least frequent ngram. For instance if the most frequent ngrams were [..., 'asdf', 'sdfg', 'dfgh'] then NthRareGram(0) == 'dfgh'

func (*Ngram) Sentence

func (n *Ngram) Sentence() string

func (*Ngram) String

func (n *Ngram) String() string

String will get a string representation of the ngram hash

Jump to

Keyboard shortcuts

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