utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Segmenter = func() *jieba.Segmenter {
	r, err := zip.NewReader(bytes.NewReader(dictzip), int64(len(dictzip)))
	if err != nil {
		panic(err)
	}
	f, err := r.Open("dict.txt")
	if err != nil {
		panic(err)
	}
	seg, err := jieba.LoadDictionary(f)
	if err != nil {
		panic(err)
	}
	return seg
}()

Segmenter jieba 分词器

Functions

func FileSize

func FileSize(path string) (n int64)

FileSize 获取文件大小

func IsExist

func IsExist(path string) bool

IsExist 文件/路径存在

func IsMethod

func IsMethod(m string, w http.ResponseWriter, r *http.Request) bool

IsMethod check if the method meets the requirement and response 405 Method Not Allowed if not matched

func IsNotExist

func IsNotExist(path string) bool

IsNotExist 文件/路径不存在

func Similarity

func Similarity(x, y []uint8) float64

Similarity len(x) must eq len(y)

Types

This section is empty.

Jump to

Keyboard shortcuts

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