Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning and fixing #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ update\:data:
wget https://github.com/BYVoid/OpenCC/archive/refs/heads/master.zip -O tmp/opencc.zip
unzip tmp/opencc.zip -d tmp/
sh ./merge-data.sh

test:
sh ./merge-data.sh
go test ./...
liut marked this conversation as resolved.
Show resolved Hide resolved
GO111MODULE=auto go test -cover ./...
1 change: 0 additions & 1 deletion dictionary/HKPhrasesFinance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,4 @@
被迫倉 被挾倉
高峰 高峰
開户 開戶
開户 開戶
户 戶
19 changes: 0 additions & 19 deletions opencc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ package opencc
import (
"embed"
"encoding/json"
"flag"
"fmt"
"os"
"path"
"reflect"
"runtime"
"strings"

"github.com/liuzl/da"
Expand All @@ -21,22 +18,6 @@ var cf embed.FS
//go:embed dictionary
var df embed.FS

var (
// Dir is the parent dir for config and dictionary
Dir = flag.String("dir", defaultDir(), "dict dir")
)

func defaultDir() string {
if runtime.GOOS == "windows" {
return `C:\gocc\`
}
if goPath, ok := os.LookupEnv("GOPATH"); ok {
return goPath + "/src/github.com/longbridgeapp/opencc/"
} else {
return `/usr/local/share/gocc/`
}
}

// Group holds a sequence of dicts
type Group struct {
Files []string
Expand Down
Loading