textcat

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: BSD-2-Clause Imports: 7 Imported by: 3 modules, 4 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

A Go package for n-gram based text categorization, with support for utf-8 and raw text.

To do:

  • write documentation
  • make it faster

Keywords: text categorization, language detector

Install

go get github.com/pebbe/textcat
go get github.com/pebbe/textcat/textcat
go get github.com/pebbe/textcat/textpat

Docs

Documentation

Overview

A Go package for n-gram based text categorization, with support for utf-8 and raw text.

Many built-in language models are based on frequency lists, see:

http://en.wiktionary.org/wiki/Wiktionary:Frequency_lists

Most of these lists are based on www.opensubtitles.org, see:

http://invokeit.wordpress.com/frequency-word-lists/
https://skydrive.live.com/?cid=3732e80b128d016f&id=3732E80B128D016F%213584

Languages: af ar bg ca cs cy da de el en es et eu fa fi fr he hr hu id is it lt lv mk ms nl no pl pt ro ru sk sl sq sr sr-latin sv tr uk ur

Other language models are based on texts collected from Wikipedia.

Languages: eo fy ga gd hi ia ja kk ko la lb sw ta tl vi vo yi yo zh

Index

Constants

View Source
const (
	MaxPatterns = 400
)

Variables

This section is empty.

Functions

func GetPatterns

func GetPatterns(s string, useRunes bool) []*countType

Types

type TextCat

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

func NewTextCat

func NewTextCat() *TextCat

func (*TextCat) ActiveLanguages

func (tc *TextCat) ActiveLanguages() []string

func (*TextCat) AddLanguage

func (tc *TextCat) AddLanguage(language, filename string) error

Add language created by 'textpat' in package github.com/pebbe/textcat/textpat

func (*TextCat) AvailableLanguages

func (tc *TextCat) AvailableLanguages() []string

func (*TextCat) Classify

func (tc *TextCat) Classify(text string) (languages []string, err error)

func (*TextCat) DisableAllRawLanguages

func (tc *TextCat) DisableAllRawLanguages()

func (*TextCat) DisableAllUtf8Languages

func (tc *TextCat) DisableAllUtf8Languages()

func (*TextCat) DisableLanguages

func (tc *TextCat) DisableLanguages(language ...string)

func (*TextCat) EnableAllRawLanguages

func (tc *TextCat) EnableAllRawLanguages()

func (*TextCat) EnableAllUtf8Languages

func (tc *TextCat) EnableAllUtf8Languages()

func (*TextCat) EnableLanguages

func (tc *TextCat) EnableLanguages(language ...string)

func (*TextCat) GetMaxCandidates

func (tc *TextCat) GetMaxCandidates() int

func (*TextCat) GetMinDocSize

func (tc *TextCat) GetMinDocSize() int

func (*TextCat) GetThresholdValue

func (tc *TextCat) GetThresholdValue() float64

func (*TextCat) SetMaxCandidates

func (tc *TextCat) SetMaxCandidates(maxCandidates int)

func (*TextCat) SetMinDocSize

func (tc *TextCat) SetMinDocSize(minDocSize int)

func (*TextCat) SetThresholdValue

func (tc *TextCat) SetThresholdValue(thresholdValue float64)

func (*TextCat) SetVerbose

func (tc *TextCat) SetVerbose(verbose bool)

Directories

Path Synopsis
The `bootstrap` program is used to generated language patterns and store them as the Go source file `../data.go`.
The `bootstrap` program is used to generated language patterns and store them as the Go source file `../data.go`.
The program `textcat` is for classifying text by language.
The program `textcat` is for classifying text by language.
The program `textpat` creates language patterns that can be loaded into running Go programs that are using the textcat library.
The program `textpat` creates language patterns that can be loaded into running Go programs that are using the textcat library.

Jump to

Keyboard shortcuts

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