forked from ysc/QuestionAnsweringSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestionAnsweringSystem.java
More file actions
204 lines (172 loc) · 4.96 KB
/
QuestionAnsweringSystem.java
File metadata and controls
204 lines (172 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/**
*
* APDPlat - Application Product Development Platform
* Copyright (c) 2013, 杨尚川, [email protected]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package org.apdplat.qa.system;
import java.util.List;
import org.apdplat.qa.datasource.DataSource;
import org.apdplat.qa.model.Question;
import org.apdplat.qa.questiontypeanalysis.QuestionClassifier;
import org.apdplat.qa.score.answer.CandidateAnswerScore;
import org.apdplat.qa.score.evidence.EvidenceScore;
import org.apdplat.qa.select.CandidateAnswerSelect;
/**
* 问答系统
*
* @author 杨尚川
*/
public interface QuestionAnsweringSystem {
/**
* 问答系统使用的分类器
*
* @param questionClassifier
*/
public void setQuestionClassifier(QuestionClassifier questionClassifier);
public QuestionClassifier getQuestionClassifier();
/**
* 问答系统使用的数据源
*
* @param dataSource 数据源
*/
public void setDataSource(DataSource dataSource);
public DataSource getDataSource();
/**
* 候选答案提取器(不可以同时使用多个提取器)
*
* @param candidateAnswerSelect 候选答案提取组件
*/
public void setCandidateAnswerSelect(CandidateAnswerSelect candidateAnswerSelect);
public CandidateAnswerSelect getCandidateAnswerSelect();
/**
* 候选答案评分组件(可以同时使用多个组件 - 组合候选答案评分组件)
*
* @param candidateAnswerScore 候选答案评分组件
*/
public void setCandidateAnswerScore(CandidateAnswerScore candidateAnswerScore);
public CandidateAnswerScore getCandidateAnswerScore();
/**
* 证据评分组件(可以同时使用多个组件 - 组合证据评分组件)
*
* @param evidenceScore 证据评分组件
*/
public void setEvidenceScore(EvidenceScore evidenceScore);
public EvidenceScore getEvidenceScore();
/**
* 回答问题,问题从问答系统使用的数据源中读取
*
* @return
*/
public List<Question> answerQuestions();
/**
* 利用dataSource搜索问题并回答问题
*
* @param questionStr 问题字符串
* @return 问题
*/
public Question answerQuestion(String questionStr);
/**
* 回答指定的问题
*
* @param question 问题
* @return
*/
public Question answerQuestion(Question question);
/**
* 回答指定的多个问题
*
* @param questions 多个问题
* @return
*/
public List<Question> answerQuestions(List<Question> questions);
/**
* 输出回答完美的问题
*/
public void showPerfectQuestions();
/**
* 输出回答不完美的问题
*/
public void showNotPerfectQuestions();
/**
* 输出回答错误的问题
*/
public void showWrongQuestions();
/**
* 输出未知类型的问题
*/
public void showUnknownTypeQuestions();
/**
* 获取回答完美的问题
*
* @return
*/
public List<Question> getPerfectQuestions();
/**
* 获取回答不完美的问题
*
* @return
*/
public List<Question> getNotPerfectQuestions();
/**
* 获取回答错误的问题
*
* @return
*/
public List<Question> getWrongQuestions();
/**
* 获取未知类型的问题
*
* @return
*/
public List<Question> getUnknownTypeQuestions();
/**
* 获取问答系统的MRR指标
*
* @return
*/
public double getMRR();
/**
* 获取回答问题数(有预期答案的问题)
*
* @return 回答问题数
*/
public int getQuestionCount();
/**
* 获取回答完美问题数
*
* @return 回答完美问题数
*/
public int getPerfectCount();
/**
* 获取回答不完美问题数
*
* @return 回答不完美问题数
*/
public int getNotPerfectCount();
/**
* 获取回答错误问题数
*
* @return 回答错误问题数
*/
public int getWrongCount();
/**
* 获取未知类型问题数
*
* @return 未知类型问题数
*/
public int getUnknownTypeCount();
}