Documentation
¶
Overview ¶
Package morph provides a simple morphological analyzer for Russian language, using the compiled dictionaries from pymorphy2.
Example ¶
words, norms, tags := Parse("криком")
for i := range words {
fmt.Println(words[i], norms[i], tags[i])
}
Output: криком крик NOUN,inan,masc sing,ablt
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrAlreadyInitialized = errors.New("already initialized")
)
Functions ¶
func Init ¶
func Init() error
Init tries to find the path to the installed pymorphy2 dictionaries by invoking python and calls InitWith with the found directory.
func InitWithFS ¶ added in v1.0.2
InitWithFS loads the pymorphy2 dictionary data from the given directory in the fsys filesystem.
func Parse ¶
Parse analyzes the (lowercase) word and returns three slices of the same length. Each triple (words[i], norms[i], tags[i]) represents an analysis, where: - words[i] is the word with the letter ё fixed; - norms[i] is the normal form of the word; - tags[i] is the grammatical tag, consisting of the word's grammemes. The analyzes are sorted by probability (the first one is the most probable).
func XParse ¶
XParse analyzes the word (which might not be in the dictionary) and returns three slices of the same length. Each triple (words[i], norms[i], tags[i]) represents an analysis, where: - words[i] is the word with the letter ё fixed; - norms[i] is the normal form of the word; - tags[i] is the grammatical tag, consisting of the word's grammemes. If the word is in the dictionary, XParse is equivalent to Parse. Otherwise it tries several other analyzers to analyze the unknown word.
Types ¶
This section is empty.