wordseg

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

******************************************************************************

Index

Constants

View Source
const (
	SINGLE = 0
	BEGIN  = 1
	MIDDLE = 2
	END    = 3
)

B,E,M,S

Variables

View Source
var (
	// the start probability of state
	// SP = [4]float64{0.23101714745, 0.76898285255, 0.0, 0.0}
	SP = [4]float64{0, 0, 0, 0}
	TP = [4][4]float64{
		{0, 0, 0, 0},
		{0, 0, 0, 0},
		{0, 0, 0, 0},
		{0, 0, 0, 0},
	}

	IGNORES = ",. ;。,;"
)
View Source
var (
	SPCount = [4]float64{0, 0, 0, 0}
	TPCount = [4][4]float64{
		{0, 0, 0, 0},
		{0, 0, 0, 0},
		{0, 0, 0, 0},
		{0, 0, 0, 0}}
)

Functions

func Split

func Split(str string) []string

---------------------------------------------------------- default word segmentation

Types

type WordEP

type WordEP struct {
	EP [4]float64 // the emission probability in each state
	SC [4]uint32  // the count of appearence in each state
}

------------------------------------------------------ 单个字的观察

type Wordseg

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

func Default

func Default() *Wordseg

---------------------------------------------------------- return default wordseg

func NewWordseg

func NewWordseg() *Wordseg

func (*Wordseg) AddWord

func (ws *Wordseg) AddWord(word string, count uint32)

func (*Wordseg) LoadFile

func (ws *Wordseg) LoadFile(path string)

func (*Wordseg) Split

func (ws *Wordseg) Split(str string) []string

------------------------------------------------------ words split

func (*Wordseg) Update

func (ws *Wordseg) Update()

----------------------------------------------------- should be called when finished adding words

Jump to

Keyboard shortcuts

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