mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-11 20:50:29 +08:00
small refactor, rename files
This commit is contained in:
1
jieba.go
1
jieba.go
@@ -9,7 +9,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Dictionary = "dict.txt"
|
|
||||||
UserWordTagTab = make(map[string]string)
|
UserWordTagTab = make(map[string]string)
|
||||||
reEng = regexp.MustCompile(`[[:alnum:]]`)
|
reEng = regexp.MustCompile(`[[:alnum:]]`)
|
||||||
reHanCutAll = regexp.MustCompile(`\p{Han}+`)
|
reHanCutAll = regexp.MustCompile(`\p{Han}+`)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ var (
|
|||||||
reEng1 = regexp.MustCompile(`[[:alnum:]]$`)
|
reEng1 = regexp.MustCompile(`[[:alnum:]]$`)
|
||||||
reHanInternal = regexp.MustCompile(`([\p{Han}+[:alnum:]+#&\._]+)`)
|
reHanInternal = regexp.MustCompile(`([\p{Han}+[:alnum:]+#&\._]+)`)
|
||||||
reSkipInternal = regexp.MustCompile(`(\r\n|\s)`)
|
reSkipInternal = regexp.MustCompile(`(\r\n|\s)`)
|
||||||
|
dictionary = "dict.txt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type WordTag struct {
|
type WordTag struct {
|
||||||
@@ -33,7 +34,7 @@ func (wt WordTag) String() string {
|
|||||||
func init() {
|
func init() {
|
||||||
_, filename, _, _ := runtime.Caller(1)
|
_, filename, _, _ := runtime.Caller(1)
|
||||||
dict_dir := filepath.Dir(filepath.Dir(filename))
|
dict_dir := filepath.Dir(filepath.Dir(filename))
|
||||||
dict_path := filepath.Join(dict_dir, jiebago.Dictionary)
|
dict_path := filepath.Join(dict_dir, dictionary)
|
||||||
err := load_model(dict_path)
|
err := load_model(dict_path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user