如何将文档转换服务与Watson Retrieval和Ranking连接

时间:2017-06-18 15:12:35

标签: json ibm-watson watson ranking-functions

我有100份pdf文件。我使用Watson文档转换服务将pdf文档转换为JSON答案单元。现在我需要训练这些文件。

我编写了python代码,需要JSON答案单元和文档Relevency Score作为Watson R和R的输入。如何通过python代码引用JSON答案单元或如何通过Python API从文档转换服务下载JSON答案单元

1 个答案:

答案 0 :(得分:0)

I think you can see this example from IBM Developers (Node SDK). This line show one example for refer JSON Answer units.

The programming language is other but you can use the same logic to do what you want, the Document Conversion integration example shows how to convert a document into Answer Units by using the Document Conversion Service and upload it to the Retrieve and Rank Service to make the Answer Units searchable.

  1. Create a solr cluster, upload the solr configuration and create a collection

    1.1 In the files retrieve_and_ran_lifecycle.v1.js and retrieve_and_rank_solr.v1.js you will find example functions on how to perform these steps.

    1.2 IMPORTANT: When uploading the solr configuration, use the [answer_unit_config.zip] from the resources folder, which includes a schema.xml that defines the fields that will be indexed.

  2. Edit the file document_conversion_integration.v1.js and enter the following:

    2.1 service credentials for the Document Conversion and the Retrieve and Rank services (each service instance has a different set of credentials)

    2.2 clusterId (obtained when creating the cluster)

    2.3 collectionName and inputDocument if you are using a different value from the default

  3. Run the following command:
node document_conversion_integration.v1.js