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

[WIP] Team3 ポジネガ判定アプリ #136

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix calc_pn
scarletrunner7000 committed May 21, 2017
commit 8ff13239647c2fd46f00c947c7d0457a23575a96
35 changes: 31 additions & 4 deletions team3/lib/calc_pn.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package main

import (
"encoding/json"
"fmt"
"io/ioutil"
"json"
"os"
)

// []struct -> float64

type Dic struct {
Words []WordPn
Words []WordPn `json:"dictionary"`
}

type WordPn struct {
@@ -53,9 +52,37 @@ func loadDic() {

var jsontype Dic
json.Unmarshal(file, &jsontype)
// fmt.Printf("Results: %v\n", jsontype)
dic = jsontype.Words
}

func main() {
loadDic()
words := []*Word{
&Word{
Surface: "ここ",
Readging: "ここ",
Pos: "名詞",
},
&Word{
Surface: "の",
Readging: "の",
Pos: "助詞",
},
&Word{
Surface: "ラーメン",
Readging: "らーめん",
Pos: "名詞",
},
&Word{
Surface: "は",
Readging: "は",
Pos: "助詞",
},
&Word{
Surface: "絶好",
Readging: "ぜっこう",
Pos: "形容詞",
},
}
fmt.Printf("pn = %f\n", calcPn(words))
}