Help us shape the future of Go! Take the 2026 Go Developer Survey

text

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stats

type Stats struct {
	ChineseChars     int `json:"chinese_chars"`
	EnglishWords     int `json:"english_words"`
	WordCount        int `json:"word_count"` // 中文字符 + 英文单词
	LineCount        int `json:"line_count"`
	CharCountSpace   int `json:"char_count_space"`   // 计空格
	CharCountNoSpace int `json:"char_count_nospace"` // 不计空格
	ParagraphCount   int `json:"paragraph_count"`
}

Stats 是文本的详细统计信息。

func ComputeStats

func ComputeStats(s string) Stats

ComputeStats 返回文本的详细统计。单次遍历处理字符分类。

type WordChanges added in v1.6.1

type WordChanges struct {
	Added   int
	Deleted int
}

func ComputeWordChanges added in v1.6.1

func ComputeWordChanges(previous, current string) WordChanges

ComputeWordChanges 比较保存前后的中文字符和完整英文单词,不统计标点与空白。

Jump to

Keyboard shortcuts

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