TFIDF_Persistant

package module
v0.0.0-...-d6b129f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-tfidf-persistance

(IN PROGRESS) TFIDF in Go with support for persisting document frequency data

TFIDF is a useful measure for the salience of words in a document to the overall meaning of a document. It uses a formula that leverages information about the frequency of words both within a singular document as well as in a corpus of documents. It is widely applied in NLP tasks.

This library allows you to easily create and manage a corpus of documents for TFIDF and save it in a json format. This makes it very easy to perform TFIDF while simultaneously building up the overall document corpus, and quickly save/load this data to disk. It has two main functions, which allow you to get TFIDF scores for all words in a document and one that simply adds a document to the corpus (useful for initializing data)

In addition, it removes common english stopwords to isolate for truly relevant content

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNewFile

func CreateNewFile(path string) (*os.File, error)

Types

type TFIDFInstance

type TFIDFInstance struct {
	Name           string         `json:"Name"`
	Terms          map[string]int `json:"Terms"`
	TotalDocuments int            `json:"TotalDocuments"`
}

func LoadInstance

func LoadInstance(file os.File) (*TFIDFInstance, error)

func NewInstance

func NewInstance(name string) TFIDFInstance

func (TFIDFInstance) AddToCorpus

func (i TFIDFInstance) AddToCorpus(doc string, processed bool) error

func (TFIDFInstance) SaveToFile

func (i TFIDFInstance) SaveToFile(file os.File) error

func (TFIDFInstance) TFIDFScores

func (i TFIDFInstance) TFIDFScores(doc string, addToCorpus bool) (map[string]float64, error)

Jump to

Keyboard shortcuts

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