norm

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccentTagMap

func AccentTagMap() map[string]string

AccentTagMap returns a defensive copy of the frozen exact-tag accent mapping contract.

func AudioLocalFilename

func AudioLocalFilename(rawAudioField string) string

AudioLocalFilename defines the local MP3 cache filename contract only. Callers must pair the returned name with actual MP3 bytes, not renamed wav/ogg/oga payloads.

func CanonicalizePOS

func CanonicalizePOS(raw string) string

func IsMultiword

func IsMultiword(headword string) bool

func LabelAliasMap

func LabelAliasMap() map[string]LabelMapping

LabelAliasMap returns a defensive copy of the frozen label alias mapping contract.

func NormalizeAccentCode

func NormalizeAccentCode(rawTag string) string

NormalizeAccentCode keeps the commons baseline limited to single-tag exact and token-level matching.

func NormalizeAudioAccentCode added in v1.0.1

func NormalizeAudioAccentCode(rawAudioField string) (accentCode string, ok bool)

NormalizeAudioAccentCode infers a controlled accent code from high-confidence Wiktionary audio filename prefixes.

func NormalizeHeadword

func NormalizeHeadword(s string) string

func NormalizeLabelAlias

func NormalizeLabelAlias(raw string) (labelType, labelCode string, ok bool)

NormalizeLabelAlias resolves a raw label alias to its controlled label type/code.

func NormalizeTopic

func NormalizeTopic(topic string) (labelCode string, ok bool)

func RawPOSToLearnerPOS

func RawPOSToLearnerPOS() map[string]string

RawPOSToLearnerPOS returns a defensive copy of the frozen raw POS mapping contract.

func TopicToDomainMap

func TopicToDomainMap() map[string]string

TopicToDomainMap returns a defensive copy of the frozen topic-to-domain mapping contract.

Types

type LabelMapping

type LabelMapping struct {
	LabelType string
	LabelCode string
}

LabelMapping binds a raw label alias to a controlled label type/code pair.

func NormalizeLabelText added in v1.0.1

func NormalizeLabelText(raw string) []LabelMapping

NormalizeLabelText resolves a Wiktionary qualifier/raw_gloss label string to one or more controlled label mappings. Matches are allowlisted and ordered.

type ZhNormalizer

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

func NewZhNormalizer

func NewZhNormalizer() (*ZhNormalizer, error)

func (*ZhNormalizer) Normalize

func (z *ZhNormalizer) Normalize(raw string) string

Jump to

Keyboard shortcuts

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