Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to integrate Human-computer question answering system QuestionAnsweringSystem in Application

Shulou Source: shulou.com Published: 2022-05-31 17:44:25 10月01日 Update

How to integrate the man-machine question answering system QuestionAnsweringSystem in the application? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

QuestionAnsweringSystem is a man-machine question answering system implemented by Java, which can automatically analyze questions and give candidate answers. IBM artificial intelligence computer system "Watson" in February 2011 in the United States popular TV quiz show "Jeopardy!" Beat two human champions, QuestionAnsweringSystem is IBM Watson's open source implementation of Java.

The architecture of the system is as follows:

QuestionAnsweringSystem provides two ways of integration, embedded in the application as a library and deployed independently as a platform.

Let's talk about how to do these two ways.

1. Embed it into the application in the way of library.

This method only supports the Java platform, and libraries can be added to the build path through Maven dependencies, as shown below:

Org.apdplat deep-qa 1.1

How to use it in the application? The sample code is as follows:

String questionStr = "who is the author of APDPlat?" ; Question question = SharedQuestionAnsweringSystem.getInstance (). AnswerQuestion (questionStr); if (question! = null) {List candidateAnswers = question.getAllCandidateAnswer (); int iTun1; for (CandidateAnswer candidateAnswer: candidateAnswers) {System.out.println ((iTunes +) + "," + candidateAnswer.getAnswer () + ":" + candidateAnswer.getScore ());}}

After running the program, the directory deep-qa is generated in the current directory, and there are two directories, dic and questionTypePatterns, in the directory.

Dic is the thesaurus that Chinese word segmentation components depend on, and questionTypePatterns is the pattern definition that problem category analysis depends on, which can be modified according to their own needs.

2. Deploy independently in a platform way.

First, it is deployed on your own server, such as 192.168.0.1, and then you can provide services through Json Over HTTP, as shown below:

Call address: who is the author of http://192.168.0.1/api/ask?n=1&q=APDPlat? Parameter: n indicates the number of answers to be returned Q indicates question code: UTF-8 code returns json: [{"answer": "Yang Shangchuan", "score": 1}] this is the answer to the question about how to integrate the man-machine question answering system QuestionAnsweringSystem in the application. I hope the above content can be of some help to you. If you still have a lot of questions to solve, you can follow the industry information channel to learn more about it.

Tags: Mode question system application question and answer catalog man-machine platform analysis centralization author method more answer code help service independent answer easy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB NVidia Huawei Xiaomi Microsoft