mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-21 10:00:59 -07:00
style: rename
This commit is contained in:
parent
adc1e2e632
commit
97d782c264
@ -150,7 +150,7 @@ func (t *BingTranslate) Translate(message string) (translation, definition, part
|
|||||||
set := make(posSet)
|
set := make(posSet)
|
||||||
for _, pos := range data[0].(map[string]interface{})["translations"].([]interface{}) {
|
for _, pos := range data[0].(map[string]interface{})["translations"].([]interface{}) {
|
||||||
pos := pos.(map[string]interface{})
|
pos := pos.(map[string]interface{})
|
||||||
var words translationWords
|
var words posWords
|
||||||
|
|
||||||
words.target = pos["displayTarget"].(string)
|
words.target = pos["displayTarget"].(string)
|
||||||
for _, backTranslation := range pos["backTranslations"].([]interface{}) {
|
for _, backTranslation := range pos["backTranslations"].([]interface{}) {
|
||||||
|
@ -4,20 +4,20 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type translationWords struct {
|
type posWords struct {
|
||||||
target string
|
target string
|
||||||
backTargets []string
|
backTargets []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *translationWords) add(s string) {
|
func (t *posWords) add(s string) {
|
||||||
t.backTargets = append(t.backTargets, s)
|
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 {
|
if _, ok := set[tag]; !ok {
|
||||||
set[tag] = []translationWords{words}
|
set[tag] = []posWords{words}
|
||||||
} else {
|
} else {
|
||||||
set[tag] = append(set[tag], words)
|
set[tag] = append(set[tag], words)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user