import docomo "github.com/tksmaru/docomo-client-go"
apiKey := "your API key value"
c, err := docomo.NewClient(apiKey)
if err != nil {
fmt.Printf(err)
return
}
r, err := c.Dialogue.Talk("今日の天気はどうですか?")
if err != nil {
fmt.Printf(err)
return
}
fmt.Printf("response: %s", r.Utt)
apiKey := "your API key value"
c, err := docomo.NewClient(apiKey)
if err != nil {
fmt.Printf(err)
return
}
r, err := c.NamedEntity.Extract("今日の5時の千葉の天気を千葉県庁の佐藤さんが確認した")
if err != nil {
fmt.Printf(err)
return
}
fmt.Printf("response: %v", r)
apiKey := "your API key value"
c, err := docomo.NewClient(apiKey)
if err != nil {
fmt.Printf(err)
return
}
r, err := c.Morphological.Analyze("今日の5時の千葉の天気を千葉県庁の佐藤さんが確認した")
if err != nil {
fmt.Printf(err)
return
}
fmt.Printf("response: %v", r)
If you want to configure http client, initialize client like below.
apiKey := "your API key value"
hc := &http.Client{}
c, err := docomo.NewClient(apiKey, docomo.WithHttpClient(hc))
If you want to use API's for corporation account (ex: Named Entity), initialize client like below.
apiKey := "your API key value"
c, err := docomo.NewClient(apiKey, docomo.AsCorp())
Test code requires API key as an environment variables. Set your API key like below.
export DOCOMO_API_KEY="xxxxxxxxxxxxxxxxxxxxx"