llt-review 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/config.ru +6 -0
- data/lib/llt/review/alignment/parser/nokogiri_handler.rb +1 -1
- data/lib/llt/review/api/helpers.rb +47 -0
- data/lib/llt/review/api.rb +49 -10
- data/lib/llt/review/common/golden.rb +7 -1
- data/lib/llt/review/helpers/parsing/helper/annotator.rb +15 -0
- data/lib/llt/review/helpers/parsing/helper/annotators.rb +25 -0
- data/lib/llt/review/helpers/parsing/helper.rb +35 -0
- data/lib/llt/review/helpers/parsing/result.rb +6 -0
- data/lib/llt/review/helpers/reportable.rb +4 -0
- data/lib/llt/review/treebank/parser/nokogiri_handler.rb +28 -0
- data/lib/llt/review/treebank/parser/ox_handler.rb +20 -0
- data/lib/llt/review/treebank/postag.rb +0 -2
- data/lib/llt/review/version.rb +1 -1
- data/llt-review.gemspec +4 -1
- data/public/javascripts/script.js +91 -0
- data/public/javascripts/tooltipsy.min.js +20 -0
- data/public/stylesheets/default_styles.css +855 -0
- data/public/stylesheets/sass/style.scss +113 -0
- data/public/stylesheets/style.css +1 -0
- data/spec/lib/llt/review/treebank_spec.rb +14 -7
- data/views/comparison_header.haml +12 -0
- data/views/index.haml +99 -0
- data/views/layout.haml +12 -0
- data/views/percentage.haml +2 -0
- data/views/report_columns.haml +13 -0
- data/views/report_headers.haml +7 -0
- data/views/token.haml +5 -0
- metadata +49 -6
@@ -0,0 +1,113 @@
|
|
1
|
+
@mixin bg-transition($duration) {
|
2
|
+
transition: background-color $duration ease-out;
|
3
|
+
-webkit-transition: background-color $duration ease-out;
|
4
|
+
-moz-transition: background-color $duration ease-out;
|
5
|
+
-o-transition: background-color $duration ease-out;
|
6
|
+
|
7
|
+
}
|
8
|
+
.container {
|
9
|
+
max-width: 1000px;
|
10
|
+
margin: 20px auto;
|
11
|
+
}
|
12
|
+
|
13
|
+
.center {
|
14
|
+
text-align: center;
|
15
|
+
}
|
16
|
+
|
17
|
+
.right {
|
18
|
+
text-align: right;
|
19
|
+
}
|
20
|
+
|
21
|
+
.underline {
|
22
|
+
text-decoration: underline;
|
23
|
+
}
|
24
|
+
|
25
|
+
strong {
|
26
|
+
font-weight: bold;
|
27
|
+
}
|
28
|
+
|
29
|
+
.small {
|
30
|
+
font-size: small;
|
31
|
+
}
|
32
|
+
|
33
|
+
td.first {
|
34
|
+
text-align: left;
|
35
|
+
padding: 5px 10px;
|
36
|
+
/*border-bottom: 1px solid #434343;*/
|
37
|
+
color: #b6b6b6;
|
38
|
+
font-family: 'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important;
|
39
|
+
font-weight: normal;
|
40
|
+
}
|
41
|
+
|
42
|
+
.success {
|
43
|
+
color: rgb(106, 243, 106);
|
44
|
+
}
|
45
|
+
|
46
|
+
.success-bg {
|
47
|
+
background-color: green;
|
48
|
+
@include bg-transition(200ms);
|
49
|
+
}
|
50
|
+
|
51
|
+
.error-bg {
|
52
|
+
background-color: darkred;
|
53
|
+
@include bg-transition(200ms);
|
54
|
+
}
|
55
|
+
|
56
|
+
.error {
|
57
|
+
color: red;
|
58
|
+
}
|
59
|
+
|
60
|
+
.yellow {
|
61
|
+
color: yellow;
|
62
|
+
}
|
63
|
+
|
64
|
+
.big{
|
65
|
+
font-size: x-large;
|
66
|
+
}
|
67
|
+
|
68
|
+
.tooltipsy {
|
69
|
+
background: rgba(0,0,0,.9);
|
70
|
+
border-radius: 5px;
|
71
|
+
margin-bottom: 5px;
|
72
|
+
color: #fff;
|
73
|
+
white-space: pre;
|
74
|
+
padding: 5px 15px;
|
75
|
+
z-index: 98;
|
76
|
+
max-width: 220px;
|
77
|
+
}
|
78
|
+
|
79
|
+
sup.tiny {
|
80
|
+
color: #b6b6b6;
|
81
|
+
font-size: 50%;
|
82
|
+
top: -0.8em;
|
83
|
+
left: -0.4em;
|
84
|
+
}
|
85
|
+
|
86
|
+
table.word-diff-table {
|
87
|
+
@extend table.subtable;
|
88
|
+
|
89
|
+
width: 72%;
|
90
|
+
margin-left: 14%;
|
91
|
+
margin-right: 14%;
|
92
|
+
|
93
|
+
td {
|
94
|
+
&.large {
|
95
|
+
width: 24%;
|
96
|
+
}
|
97
|
+
&.small {
|
98
|
+
width: 19%;
|
99
|
+
border-left: 1px solid #434343;
|
100
|
+
}
|
101
|
+
&.postag {
|
102
|
+
font-family: "Lucida Console", Monaco, monospace;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
table.subtable {
|
108
|
+
font-size: .8rem;
|
109
|
+
}
|
110
|
+
|
111
|
+
.clickable {
|
112
|
+
cursor: pointer;
|
113
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
.container{max-width:1000px;margin:20px auto}.center{text-align:center}.right{text-align:right}.underline{text-decoration:underline}strong{font-weight:bold}.small{font-size:small}td.first{text-align:left;padding:5px 10px;color:#b6b6b6;font-family:'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important;font-weight:normal}.success{color:#6af36a}.success-bg{background-color:green;transition:background-color 200ms ease-out;-webkit-transition:background-color 200ms ease-out;-moz-transition:background-color 200ms ease-out;-o-transition:background-color 200ms ease-out}.error-bg{background-color:darkred;transition:background-color 200ms ease-out;-webkit-transition:background-color 200ms ease-out;-moz-transition:background-color 200ms ease-out;-o-transition:background-color 200ms ease-out}.error{color:red}.yellow{color:yellow}.big{font-size:x-large}.tooltipsy{background:rgba(0,0,0,0.9);border-radius:5px;margin-bottom:5px;color:#fff;white-space:pre;padding:5px 15px;z-index:98;max-width:220px}sup.tiny{color:#b6b6b6;font-size:50%;top:-0.8em;left:-0.4em}table.word-diff-table{width:72%;margin-left:14%;margin-right:14%}table.word-diff-table td.large{width:24%}table.word-diff-table td.small{width:19%;border-left:1px solid #434343}table.word-diff-table td.postag{font-family:"Lucida Console", Monaco, monospace}table.subtable,table.word-diff-table{font-size:.8rem}.clickable{cursor:pointer}
|
@@ -189,34 +189,41 @@ describe LLT::Review::Treebank do
|
|
189
189
|
pos['v'].total.should == 2
|
190
190
|
|
191
191
|
persons = datapoints[:persons]
|
192
|
-
persons.total.should ==
|
192
|
+
persons.total.should == 10
|
193
193
|
persons['3'].total.should == 2
|
194
|
+
persons['-'].total.should == 8
|
194
195
|
|
195
196
|
numbers = datapoints[:numbers]
|
196
|
-
numbers.total.should ==
|
197
|
+
numbers.total.should == 10
|
197
198
|
numbers['s'].total.should == 8
|
199
|
+
numbers['-'].total.should == 2
|
198
200
|
|
199
201
|
tenses = datapoints[:tenses]
|
200
|
-
tenses.total.should ==
|
202
|
+
tenses.total.should == 10
|
201
203
|
tenses['i'].total.should == 2
|
204
|
+
tenses['-'].total.should == 8
|
202
205
|
|
203
206
|
moods = datapoints[:moods]
|
204
|
-
moods.total.should ==
|
207
|
+
moods.total.should == 10
|
205
208
|
moods['i'].total.should == 2
|
209
|
+
moods['-'].total.should == 8
|
206
210
|
|
207
211
|
voices= datapoints[:voices]
|
208
|
-
voices.total.should ==
|
212
|
+
voices.total.should == 10
|
209
213
|
voices['a'].total.should == 2
|
214
|
+
voices['-'].total.should == 8
|
210
215
|
|
211
216
|
genders = datapoints[:genders]
|
212
|
-
genders.total.should ==
|
217
|
+
genders.total.should == 10
|
213
218
|
genders['n'].total.should == 4
|
214
219
|
genders['m'].total.should == 2
|
220
|
+
genders['-'].total.should == 4
|
215
221
|
|
216
222
|
cases = datapoints[:cases]
|
217
|
-
cases.total.should ==
|
223
|
+
cases.total.should == 10
|
218
224
|
cases['b'].total.should == 4
|
219
225
|
cases['n'].total.should == 2
|
226
|
+
cases['-'].total.should == 4
|
220
227
|
end
|
221
228
|
end
|
222
229
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%div.comparison_toggle{ c_id: combined_extracted_id(comparison)}
|
2
|
+
- percentage = comparison.report[:words].percentage
|
3
|
+
%span
|
4
|
+
•
|
5
|
+
%span{title: "Percentage of identical tokens"}
|
6
|
+
= haml :percentage, locals: { percentage: percentage }
|
7
|
+
%span -
|
8
|
+
%strong
|
9
|
+
= origin(comparison.reviewable)
|
10
|
+
%span against
|
11
|
+
%strong
|
12
|
+
= origin(comparison.gold)
|
data/views/index.haml
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
%h3.center.underline LLT Review
|
2
|
+
|
3
|
+
- diff.all_diffs.each do |c|
|
4
|
+
- rev = c.reviewable
|
5
|
+
- gold = c.gold
|
6
|
+
%p
|
7
|
+
= haml :comparison_header, locals: { comparison: c }
|
8
|
+
%div.comparison{id: combined_extracted_id(c)}
|
9
|
+
%h4.center.underline Report
|
10
|
+
|
11
|
+
%table
|
12
|
+
%tr
|
13
|
+
= haml :report_headers
|
14
|
+
- c.report.each do |category, rep|
|
15
|
+
- cl = category == :relations ? 'clickable' : ''
|
16
|
+
|
17
|
+
%tr.toggler{toggler: category, class: cl}
|
18
|
+
= haml :report_columns, locals: { label: category.capitalize, report: rep}
|
19
|
+
|
20
|
+
- if category == :relations
|
21
|
+
%tr{id: category}
|
22
|
+
%td{colspan: 6}
|
23
|
+
%table.subtable
|
24
|
+
%tr
|
25
|
+
= haml :report_headers
|
26
|
+
- sorted = rep.each_with_object([]) do |(k, v), h|
|
27
|
+
- h << [v.percentage, k, v]
|
28
|
+
- sorted.sort.each do |percent, label, obj|
|
29
|
+
%tr
|
30
|
+
= haml :report_columns, locals: { label: label, report: obj }
|
31
|
+
|
32
|
+
%h4.center.underline Diff
|
33
|
+
- c.each do |s_id, s_diff|
|
34
|
+
- next if s_id == :report
|
35
|
+
- sentence = rev.sentences[s_id]
|
36
|
+
|
37
|
+
.sentence
|
38
|
+
%p
|
39
|
+
%strong.big.yellow
|
40
|
+
= s_id
|
41
|
+
- sentence.each do |w_id, w|
|
42
|
+
- attrs = { id: to_id(s_id, w_id), class: 'token' }
|
43
|
+
- if w_diff = s_diff[w_id]
|
44
|
+
- attrs[:tooltip] = w_diff.map { |k, v| to_tooltip(k, v) }.join("\n")
|
45
|
+
- if heads = extract_heads(w_diff, s_id)
|
46
|
+
- attrs[:hr] = heads[0]
|
47
|
+
- attrs[:hw] = heads[1]
|
48
|
+
- attrs[:class] << ' head-error'
|
49
|
+
- attrs[:class] << ' error tooltip'
|
50
|
+
%span{attrs}
|
51
|
+
= haml :token, locals: { form: w.form, id: w_id }
|
52
|
+
|
53
|
+
%div.word-diff-container
|
54
|
+
.h4.clickable.underline{style: 'margin-left: 20px'} Diffs per Word
|
55
|
+
%table.word-diff-table
|
56
|
+
%tr{style: 'width: 28%'}
|
57
|
+
%th.center
|
58
|
+
%th.center head
|
59
|
+
%th.center relation
|
60
|
+
%th.center lemma
|
61
|
+
%th.center postag
|
62
|
+
- sentence.each do |w_id, w|
|
63
|
+
%tr
|
64
|
+
- w_diff = s_diff[w_id]
|
65
|
+
- errors = w_diff ? w_diff.container : {}
|
66
|
+
%td.first.large
|
67
|
+
- icon, cl = errors.empty? ? ['✔', :success] : ['✘', :error]
|
68
|
+
%span{class: cl}
|
69
|
+
= icon
|
70
|
+
= haml :token, locals: { form: w.form, id: w_id }
|
71
|
+
|
72
|
+
- tds = { head: [], relation: [], lemma: [], postag: ['center', 'postag'] }
|
73
|
+
- tds.each do |category, classes|
|
74
|
+
|
75
|
+
- error = errors[category]
|
76
|
+
- cl = error ? 'error-bg' : 'success-bg'
|
77
|
+
%td{class: [cl, 'small'] + classes}
|
78
|
+
- val = (error ? error.new : w[category]).to_s
|
79
|
+
- if category == :head
|
80
|
+
- parsed_head = sentence[val.to_i]
|
81
|
+
- f, id = parsed_head ? [parsed_head.form, parsed_head.id] : ["ROOT", 0]
|
82
|
+
= haml :token, locals: { form: f, id: id }
|
83
|
+
- else
|
84
|
+
%span
|
85
|
+
= val
|
86
|
+
%tr
|
87
|
+
- total = sentence.container.length
|
88
|
+
- wrongs = [s_diff.container.length]
|
89
|
+
- categories = %i{ head relation lemma postag };
|
90
|
+
- wrongs += categories.map do |cat|
|
91
|
+
- s_diff.container.inject(0) { |m, (_, w_diff)| m += w_diff[cat] ? 1 : 0 }
|
92
|
+
- wrongs.each do |wrong|
|
93
|
+
- percent = to_percent(total, total - wrong)
|
94
|
+
%td.center
|
95
|
+
= haml :percentage, locals: { percentage: percent }
|
96
|
+
|
97
|
+
.center.small
|
98
|
+
%a{ href: arethusa(extracted_id(rev.id), extracted_id(gold.id), gold.sentences.lang, s_id)}
|
99
|
+
View in Arethusa
|
data/views/layout.haml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title LLT Review
|
5
|
+
%link{ rel: 'stylesheet', href: url('/stylesheets/default_styles.css') }
|
6
|
+
%link{ rel: 'stylesheet', href: url('/stylesheets/style.css') }
|
7
|
+
%body
|
8
|
+
.container= yield
|
9
|
+
|
10
|
+
%script{ src: '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'}
|
11
|
+
%script{ src: url('/javascripts/tooltipsy.min.js') }
|
12
|
+
%script{ src: url('/javascripts/script.js') }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llt-review
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LFDM
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.14'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sass
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: haml
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
description: Reviews annotations
|
70
98
|
email:
|
71
99
|
- 1986gh@gmail.com
|
@@ -104,6 +132,7 @@ files:
|
|
104
132
|
- lib/llt/review/alignment/translation.rb
|
105
133
|
- lib/llt/review/alignment/word.rb
|
106
134
|
- lib/llt/review/api.rb
|
135
|
+
- lib/llt/review/api/helpers.rb
|
107
136
|
- lib/llt/review/common.rb
|
108
137
|
- lib/llt/review/common/comparison.rb
|
109
138
|
- lib/llt/review/common/difference.rb
|
@@ -118,6 +147,8 @@ files:
|
|
118
147
|
- lib/llt/review/helpers/diff_reporter.rb
|
119
148
|
- lib/llt/review/helpers/parsing.rb
|
120
149
|
- lib/llt/review/helpers/parsing/helper.rb
|
150
|
+
- lib/llt/review/helpers/parsing/helper/annotator.rb
|
151
|
+
- lib/llt/review/helpers/parsing/helper/annotators.rb
|
121
152
|
- lib/llt/review/helpers/parsing/helper/for_nokogiri.rb
|
122
153
|
- lib/llt/review/helpers/parsing/result.rb
|
123
154
|
- lib/llt/review/helpers/reportable.rb
|
@@ -152,6 +183,11 @@ files:
|
|
152
183
|
- lib/llt/review/treebank/word.rb
|
153
184
|
- lib/llt/review/version.rb
|
154
185
|
- llt-review.gemspec
|
186
|
+
- public/javascripts/script.js
|
187
|
+
- public/javascripts/tooltipsy.min.js
|
188
|
+
- public/stylesheets/default_styles.css
|
189
|
+
- public/stylesheets/sass/style.scss
|
190
|
+
- public/stylesheets/style.css
|
155
191
|
- spec/lib/llt/review/alignment/parser_spec.rb
|
156
192
|
- spec/lib/llt/review/alignment_spec.rb
|
157
193
|
- spec/lib/llt/review/helpers/reportable_spec.rb
|
@@ -160,6 +196,13 @@ files:
|
|
160
196
|
- spec/lib/llt/review/treebank_spec.rb
|
161
197
|
- spec/lib/llt/review_spec.rb
|
162
198
|
- spec/spec_helper.rb
|
199
|
+
- views/comparison_header.haml
|
200
|
+
- views/index.haml
|
201
|
+
- views/layout.haml
|
202
|
+
- views/percentage.haml
|
203
|
+
- views/report_columns.haml
|
204
|
+
- views/report_headers.haml
|
205
|
+
- views/token.haml
|
163
206
|
homepage: ''
|
164
207
|
licenses:
|
165
208
|
- MIT
|