detect

package
v0.0.0-...-9f27d82 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QuestionDetection

type QuestionDetection int

QuestionDetection type of message detection.

const (
	// QuestionBoth ignores if the message is a question or not
	QuestionBoth QuestionDetection = iota

	// QuestionOnly only detect if sentence ends with a question mark
	QuestionOnly

	// QuestionNo only detect if sentence doesn't end with a question mark
	QuestionNo
)

type SentenceDetector

type SentenceDetector struct {
	Question QuestionDetection
	Groups   []WordGroup
	Variants []SentenceDetector
}

SentenceDetector criteria for specific sentence detection.

func (*SentenceDetector) Detect

func (d *SentenceDetector) Detect(sentence string) bool

Detect if the given sentence matches the criteria of the SentenceDetector.

type WordGroup

type WordGroup struct {
	Negate bool
	Words  []string
}

WordGroup a group of words of the same type used for sentence detection.

func (*WordGroup) Detect

func (d *WordGroup) Detect(sentence string) (int, bool, bool)

Detect if the given list of words matches the WordGroup.

Jump to

Keyboard shortcuts

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