index

package
v0.0.0-...-ab36419 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2014 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

A very simply sorted map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doc

type Doc interface {
	GetText() string
	TF() map[string]int
}

type Document

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

func (*Document) Text

func (doc *Document) Text() (text string)

func (*Document) TokenFrequency

func (doc *Document) TokenFrequency() (tokenFrequency map[string]int)

type Inverted

type Inverted struct {
	NumDocuments uint64
	NumTokens    uint64
	// contains filtered or unexported fields
}

func NewInvertedIndex

func NewInvertedIndex() *Inverted

func (*Inverted) AddDocument

func (i *Inverted) AddDocument(d Doc)

func (*Inverted) GetDocs

func (i *Inverted) GetDocs(term string) []Doc

func (*Inverted) IDF

func (i *Inverted) IDF(n string) float64

func (*Inverted) RemoveDocument

func (i *Inverted) RemoveDocument(d Doc)

TODO: Update word count to reflect removed documents?

func (*Inverted) Reset

func (i *Inverted) Reset() *Inverted

func (*Inverted) TF

func (i *Inverted) TF(n string) uint64

type SortedMap

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

func NewSortedMap

func NewSortedMap() *SortedMap

func (*SortedMap) Dec

func (m *SortedMap) Dec(item key, amount val) (newValue val)

func (*SortedMap) Get

func (m *SortedMap) Get(item key) val

func (*SortedMap) Inc

func (m *SortedMap) Inc(item key, amount val) (newValue val)

func (*SortedMap) OrderedKeys

func (m *SortedMap) OrderedKeys() []key

func (*SortedMap) Put

func (m *SortedMap) Put(item key, value val)

func (*SortedMap) Remove

func (m *SortedMap) Remove(item key)

Jump to

Keyboard shortcuts

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