asker-tool 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +674 -0
  3. data/README.md +53 -0
  4. data/bin/asker +4 -0
  5. data/docs/changelog/v2.1.md +99 -0
  6. data/docs/commands.md +15 -0
  7. data/docs/contributions.md +18 -0
  8. data/docs/history.md +40 -0
  9. data/docs/idea.md +44 -0
  10. data/docs/inputs/README.md +39 -0
  11. data/docs/inputs/code.md +69 -0
  12. data/docs/inputs/concepts.md +142 -0
  13. data/docs/inputs/jedi.md +68 -0
  14. data/docs/inputs/tables.md +112 -0
  15. data/docs/inputs/templates.md +87 -0
  16. data/docs/install/README.md +38 -0
  17. data/docs/install/manual.md +26 -0
  18. data/docs/install/scripts.md +26 -0
  19. data/docs/revise/asker-file.md +41 -0
  20. data/docs/revise/buenas-practicas/01-convocatoria.md +30 -0
  21. data/docs/revise/buenas-practicas/02-formulario.md +35 -0
  22. data/docs/revise/buenas-practicas/03-descripcion.md +63 -0
  23. data/docs/revise/buenas-practicas/04-resultados.md +17 -0
  24. data/docs/revise/buenas-practicas/05-reproducir.md +10 -0
  25. data/docs/revise/ejemplos/01/README.md +27 -0
  26. data/docs/revise/ejemplos/02/README.md +31 -0
  27. data/docs/revise/ejemplos/03/README.md +31 -0
  28. data/docs/revise/ejemplos/04/README.md +37 -0
  29. data/docs/revise/ejemplos/05/README.md +25 -0
  30. data/docs/revise/ejemplos/06/README.md +43 -0
  31. data/docs/revise/ejemplos/README.md +11 -0
  32. data/docs/revise/projects.md +74 -0
  33. data/lib/asker.rb +103 -0
  34. data/lib/asker/ai/ai.rb +70 -0
  35. data/lib/asker/ai/ai_calculate.rb +55 -0
  36. data/lib/asker/ai/concept_ai.rb +49 -0
  37. data/lib/asker/ai/question.rb +58 -0
  38. data/lib/asker/ai/stages/base_stage.rb +16 -0
  39. data/lib/asker/ai/stages/main.rb +8 -0
  40. data/lib/asker/ai/stages/stage_b.rb +87 -0
  41. data/lib/asker/ai/stages/stage_d.rb +160 -0
  42. data/lib/asker/ai/stages/stage_f.rb +156 -0
  43. data/lib/asker/ai/stages/stage_i.rb +140 -0
  44. data/lib/asker/ai/stages/stage_s.rb +52 -0
  45. data/lib/asker/ai/stages/stage_t.rb +170 -0
  46. data/lib/asker/application.rb +30 -0
  47. data/lib/asker/checker.rb +356 -0
  48. data/lib/asker/cli.rb +85 -0
  49. data/lib/asker/code/ai/base_code_ai.rb +48 -0
  50. data/lib/asker/code/ai/code_ai_factory.rb +26 -0
  51. data/lib/asker/code/ai/javascript_code_ai.rb +167 -0
  52. data/lib/asker/code/ai/python_code_ai.rb +167 -0
  53. data/lib/asker/code/ai/ruby_code_ai.rb +169 -0
  54. data/lib/asker/code/ai/sql_code_ai.rb +69 -0
  55. data/lib/asker/code/code.rb +53 -0
  56. data/lib/asker/data/column.rb +62 -0
  57. data/lib/asker/data/concept.rb +183 -0
  58. data/lib/asker/data/data_field.rb +87 -0
  59. data/lib/asker/data/row.rb +93 -0
  60. data/lib/asker/data/table.rb +96 -0
  61. data/lib/asker/data/template.rb +65 -0
  62. data/lib/asker/data/world.rb +53 -0
  63. data/lib/asker/exporter/code_gift_exporter.rb +35 -0
  64. data/lib/asker/exporter/code_screen_exporter.rb +45 -0
  65. data/lib/asker/exporter/concept_ai_gift_exporter.rb +33 -0
  66. data/lib/asker/exporter/concept_ai_screen_exporter.rb +115 -0
  67. data/lib/asker/exporter/concept_ai_yaml_exporter.rb +33 -0
  68. data/lib/asker/exporter/concept_doc_exporter.rb +21 -0
  69. data/lib/asker/exporter/concept_screen_exporter.rb +25 -0
  70. data/lib/asker/exporter/main.rb +9 -0
  71. data/lib/asker/files/config.ini +40 -0
  72. data/lib/asker/formatter/code_string_formatter.rb +16 -0
  73. data/lib/asker/formatter/concept_doc_formatter.rb +37 -0
  74. data/lib/asker/formatter/concept_string_formatter.rb +66 -0
  75. data/lib/asker/formatter/question_gift_formatter.rb +65 -0
  76. data/lib/asker/formatter/question_hash_formatter.rb +40 -0
  77. data/lib/asker/formatter/question_moodlexml_formatter.rb +71 -0
  78. data/lib/asker/formatter/rb2haml_formatter.rb +26 -0
  79. data/lib/asker/lang/lang.rb +42 -0
  80. data/lib/asker/lang/lang_factory.rb +19 -0
  81. data/lib/asker/lang/text_actions.rb +150 -0
  82. data/lib/asker/loader/code_loader.rb +53 -0
  83. data/lib/asker/loader/content_loader.rb +101 -0
  84. data/lib/asker/loader/directory_loader.rb +58 -0
  85. data/lib/asker/loader/file_loader.rb +33 -0
  86. data/lib/asker/loader/image_url_loader.rb +61 -0
  87. data/lib/asker/loader/input_loader.rb +24 -0
  88. data/lib/asker/loader/project_loader.rb +71 -0
  89. data/lib/asker/logger.rb +21 -0
  90. data/lib/asker/project.rb +170 -0
  91. metadata +261 -0
@@ -0,0 +1,156 @@
1
+
2
+ require_relative 'base_stage'
3
+ require_relative '../question'
4
+
5
+ # StageF: process tables with 1 field
6
+ class StageF < BaseStage
7
+ def run(table, list1, list2)
8
+ # process_table1field
9
+ questions = []
10
+ return questions if table.fields.count>1
11
+
12
+ questions += run_only_this_concept(table, list1)
13
+ questions += run_with_other_concepts(table, list1, list2)
14
+
15
+ questions
16
+ end
17
+
18
+ private
19
+
20
+ def run_only_this_concept(table, list1)
21
+ questions = []
22
+ s1 = Set.new #Set of rows from this concept
23
+ list1.each { |item| s1 << item[:data][0] }
24
+ a1 = s1.to_a
25
+ a1.shuffle!
26
+
27
+ if a1.size > 3
28
+ a1.each_cons(4) do |e1,e2,e3,e4|
29
+ e = [ e1, e2, e3, e4 ]
30
+ questions += make_questions_with(e, table)
31
+
32
+ #Question filtered text
33
+ e = [ e1, e2, e3, e4 ]
34
+ e.shuffle!
35
+ t = "(a) #{e[0]}, (b) #{e[1]}, (c) #{e[2]}, (d) #{e[3]}"
36
+ filtered=lang.text_with_connectors(t)
37
+ indexes = filtered[:indexes]
38
+
39
+ groups = (indexes.combination(4).to_a).shuffle
40
+ max = (indexes.size/4).to_i
41
+ groups[0, max].each do |i|
42
+ i.sort!
43
+ q = Question.new(:match)
44
+ q.shuffle_off
45
+ q.name = "#{name}-#{num}-f3filtered"
46
+ s = lang.build_text_from_filtered(filtered, i)
47
+ q.text = random_image_for(name(:raw))
48
+ q.text += lang.text_for(:f3, name(:decorated), table.fields[0].capitalize, s)
49
+ i.each_with_index do |value,index|
50
+ q.matching << [(index + 1).to_s, filtered[:words][value][:word].downcase]
51
+ end
52
+ questions << q
53
+ end
54
+ end
55
+ else
56
+ # Execute this block when "a1.size <=3"
57
+ questions += make_questions_with(a1.dup, table)
58
+ end
59
+ questions
60
+ end
61
+
62
+ def make_questions_with(e, table)
63
+ questions = []
64
+
65
+ e.shuffle!
66
+ q = Question.new(:choice)
67
+ q.name = "#{name(:id)}-#{num}-f1true#{e.size}-#{table.name}"
68
+ q.text = random_image_for(name(:raw))
69
+ q.text += lang.text_for(:f1, name(:decorated), table.fields[0].capitalize, e.join('</li><li>'))
70
+ q.good = lang.text_for(:true)
71
+ q.bads << lang.text_for(:misspelling)
72
+ q.bads << lang.text_for(:false)
73
+
74
+ if type == 'text'
75
+ e.shuffle!
76
+ q = Question.new(:short)
77
+ q.name = "#{name(:id)}-#{num}-f1short#{e.size}-#{table.name}"
78
+ q.text = random_image_for(name(:raw))
79
+ q.text += lang.text_for(:f1, lang.hide_text(name(:raw)), table.fields[0].capitalize, e.join('</li><li>'))
80
+ q.shorts << name(:raw)
81
+ q.shorts << name(:raw).tr('-_', ' ')
82
+ questions << q
83
+
84
+ e.shuffle!
85
+ save = e[0]
86
+ e[0] = lang.do_mistake_to(e[0])
87
+ q = Question.new(:choice)
88
+ q.name = "#{name(:id)}-#{num}-f1name-misspelled#{e.size}-#{table.name}"
89
+ q.text = random_image_for(name(:raw))
90
+ q.text += lang.text_for(:f1, lang.do_mistake_to(name(:decorated)), table.fields[0].capitalize, e.join('</li><li>'))
91
+ q.good = lang.text_for(:misspelling)
92
+ q.bads << lang.text_for(:true)
93
+ q.bads << lang.text_for(:false)
94
+ q.feedback = "Concept name #{name(:raw)} misspelled!"
95
+ e[0] = save
96
+ questions << q
97
+ end
98
+
99
+ e.shuffle!
100
+ save = e[0]
101
+ e[0] = lang.do_mistake_to(e[0])
102
+ q = Question.new(:choice)
103
+ q.name = "#{name(:id)}-#{num}-f1true-misspelled#{e.size}-#{table.name}"
104
+ q.text = random_image_for(name(:raw))
105
+ q.text += lang.text_for(:f1, name(:decorated), table.fields[0].capitalize, e.join('</li><li>'))
106
+ q.good = lang.text_for(:misspelling)
107
+ q.bads << lang.text_for(:true)
108
+ q.bads << lang.text_for(:false)
109
+ q.feedback = "Text #{save} mispelled!"
110
+ e[0] = save
111
+ questions << q
112
+ end
113
+
114
+ def run_with_other_concepts(table, list1, list2)
115
+ questions = []
116
+
117
+ s1 = Set.new # Set of rows from this concept
118
+ list1.each { |item| s1 << item[:data][0] }
119
+ a1 = s1.to_a
120
+ a1.shuffle!
121
+
122
+ s2 = Set.new # Set of rows from other concepts
123
+ list2.each { |item| s2 << item[:data][0] }
124
+ a2 = s2.to_a
125
+ a2 -= a1
126
+
127
+ return questions if a1.size <= 2 || a2.empty?
128
+
129
+ a1.each_cons(3) do |e1, e2, e3|
130
+ f4 = a2.shuffle![0]
131
+ e = [e1, e2, e3, f4]
132
+ e.shuffle!
133
+ q = Question.new(:choice)
134
+ q.name = "#{name(:id)}-#{num}-f1false-#{table.name}"
135
+ q.text = random_image_for(name(:raw))
136
+ q.text += lang.text_for(:f1, name(:decorated), table.fields[0].capitalize, e.join('</li><li>'))
137
+ q.good = lang.text_for(:false)
138
+ q.bads << lang.text_for(:misspelling)
139
+ q.bads << lang.text_for(:true)
140
+ questions << q
141
+
142
+ f4 = a2.shuffle![0]
143
+ q = Question.new(:choice)
144
+ q.name = "#{name(:id)}-#{num}-f2outsider-#{table.name}"
145
+ q.text = random_image_for(name(:raw))
146
+ q.text += lang.text_for(:f2, name(:decorated), table.fields[0].capitalize)
147
+ q.good = f4
148
+ q.bads << e1
149
+ q.bads << e2
150
+ q.bads << e3
151
+ questions << q
152
+ end
153
+
154
+ questions
155
+ end
156
+ end
@@ -0,0 +1,140 @@
1
+ # encoding: utf-8
2
+
3
+ require 'base64_compatible' # TODO: Don't work with Moodle Gift images
4
+ require 'set'
5
+
6
+ require_relative 'base_stage'
7
+ require_relative '../question'
8
+
9
+ class StageI < BaseStage
10
+ # range i1, i2, i3
11
+
12
+ def run
13
+ # Stage I: process every image from <def> tag
14
+ questions=[]
15
+ return questions unless type=="text"
16
+
17
+ # for every <image> do this
18
+ images.each do |url|
19
+ s=Set.new [name, lang.text_for(:none)]
20
+ neighbors.each { |n| s.add n[:concept].name }
21
+ a=s.to_a
22
+
23
+ # Question type <f1>: choose between 4 options
24
+ if s.count>3 then
25
+ q=Question.new(:choice)
26
+ q.name="#{name}-#{num}-i1choice"
27
+ q.text=lang.text_for(:i1, url )
28
+ q.good=name
29
+ q.bads << lang.text_for(:none)
30
+ q.bads << a[2]
31
+ q.bads << a[3]
32
+ questions << q
33
+ end
34
+
35
+ #Question type <i1>: choose between 4 options, good none (Syntax error)
36
+ if s.count>3 then
37
+ q=Question.new(:choice)
38
+ q.name="#{name}-#{num}-i1misspelling"
39
+ q.text=lang.text_for(:i1, url )
40
+ q.good = lang.text_for(:none)
41
+ q.bads << lang.do_mistake_to(name)
42
+ q.bads << a[2]
43
+ q.bads << a[3]
44
+ questions << q
45
+ end
46
+
47
+ s.delete(name)
48
+ a=s.to_a
49
+
50
+ #Question type <i1>: choose between 4 options, good none
51
+ if s.count>3 then
52
+ q = Question.new(:choice)
53
+ q.name="#{name}-#{num}-i1none"
54
+ q.text=lang.text_for(:i1, url )
55
+ q.good=lang.text_for(:none)
56
+ q.bads << a[1]
57
+ q.bads << a[2]
58
+ q.bads << a[3]
59
+ questions << q
60
+ end
61
+
62
+ #Question type <f2>: boolean => TRUE
63
+ q = Question.new(:boolean)
64
+ q.name="#{name}-#{num}-i2true"
65
+ q.text=lang.text_for(:i2, url, name )
66
+ q.good="TRUE"
67
+ questions << q
68
+
69
+ #Question type <i2>: boolean => FALSE
70
+ if neighbors.count>0 then
71
+ q = Question.new(:boolean)
72
+ q.name="#{name}-#{num}-i2false"
73
+ q.text=lang.text_for(:i2, url, neighbors[0][:concept].name )
74
+ q.good="FALSE"
75
+ questions << q
76
+ end
77
+
78
+ #Question type <i3>: hidden name questions
79
+ q = Question.new(:short)
80
+ q.name="#{name}-#{num}-i3short"
81
+ q.text=lang.text_for(:i3, url, lang.hide_text(name) )
82
+ q.shorts << name
83
+ q.shorts << name.gsub("-"," ").gsub("_"," ")
84
+ questions << q
85
+
86
+ #Question filtered text questions
87
+ texts.each do |t|
88
+ filtered=lang.text_with_connectors(t)
89
+
90
+ if filtered[:words].size>=4 then
91
+ # indexes=Set.new
92
+ # words=filtered[:words]
93
+ # while indexes.size<4
94
+ # i=rand(filtered[:words].size)
95
+ # flag=true
96
+ # flag=false if words[i].include?("[") or words[i].include?("]") or words[i].include?("(") or words[i].include?(")") or words[i].include?("\"")
97
+ # indexes << i if flag
98
+ # end
99
+ # indexes=indexes.to_a.sort
100
+ indexes = filtered[:indexes]
101
+ groups = (indexes.combination(4).to_a).shuffle
102
+ max = (indexes.size/4).to_i
103
+ groups[0,max].each do |e|
104
+ q = Question.new(:match)
105
+ q.shuffle_off
106
+ q.name = "#{name}-#{num}-i4filtered"
107
+ e.sort!
108
+ s=lang.build_text_from_filtered( filtered, e )
109
+ q.text = lang.text_for(:i4, url , s)
110
+ e.each_with_index do |value,index|
111
+ q.matching << [ (index+1).to_s, filtered[:words][value][:word].downcase ]
112
+ end
113
+ end
114
+ questions << q
115
+ end
116
+ end #each texts
117
+ end #each images
118
+ return questions
119
+ end
120
+
121
+ private
122
+
123
+ def html_for_raw_image(filename)
124
+ dirname = File.dirname(@concept_ia.filename)
125
+ filepath = File.join(dirname,filename)
126
+ content = File.open(filepath).read
127
+ content64 = Base64Compatible.encode64( content )
128
+ output =""
129
+ until(content64.nil?) do
130
+ output = output + content64[0,76]+"\n"
131
+ tmp = content64[76,9999999]
132
+ content64 = tmp
133
+ end
134
+
135
+ ext = File.extname(filename)
136
+ output = "<img src='data:image/#{ext};base64,#{output}' />"
137
+ return output
138
+ end
139
+
140
+ end
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative 'base_stage'
4
+ require_relative '../question'
5
+
6
+ class StageS < BaseStage
7
+
8
+ def run(pTable, pList1, pList2)
9
+ #process_sequence
10
+ questions = []
11
+ return questions unless ( pTable.fields.count==1 and pTable.sequence? and pTable.sequence[0]!="")
12
+
13
+ #TODO
14
+ #items=[]
15
+ #pList1.each_with_index { |i,j| items<<[ i[:data][0], j] }
16
+ #puts Rainbow(items).blue.bright
17
+
18
+ #Question type <d3sequence>: items are part of a sequence
19
+ if pList1.count>3
20
+ a=0..(pList1.count-4)
21
+ a.each_entry do |i|
22
+ q=Question.new(:match)
23
+ q.name="#{name}-#{num.to_s}-s1sequence-#{pTable.name}"
24
+ q.text= random_image_for(name) + lang.text_for(:s1, name, pTable.fields[0].capitalize, pTable.sequence[0] )
25
+ q.matching << [ pList1[i+0][:data][0], '1º' ]
26
+ q.matching << [ pList1[i+1][:data][0], '2º' ]
27
+ q.matching << [ pList1[i+2][:data][0], '3º' ]
28
+ q.matching << [ pList1[i+3][:data][0], '4º' ]
29
+ questions << q
30
+ end
31
+ end
32
+
33
+ #Question type <d4sequence>: items are part of a reverse sequence
34
+ if pList1.count>3 and pTable.sequence.size>1
35
+ a=0..(pList1.count-4)
36
+ a.each_entry do |i|
37
+ q=Question.new
38
+ q.set_match
39
+ q.name="#{name}-#{num.to_s}-s2sequence-#{pTable.name}"
40
+ q.text= random_image_for(name) + lang.text_for(:s1, name, pTable.fields[0].capitalize, pTable.sequence[1] )
41
+ q.matching << [ pList1[i+3][:data][0], '1º' ]
42
+ q.matching << [ pList1[i+2][:data][0], '2º' ]
43
+ q.matching << [ pList1[i+1][:data][0], '3º' ]
44
+ q.matching << [ pList1[i+0][:data][0], '4º' ]
45
+ questions << q
46
+ end
47
+ end
48
+
49
+ return questions
50
+ end
51
+
52
+ end
@@ -0,0 +1,170 @@
1
+ # encoding: utf-8
2
+
3
+ require 'set'
4
+ require_relative 'base_stage'
5
+ require_relative '../question'
6
+
7
+ class StageT < BaseStage
8
+ #range t1-t9...c1-c9
9
+
10
+ def run(pTable, pRow, pList) #process_tableXfields
11
+ questions = []
12
+ return questions unless type=="text"
13
+
14
+ if pTable.fields.count>1 then
15
+ questions = questions + process_table2fields(pTable, pRow, pList, 0, 1)
16
+ elsif pTable.fields.count>2 then
17
+ questions = questions + process_table2fields(pTable, pRow, pList, 0, 2)
18
+ questions = questions + process_table2fields(pTable, pRow, pList, 1, 2)
19
+ elsif pTable.fields.count>3 then
20
+ questions = questions + process_table2fields(pTable, pRow, pList, 0, 3)
21
+ questions = questions + process_table2fields(pTable, pRow, pList, 1, 3)
22
+ questions = questions + process_table2fields(pTable, pRow, pList, 2, 3)
23
+ end
24
+
25
+ return questions
26
+ end
27
+
28
+ private
29
+ def process_table2fields(lTable, lRow, pList, pCol1, pCol2)
30
+ questions = []
31
+ #create gift questions
32
+
33
+ # Using the column #0
34
+ s=Set.new [ lRow[:data][0] , lang.text_for(:none) ]
35
+ pList.each { |i| s.add( i[:data][0] ) }
36
+ a=s.to_a
37
+
38
+ if s.count>3 then
39
+ q=Question.new
40
+ q.name="#{name}-#{num.to_s}-t1table-#{lTable.name}"
41
+ q.text=lang.text_for(:t1table, name, lTable.fields[0].capitalize, lTable.fields[1].capitalize, lRow[:data][1])
42
+ q.good=lRow[:data][0]
43
+ q.bads << lang.text_for(:none)
44
+ q.bads << a[2]
45
+ q.bads << a[3]
46
+ questions << q
47
+ end
48
+
49
+ s=Set.new [ lRow[:data][0], lang.text_for(:none) ]
50
+ pList.each { |i| s.add( i[:data][0] ) }
51
+ a=s.to_a
52
+
53
+ if s.count>4 then
54
+ q=Question.new
55
+ q.name="#{name}-#{num.to_s}-t2table-#{lTable.name}"
56
+ q.text=lang.text_for(:t2table, name, lTable.fields[0].capitalize, lTable.fields[1].capitalize, lRow[:data][1])
57
+ q.good=lang.text_for(:none)
58
+ q.bads << a[2]
59
+ q.bads << a[3]
60
+ q.bads << a[4]
61
+ questions << q
62
+ end
63
+
64
+ # Using the column #1
65
+ s=Set.new [ lRow[:data][1], lang.text_for(:none) ]
66
+ pList.each { |i| s.add( i[:data][1] ) }
67
+ a=s.to_a
68
+
69
+ if s.count>3 then
70
+ q=Question.new
71
+ q.name="#{name}-#{num.to_s}-t3table-#{lTable.name}"
72
+ q.text=lang.text_for(:t3table, name, lTable.fields[0].capitalize, lRow[:data][0], lTable.fields[1].capitalize)
73
+ q.good=a[0]
74
+ q.bads << lang.text_for(:none)
75
+ q.bads << a[2]
76
+ q.bads << a[3]
77
+ questions << q
78
+ end
79
+
80
+ s=Set.new [ lRow[:data][1], lang.text_for(:none) ]
81
+ pList.each { |i| s.add( i[:data][1] ) }
82
+ a=s.to_a
83
+
84
+ if s.count>4 then
85
+ q=Question.new
86
+ q.name="#{name}-#{num.to_s}-t4table-#{lTable.name}"
87
+ q.text=lang.text_for(:t4table, name, lTable.fields[0].capitalize, lRow[:data][0], lTable.fields[1].capitalize)
88
+ q.good=lang.text_for(:none)
89
+ q.bads << a[2]
90
+ q.bads << a[3]
91
+ q.bads << a[4]
92
+ questions << q
93
+ end
94
+
95
+ # Boolean association TRUE
96
+ q=Question.new
97
+ q.set_boolean
98
+ q.name="#{name}-#{num.to_s}t5table-#{lTable.name}"
99
+ q.text=lang.text_for(:t5table, name, lTable.fields[0].capitalize, lRow[:data][0] ,lTable.fields[1].capitalize, lRow[:data][1] )
100
+ q.good="TRUE"
101
+ questions << q
102
+
103
+ # Boolean association FALSE
104
+ s=Set.new [ lRow[:data][1] ]
105
+ pList.each { |i| s.add( i[:data][1] ) }
106
+ a=s.to_a
107
+
108
+ if s.count>1 then
109
+ q=Question.new
110
+ q.set_boolean
111
+ q.name="#{name}-#{num.to_s}-t6table-#{lTable.name}"
112
+ q.text=lang.text_for(:t6table, name, lTable.fields[0].capitalize, lRow[:data][0], lTable.fields[1].capitalize, a[1] )
113
+ q.good="FALSE"
114
+ questions << q
115
+ end
116
+
117
+ s=Set.new [ lRow[:data][0] ]
118
+ pList.each { |i| s.add( i[:data][0] ) }
119
+ a=s.to_a
120
+
121
+ if s.count>1 then
122
+ q=Question.new
123
+ q.set_boolean
124
+ q.name="#{name}-#{num.to_s}t7table-#{lTable.name}"
125
+ q.text=lang.text_for(:t7table, name, lTable.fields[0].capitalize, a[1], lTable.fields[1].capitalize, lRow[:data][1] )
126
+ q.good="FALSE"
127
+ questions << q
128
+ end
129
+
130
+ # Short answer with column #0, 1 word
131
+ if lang.count_words(lRow[:data][0])==1 then
132
+ q=Question.new
133
+ q.set_short
134
+ q.name="#{name}-#{num.to_s}t8table-#{lTable.name}"
135
+ q.text=lang.text_for(:t8table, name, lTable.fields[1].capitalize, lRow[:data][1], lTable.fields[0].capitalize)
136
+ q.shorts << lRow[:data][0]
137
+ q.shorts << lRow[:data][0].gsub("-"," ").gsub("_"," ")
138
+ questions << q
139
+ elsif lang.count_words(lRow[:data][0])==2 then
140
+ q=Question.new
141
+ q.set_short
142
+ q.name="#{name}-#{num.to_s}t9table-#{lTable.name}"
143
+ q.text=lang.text_for(:t9table, name, lTable.fields[1].capitalize, lRow[:data][1], lTable.fields[0].capitalize, "[#{lang.hide_text(lRow[:data][0])}]", lang.count_words(lRow[:data][0]) )
144
+ q.shorts << lRow[:data][0]
145
+ q.shorts << lRow[:data][0].gsub("-"," ").gsub("_"," ")
146
+ questions << q
147
+ end
148
+
149
+ # Short answer with column #1, 1 word
150
+ if lang.count_words(lRow[:data][1])==1 then
151
+ q=Question.new
152
+ q.set_short
153
+ q.name="#{name}-#{num.to_s}t8table-#{lTable.name}"
154
+ q.text=lang.text_for(:t8table, name, lTable.fields[0].capitalize, lRow[:data][0], lTable.fields[1].capitalize)
155
+ q.shorts << lRow[:data][1]
156
+ q.shorts << lRow[:data][1].gsub("-"," ").gsub("_"," ")
157
+ questions << q
158
+ elsif lang.count_words(lRow[:data][1])==2 then
159
+ q=Question.new
160
+ q.set_short
161
+ q.name="#{name}-#{num.to_s}t9table-#{lTable.name}"
162
+ q.text=lang.text_for(:t9table, name, lTable.fields[0].capitalize, lRow[:data][0], lTable.fields[1].capitalize, "[#{lang.hide_text(lRow[:data][1])}]", lang.count_words(lRow[:data][1]) )
163
+ q.shorts << lRow[:data][1]
164
+ q.shorts << lRow[:data][1].gsub("-"," ").gsub("_"," ")
165
+ questions << q
166
+ end
167
+ return questions
168
+ end
169
+
170
+ end