A3RTのText Classification をやってみた
https://a3rt.recruit-tech.co.jp/product/textClassificationAPI/ リファレンスなどはこちら
https://github.com/VBA-tools/VBA-Dictionary JSONの操作で使用
http://blog.goo.ne.jp/xmldtp/e/c7e3c3631d31206f818b30276d0f3091 リクエスト投げるところはここを参考に
うまく結果が返ってきた場合は ラベル{タブ}合致度{改行}のリストを
結果が正しく帰ってこない場合は ステータスコード{タブ}メッセージ
を返します。
09/13 追記
VBA-JSONのURL間違ってた
https://github.com/VBA-tools/VBA-JSON
Const APIKEY As String = "取得したAPIキー" Public Function getClassifiedResult(ByVal str As String, Optional ByVal model_id As String = "default") As String Dim objJSON As Object 'JSONファイルをパースしたもの Dim i As Long Dim sRet As String: sRet = "" target_url = "https://api.a3rt.recruit-tech.co.jp/text_classification/v1/classify" sendData = "apikey=" & APIKEY & "&text=" & str & "&model_id=" & model_id Set httpobj = CreateObject("MSXML2.XMLHTTP") httpobj.Open "POST", target_url, False Call httpobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") httpobj.send (sendData) Set objJSON = ParseJson(httpobj.responseText) If objJSON("status") <> 0 Then getClassifiedResult = objJSON("status") & vbTab & objJSON("message") Exit Function End If For i = 1 To objJSON("classes").Count If sRet <> "" Then sRet = sRet & vbCrLf sRet = sRet & objJSON("classes")(i)("label") & vbTab & FormatPercent(objJSON("classes")(i)("probability"), 2, vbTrue) Next i getClassifiedResult = sRet End Function