Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

ExactAnswer.java 2.6 KB

You have to be logged in to leave a comment. Sign In
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
  1. /*
  2. * Copyright 2013,2014 BioASQ project: FP7/2007-2013, ICT-2011.4.4(d),
  3. * Intelligent Information Management,
  4. * Targeted Competition Framework grant agreement n° 318652.
  5. * www: http://www.bioasq.org
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. /**
  20. *
  21. * @author Ioannis Partalas
  22. */
  23. package data;
  24. import java.util.ArrayList;
  25. public class ExactAnswer {
  26. String answer; // case of yesno questions
  27. ArrayList<String> answers; // case of factoids and lists
  28. ArrayList<ArrayList<String>> lists;
  29. public ExactAnswer()
  30. {
  31. answers = new ArrayList<String>();
  32. lists = new ArrayList<ArrayList<String>>();
  33. }
  34. public String getAnswer() {
  35. return answer;
  36. }
  37. public void setAnswer(String answer) {
  38. this.answer = answer;
  39. }
  40. public ArrayList<String> getAnswers() {
  41. return answers;
  42. }
  43. public void setAnswers(ArrayList<String> answers) {
  44. this.answers = answers;
  45. }
  46. public ArrayList<ArrayList<String>> getLists() {
  47. return lists;
  48. }
  49. public void setLists(ArrayList<ArrayList<String>> lists) {
  50. this.lists = lists;
  51. }
  52. boolean containsAnswer(String resp)
  53. {
  54. for(int i=0;i<answers.size();i++)
  55. if(answers.get(i).equals(resp))
  56. return true;
  57. return false;
  58. }
  59. public boolean containsAnswerSynonym(ArrayList<String> resp,boolean remove)
  60. {
  61. for(int i=0;i<lists.size();i++)
  62. {
  63. ArrayList<String> listofans = lists.get(i);
  64. for(int k=0;k<listofans.size();k++)
  65. {
  66. String ans1 = listofans.get(k);
  67. for(int l=0;l<resp.size();l++)
  68. {
  69. if(ans1.equals(resp.get(l)))
  70. {
  71. // System.out.println(ans1+" "+resp.get(l));
  72. if(remove) // will use this only for list questions
  73. lists.remove(i);
  74. return true;
  75. }
  76. }
  77. }
  78. }
  79. return false;
  80. }
  81. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...