llt-review 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b91983dc42ac4d0aece4d4d745e2576442f91fc
4
- data.tar.gz: faa768dab56010e1bc570506e7ae718ca503a11b
3
+ metadata.gz: 9452660774fe663f7ca4154dee4c92e1b89e6fa6
4
+ data.tar.gz: ee9ed9546e927348aff02c45e8998d777cdde2f1
5
5
  SHA512:
6
- metadata.gz: e2f9e3f7d61e8ac1493035d8789eb414190cbbe3f218a3c229ab66af09d55f0f7df1d7ba2ae0c761e195caa6a103a9bd77081a8938adb88e0626bcf849a65ff3
7
- data.tar.gz: 65f0e95aa16565761a0025f2832e91b2e8e22b4277ad35d625bc8ab63ad2072cad9d0c1acb8b321edddd7d0bb4b89e19d224129a243b7d329dbd4113b5e0d520
6
+ metadata.gz: 9e063b8af18c0ff106f40edaaca312fc25928fd4f88b464fa35d62b53cbd7140b2af04259440345a5649205cceddafc2d8bfdb64dc5ab3a43145a4b1d690f0d9
7
+ data.tar.gz: 63c20609d6f8ea55fa8f08bc1c9e1cd5995dc98d9a1bb27d9a86613b5c1174c46fd40a80a6d5764d3e0f69bc1604b49587afdf01b5a61c0893293e0f1733da2c
@@ -44,7 +44,7 @@ class Api < Sinatra::Base
44
44
  if backend = params[:backend]
45
45
  p = case backend
46
46
  when 'perseids' then 'sosol.perseids.org/sosol'
47
- when 'perseids-dev' then 'sosol-rep.perseids.org'
47
+ when 'perseids-dev' then 'sosol-rep.perseids.org/sosol'
48
48
  end
49
49
 
50
50
  expand_perseids_urls(params, :gold, p)
@@ -15,8 +15,8 @@ module LLT
15
15
  /(.*?)(\.([\w]*?))?$/.match(last)[1]
16
16
  end
17
17
 
18
- def arethusa(rev, gold, lang, chunk = nil, word = nil)
19
- path = "http://sosol.perseids.org/tools/arethusa/app/#/perseids_review_#{lang}_aldt"
18
+ def arethusa(rev, gold, chunk = nil, word = nil)
19
+ path = "http://sosol.perseids.org/tools/arethusa/app/#/perseids_review"
20
20
  path << "?doc=#{rev}&gold=#{gold}"
21
21
  if chunk || word
22
22
  path << "&chunk=#{chunk}" if chunk
@@ -23,7 +23,7 @@ module LLT
23
23
  def compare(gold, comparables = nil)
24
24
  comparison = Comparison.new(gold, self)
25
25
  comparison.compare(comparables)
26
- add(comparison) if comparison.any?
26
+ add(comparison)
27
27
  end
28
28
 
29
29
  def to_xml
@@ -1,5 +1,5 @@
1
1
  module LLT
2
2
  class Review
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- %div.comparison_toggle{ c_id: combined_extracted_id(comparison)}
1
+ %div.comparison_toggle{ c_id: combined_extracted_id(comparison) }
2
2
  - percentage = comparison.report[:words].percentage
3
3
  %span
4
4
 
data/views/index.haml CHANGED
@@ -29,71 +29,72 @@
29
29
  %tr
30
30
  = haml :report_columns, locals: { label: label, report: obj }
31
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]
32
+ - unless c.one? # means that the container has only a report, but no diffs
33
+ %h4.center.underline Diff
34
+ - c.each do |s_id, s_diff|
35
+ - next if s_id == :report
36
+ - sentence = rev.sentences[s_id]
36
37
 
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 }
38
+ .sentence
39
+ %p
40
+ %strong.big.yellow
41
+ = s_id
42
+ - sentence.each do |w_id, w|
43
+ - attrs = { id: to_id(s_id, w_id), class: 'token' }
44
+ - if w_diff = s_diff[w_id]
45
+ - attrs[:tooltip] = w_diff.map { |k, v| to_tooltip(k, v) }.join("\n")
46
+ - if heads = extract_heads(w_diff, s_id)
47
+ - attrs[:hr] = heads[0]
48
+ - attrs[:hw] = heads[1]
49
+ - attrs[:class] << ' head-error'
50
+ - attrs[:class] << ' error tooltip'
51
+ %span{attrs}
52
+ = haml :token, locals: { form: w.form, id: w_id }
52
53
 
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 }
54
+ %div.word-diff-container
55
+ .h4.clickable.underline{style: 'margin-left: 20px'} Diffs per Word
56
+ %table.word-diff-table
57
+ %tr{style: 'width: 28%'}
58
+ %th.center
59
+ %th.center head
60
+ %th.center relation
61
+ %th.center lemma
62
+ %th.center postag
63
+ - sentence.each do |w_id, w|
64
+ %tr
65
+ - w_diff = s_diff[w_id]
66
+ - errors = w_diff ? w_diff.container : {}
67
+ %td.first.large
68
+ - icon, cl = errors.empty? ? ['✔', :success] : ['✘', :error]
69
+ %span{class: cl}
70
+ = icon
71
+ = haml :token, locals: { form: w.form, id: w_id }
71
72
 
72
- - tds = { head: [], relation: [], lemma: [], postag: ['center', 'postag'] }
73
- - tds.each do |category, classes|
73
+ - tds = { head: [], relation: [], lemma: [], postag: ['center', 'postag'] }
74
+ - tds.each do |category, classes|
74
75
 
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 }
76
+ - error = errors[category]
77
+ - cl = error ? 'error-bg' : 'success-bg'
78
+ %td{class: [cl, 'small'] + classes}
79
+ - val = (error ? error.new : w[category]).to_s
80
+ - if category == :head
81
+ - parsed_head = sentence[val.to_i]
82
+ - f, id = parsed_head ? [parsed_head.form, parsed_head.id] : ["ROOT", 0]
83
+ = haml :token, locals: { form: f, id: id }
84
+ - else
85
+ %span
86
+ = val
87
+ %tr
88
+ - total = sentence.container.length
89
+ - wrongs = [s_diff.container.length]
90
+ - categories = %i{ head relation lemma postag };
91
+ - wrongs += categories.map do |cat|
92
+ - s_diff.container.inject(0) { |m, (_, w_diff)| m += w_diff[cat] ? 1 : 0 }
93
+ - wrongs.each do |wrong|
94
+ - percent = to_percent(total, total - wrong)
95
+ %td.center
96
+ = haml :percentage, locals: { percentage: percent }
96
97
 
97
- .center.small
98
- %a{ href: arethusa(extracted_id(rev.id), extracted_id(gold.id), gold.sentences.lang, s_id)}
99
- View in Arethusa
98
+ .center.small
99
+ %a{ href: arethusa(extracted_id(rev.id), extracted_id(gold.id), s_id)}
100
+ View in Arethusa
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - LFDM
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-14 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler