Skip to content

Commit

Permalink
add remove phrase DictAdd support
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Oct 2, 2021
1 parent b7662aa commit 55f64b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions phrase/phrase_dict.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package phrase

// phraseDict is data map
// phraseDict is phrase data map
//
// Generate from:
// https://github.com/hotoo/pinyin/blob/master/data/phrases-dict.js
//
// Warning: Auto-generated file, don't edit.
// If you want add more words, use phrase_dict_addition.go
//
// If you want add more words, use phrase_dict_add.go
var phraseDict = map[string]string{
"阿Q": "ā Q",
"阿爸": "ā bà",
Expand Down
9 changes: 7 additions & 2 deletions phrase/phrase_dict_add.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package phrase

/*
go pinyin addition version
go pinyin addition dictionary
*/

// DictAdd phrase dict addition
// DictAdd phrase dict addition map
var DictAdd = map[string]string{
"宿舍": "sù shè",
"不薄": "bù báo",
Expand All @@ -18,3 +18,8 @@ var DictAdd = map[string]string{
func AddDict(text, py string) {
DictAdd[text] = py
}

// Remove remove a token from phrase dictionary.
func Remove(text string) {
delete(DictAdd, text)
}

0 comments on commit 55f64b1

Please sign in to comment.