Skip to content

Commit

Permalink
update mitAI
Browse files Browse the repository at this point in the history
  • Loading branch information
evolsnow committed Jun 21, 2016
1 parent 586cbb4 commit 7fe992f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions AI.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,8 @@ func mitAI(info string) string {
reply := new(mitReply)
decoder := json.NewDecoder(resp.Body)
decoder.Decode(reply)
log.Printf("reply from qingyunke machine: %s", reply.Responses[0])
log.Printf("reply from mit machine: %s", reply.Responses[0])
return reply.Responses[0]
//body, err := ioutil.ReadAll(resp.Body)
//re, _ := regexp.Compile("Mitsuku:</B>(.*?)<br> <br>")
//all := re.FindSubmatch(body)
//if len(all) == 0 {
// return "change another question?"
//}
//found := (string(all[1]))
//log.Printf("reply from mitsuku machine: %s", found)
//wl := []string{`<P ALIGN="CENTER"><img src="http://`, "", `"></img></P>`, " ", "<br>", "\n", "xloadswf2.", "", "Mitsuku", "samaritan"}
//srp := strings.NewReplacer(wl...)
//ret := srp.Replace(found)
//ret = strings.TrimLeft(ret, " ")
//return ret
}

type mitReply struct {
Expand Down
2 changes: 1 addition & 1 deletion AI_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ func TestAIReply(t *testing.T) {
// t.Error("qinAI error")
//}
if mitAI(askEn) == "" || mitAI(askZh) == "" {
t.Error("tlAI error")
t.Error("mitAI error")
}
}

0 comments on commit 7fe992f

Please sign in to comment.