icanhazwordz

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 2 Imported by: 0

README

icanhazwordz

does this string contain words?

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFilter = Filter{MinLength: 2, MaxLength: 0}

Default filter ignores single character words. If you want to include them, set MinLength to 1.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	MinLength   int `json:"min_length"`   // Minimum word length (inclusive)
	MaxLength   int `json:"max_length"`   // Maximum word length (inclusive, 0 means no limit)
	ExactLength int `json:"exact_length"` // Exact word length (0 means no exact match required)
}

Filter defines criteria for filtering words

type Match

type Match struct {
	Word     string `json:"word"`
	StartPos int    `json:"start_pos"`
	EndPos   int    `json:"end_pos"`
}

Match represents a found word match

type Result

type Result struct {
	WordCount   int      `json:"word_count"`
	UniqueWords []string `json:"unique_words"`
	AllMatches  []Match  `json:"all_matches"`
}

Result represents the result of English word detection

type Searcher

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

Searcher provides English word detection with configurable filters

func NewSearcher

func NewSearcher(filter Filter) *Searcher

NewSearcher creates a new searcher with the specified word filters

func (*Searcher) Find

func (s *Searcher) Find(text string) Result

Find analyzes text using this searcher's word list

func (*Searcher) GetWordCount

func (s *Searcher) GetWordCount() int

GetWordCount returns the number of words in this searcher's dictionary

func (*Searcher) GetWords

func (s *Searcher) GetWords() []string

GetWords returns all words in this searcher's dictionary

Jump to

Keyboard shortcuts

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