Watson Discovery と戯れた | 備忘録 (。・_・。)ノ

Watson Discovery Service Try

■参考

Watson Discoveryを触ってみた。 - Qiita
https://qiita.com/t_koba/items/3d0c25663b9989b4594e

Watson Discovery Serviceが日本語対応したので、触ってみた【やってみた】編 - Qiita
https://qiita.com/ishida330/items/bb1bd4cf61da9b9c6da2


■サンプルのHTML入手

ツールを使い始める
https://console.bluemix.net/docs/services/discovery/getting-started-tool.html#getting-started-with-the-tooling
上記のチュートリアルからサンプルのHTMLファイルを4つ( test-doc1.html, test-doc2.html, test-doc3.html, test-doc4.html)ダウンロード


■インスタンス作成

ライト・プラン・サービスは、非アクティブで 30 日経過すると削除されます。

ディスカバリー-vr

Txxxxxx

資格情報

{
  "url": "https://gateway.watsonplatform.net/discovery/api",
  "username": "user",
  "password": "password"
}


Collection Id
cafa…

Configuration Id
f87a…

Environment Id
3014…

 

■curlのインストール Win10
Windows:cURL のインストール - Web系開発メモ
http://web-dev.hatenablog.com/entry/windows/install-curl

Win64 2000/XP x86_64 zip    7.46.0    binary    SSL    SSH    Edward LoPinto

Files Only (free) -> curl-7.46.0-win64.zip

システムの環境変数 Path に「C:\curl\bin」を追加

curl --version

curl 7.46.0 (x86_64-pc-win32) libcurl/7.46.0 OpenSSL/1.0.2e zlib/1.2.8 WinIDN libssh2/1.6.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz


■Watson Discoveryで日本語のコレクションを作成できない^^;

curl -X POST -u "user":"password" -H "Content-Type: application/json" -d '{"name": "test_collection","description": "My test collection","language":"ja"}' "https://gateway.watsonplatform.net/discovery/api/v1/environments/3014…/collections?version=2017-11-07"

解決

Curl(プログラミング言語) - Watson Discovery コレクション作成時におけるCurlのエラーについて(102917)|teratail
https://teratail.com/questions/102917

Watson Discoveryで日本語のコレクションを作成

curl -X POST -u "user":"password" -H "Content-Type: application/json" -d "{  \"name\": \"jp_collection\",   \"description\": \"My test collection\",  \"language\": \"ja\" }" "https://gateway.watsonplatform.net/discovery/api/v1/environments/3014…/collections?version=2017-11-07"


以下は戻り
{
  "name" : "jp_collection",
  "collection_id" : "collection_id",
  "description" : "My test collection",
  "created" : "2018-01-20T14:31:50.573Z",
  "updated" : "2018-01-20T14:31:50.573Z",
  "configuration_id" : "configuration_id",
  "language" : "ja",
  "status" : "active"
}


Watson API Explorer
https://watson-api-explorer.mybluemix.net/

 

 

日本語での注意点
デフォルトの構成では4種類のエンリッチメントが有効になっていますが、

日本語環境ではエンリッチメントは現時点未サポートなため、

日本語環境のデフォルト構成で文書をアップロードするとエラーになります。

ゆえに日本語環境ではカスタム構成を作成し、

既存のエンリッチメント定義を削除しておく必要があります。

Watson Discovery Serviceが日本語対応したので、触ってみた【何、それ?】編 - Qiita より