core

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDocument

type BaseDocument struct {
	Name    DocumentID `json:"id"`
	Content string     `json:"text"`
}

func NewBaseDocument

func NewBaseDocument(id DocumentID, text string) BaseDocument

func (BaseDocument) ID

func (d BaseDocument) ID() string

func (BaseDocument) Text

func (d BaseDocument) Text() string

type Document

type Document interface {
	ID() DocumentID
	Text() string
}

type DocumentData

type DocumentData struct {
	Doc         Document
	TermsCount  float64
	Frequencies TermFrequency
}

type DocumentID

type DocumentID = string

type DocumentScore

type DocumentScore struct {
	Doc   Document
	Score float64
}

func (DocumentScore) String

func (ds DocumentScore) String() string

type FloatHeap

type FloatHeap []FloatHeapItem

https://golang.org/pkg/container/heap

func (FloatHeap) Len

func (h FloatHeap) Len() int

func (FloatHeap) Less

func (h FloatHeap) Less(i, j int) bool

func (*FloatHeap) Pop

func (h *FloatHeap) Pop() interface{}

func (*FloatHeap) Push

func (h *FloatHeap) Push(x interface{})

func (FloatHeap) Swap

func (h FloatHeap) Swap(i, j int)

type FloatHeapItem

type FloatHeapItem struct {
	Key   interface{}
	Value float64
}

type TermFrequency

type TermFrequency map[string]float64

TermFrequency stores relative or absolute term frequencies

func NewTermFrequency

func NewTermFrequency(terms []string) TermFrequency

func (TermFrequency) Top

func (tf TermFrequency) Top(n int) []FloatHeapItem

Jump to

Keyboard shortcuts

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