fix typo and format imports (#119)

This commit is contained in:
Zhizhen He 2023-04-05 22:03:45 +08:00 committed by GitHub
parent 6ac9208474
commit 62f415efa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 11 deletions

View File

@ -3,7 +3,6 @@ package rime
import (
"bufio"
"fmt"
mapset "github.com/deckarep/golang-set/v2"
"log"
"os"
"path"
@ -12,6 +11,8 @@ import (
"time"
"unicode"
"unicode/utf8"
mapset "github.com/deckarep/golang-set/v2"
)
var specialWords = mapset.NewSet[string]() // 特殊词汇列表,不进行任何检查

View File

@ -3,13 +3,14 @@ package rime
import (
"bufio"
"fmt"
mapset "github.com/deckarep/golang-set/v2"
"log"
"os"
"regexp"
"strings"
"time"
"unicode/utf8"
mapset "github.com/deckarep/golang-set/v2"
)
var emojiTXT = "/Users/dvel/Library/Rime/opencc/emoji.txt"

View File

@ -2,11 +2,12 @@ package rime
import (
"bufio"
mapset "github.com/deckarep/golang-set/v2"
"log"
"os"
"sort"
"strings"
mapset "github.com/deckarep/golang-set/v2"
)
// SortEnDict 排序 en.dict.yaml 词库
@ -135,4 +136,4 @@ func enTxtToRimeDict(txtPath string) {
if err != nil {
log.Fatal(err)
}
}
}

View File

@ -77,7 +77,7 @@ func processNewDict(dictPath string) {
if utf8.RuneCountInString(text) <= 2 {
continue
}
outFile.WriteString(line+"\n")
outFile.WriteString(line + "\n")
}
outFile.Sync()
}

View File

@ -5,7 +5,6 @@ import (
"crypto/sha1"
"encoding/hex"
"fmt"
mapset "github.com/deckarep/golang-set/v2"
"io"
"log"
"os"
@ -13,6 +12,8 @@ import (
"strconv"
"strings"
"time"
mapset "github.com/deckarep/golang-set/v2"
)
// 一个词条的组成部分

View File

@ -3,8 +3,6 @@ package rime
import (
"bufio"
"fmt"
"github.com/commander-cli/cmd"
mapset "github.com/deckarep/golang-set/v2"
"io"
"log"
"net/http"
@ -15,9 +13,12 @@ import (
"strings"
"time"
"unicode/utf8"
"github.com/commander-cli/cmd"
mapset "github.com/deckarep/golang-set/v2"
)
var fileterMark = "# *_*" // "# *_*" 和 mark 之间是过滤词列表
var filterMark = "# *_*" // "# *_*" 和 mark 之间是过滤词列表
var filterList = mapset.NewSet[string]() // 过滤词列表,在这个列表里的词汇,不再写入
// UpdateSogou 更新搜狗流行词
@ -62,7 +63,7 @@ func makeSogouFilterList() {
break
}
if !isFilterMark {
if strings.Contains(line, fileterMark) {
if strings.Contains(line, filterMark) {
isFilterMark = true
}
continue

View File

@ -3,7 +3,6 @@ package rime
import (
"bufio"
"fmt"
mapset "github.com/deckarep/golang-set/v2"
"log"
"os"
"path"
@ -11,6 +10,8 @@ import (
"strconv"
"strings"
"time"
mapset "github.com/deckarep/golang-set/v2"
)
// Sort 词库排序,顺便去重