v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-21 10:00:59 -07:00

style: rename

This commit is contained in:
eeeXun 2023-04-19 14:26:08 +08:00
parent adc1e2e632
commit 97d782c264
2 changed files with 6 additions and 6 deletions

View File

@ -150,7 +150,7 @@ func (t *BingTranslate) Translate(message string) (translation, definition, part
set := make(posSet)
for _, pos := range data[0].(map[string]interface{})["translations"].([]interface{}) {
pos := pos.(map[string]interface{})
var words translationWords
var words posWords
words.target = pos["displayTarget"].(string)
for _, backTranslation := range pos["backTranslations"].([]interface{}) {

View File

@ -4,20 +4,20 @@ import (
"fmt"
)
type translationWords struct {
type posWords struct {
target string
backTargets []string
}
func (t *translationWords) add(s string) {
func (t *posWords) add(s string) {
t.backTargets = append(t.backTargets, s)
}
type posSet map[string][]translationWords
type posSet map[string][]posWords
func (set posSet) add(tag string, words translationWords) {
func (set posSet) add(tag string, words posWords) {
if _, ok := set[tag]; !ok {
set[tag] = []translationWords{words}
set[tag] = []posWords{words}
} else {
set[tag] = append(set[tag], words)
}