lang

package
Version: v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LanguagesSet = func() map[Language]string {
	res := make(map[Language]string)
	for k, v := range langMap {
		if k != None {
			res[k] = v
		}
	}
	return res
}()

LanguagesSet contains supported languages and their string representation.

Functions

func LangStrings added in v0.15.4

func LangStrings() []string

Types

type Language

type Language int

Language represents the language of a text.

const (
	None Language = iota
	English
	German
)

Set of languages. Last one is an indicator of the 'edge', as well as a default value for GnFinder.Language.

func DetectLanguage

func DetectLanguage(text []rune) (Language, string)

DetectLanguage finds the most probable language for a text.

func New added in v0.15.3

func New(s string) (Language, error)

New takes a string and returns a matching language. If string is "detect", returns lang.None. If language could not be found by the string, the function returns lang.English and an error.

func (Language) String

func (l Language) String() string

Source Files

Jump to

Keyboard shortcuts

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