words

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package words 套用识别词:解析标题之前屏蔽或替换文字,解析之后按规则偏移集数。

Index

Constants

View Source
const (
	MaxPatternLen = 256
	MaxOffset     = 9999
)

识别词的长度与偏移上限。

Variables

This section is empty.

Functions

func Validate

func Validate(r models.MediaWordRule) error

Validate 检查一条识别词:种类、非空的匹配文字、正则能编译、集数偏移不为 0 且在范围内。

Types

type Applied

type Applied struct {
	Title    string
	Subtitle string
	Offset   int
	Hits     []uint
}

Applied 是套用识别词之后的标题与副标题,以及命中的规则与合计的集数偏移。

func Apply

func Apply(rules []models.MediaWordRule, title, subtitle string) Applied

Apply 按顺序套用识别词(调用方只传启用的)。检查不过的规则跳过。

func (Applied) ApplyOffset

func (a Applied) ApplyOffset(m *meta.Meta)

ApplyOffset 把合计的集数偏移加到解析结果上。起始集减到 1 以下时整个范围当作没有(偏移配错了, 不留下只有结束集的范围);结束集减到 1 以下或不大于起始集时只去掉结束集。

Jump to

Keyboard shortcuts

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