Documentation ¶
Overview ¶
Package fresheye provides a way to find paronyms in Russian text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextSize ¶
func ContextSize(n int) option
ContextSize option sets the size of a window within which the words will be compared to each other. With size = 1, each word will be compared to its left and right neighbor only.
func ExcludeProperNames ¶
func ExcludeProperNames(ex bool) option
ExcludeProperNames option sets whether words starting with a capital letter and not at the beginning of a sentence should be reported.
func SensitivityThreshold ¶
func SensitivityThreshold(n int) option
SensitivityThreshold option sets the threshold for badness so that word pairs with badness below the threshold won't be reported.
Types ¶
type BadPair ¶
type BadPair struct { Badness float64 First, Second WordDescriptor }
BadPair is a word pair and a measure of similarity (badness) of these words.
func Check ¶
func Check(it WordIterator, options ...option) []BadPair
Check returns a slice of bad word pairs.
type Colorizer ¶
type Colorizer struct {
// contains filtered or unexported fields
}
Colorizer is a way to assign colors to words given a slice of bad word pairs.
func NewColorizer ¶
NewColorizer returns a Colorizer with a given sensitivity threshold.
type SimpleWordDescriptor ¶
type SimpleWordDescriptor struct {
// contains filtered or unexported fields
}
SimpleWordDescriptor describes the position of a word in a string.
func (*SimpleWordDescriptor) End ¶
func (w *SimpleWordDescriptor) End() int
End returns the end position of a word in text.
func (*SimpleWordDescriptor) Start ¶
func (w *SimpleWordDescriptor) Start() int
Start returns the start position of a word in text.
type WordDescriptor ¶
WordDescriptor describes the position of a word in text.
func WordDescriptors ¶
func WordDescriptors(bad []BadPair) []WordDescriptor
WordDescriptors extracts unique word descriptors from a slice of bad word pairs.
type WordIterator ¶
type WordIterator interface { Next() bool Word() string Sep() string ParagraphStart() bool Descriptor() WordDescriptor }
WordIterator returns words one by one.
func NewSimpleWordIterator ¶
func NewSimpleWordIterator(text string) WordIterator
NewSimpleWordIterator returns a WordIterator that will return words from text one by one.