iqvoc_inflectionals 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +122 -0
- data/README.md +13 -0
- data/Rakefile +11 -0
- data/app/models/inflectional/base.rb +345 -0
- data/app/models/inflectional/label_extension.rb +58 -0
- data/app/views/partials/inflectional/_base.html.erb +22 -0
- data/app/views/partials/inflectional/_edit_base.html.erb +7 -0
- data/app/views/partials/inflectional/_search_result.html.erb +13 -0
- data/config/application.rb +56 -0
- data/config/boot.rb +13 -0
- data/config/database.template.yml +30 -0
- data/config/engine.rb +13 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +55 -0
- data/config/environments/production.rb +64 -0
- data/config/environments/test.rb +46 -0
- data/config/initializers/engine_extensions.rb +6 -0
- data/config/initializers/iqvoc.rb +11 -0
- data/config/initializers/secret_token.rb.template +16 -0
- data/config/initializers/session_store.rb +11 -0
- data/config/locales/activerecord.de.yml +6 -0
- data/config/locales/activerecord.en.yml +6 -0
- data/config/routes.rb +2 -0
- data/config.ru +4 -0
- data/db/migrate/20120109143704_create_inflectionals.rb +25 -0
- data/db/schema.rb +158 -0
- data/db/seeds.rb +0 -0
- data/iqvoc_inflectionals.gemspec +26 -0
- data/lib/engine_tasks/db.rake +19 -0
- data/lib/iqvoc/inflectionals/label_extensions.rb +23 -0
- data/lib/iqvoc/inflectionals/version.rb +5 -0
- data/lib/iqvoc_inflectionals.rb +15 -0
- data/public/.gitkeep +0 -0
- data/script/rails +6 -0
- data/test/test_helper.rb +10 -0
- data/test/unit/inflectional_test.rb +33 -0
- metadata +120 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem 'iqvoc', '~> 3.3.3'
|
4
|
+
gem 'iqvoc_skosxl', '~> 1.1.4'
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem 'sqlite3'
|
8
|
+
end
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem 'test-unit'
|
12
|
+
gem 'spork', '~> 0.9.0.rc' # v0.9 required for spork-testunit
|
13
|
+
gem 'spork-testunit'
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.1.3)
|
5
|
+
actionpack (= 3.1.3)
|
6
|
+
mail (~> 2.3.0)
|
7
|
+
actionpack (3.1.3)
|
8
|
+
activemodel (= 3.1.3)
|
9
|
+
activesupport (= 3.1.3)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
i18n (~> 0.6)
|
13
|
+
rack (~> 1.3.5)
|
14
|
+
rack-cache (~> 1.1)
|
15
|
+
rack-mount (~> 0.8.2)
|
16
|
+
rack-test (~> 0.6.1)
|
17
|
+
sprockets (~> 2.0.3)
|
18
|
+
activemodel (3.1.3)
|
19
|
+
activesupport (= 3.1.3)
|
20
|
+
builder (~> 3.0.0)
|
21
|
+
i18n (~> 0.6)
|
22
|
+
activerecord (3.1.3)
|
23
|
+
activemodel (= 3.1.3)
|
24
|
+
activesupport (= 3.1.3)
|
25
|
+
arel (~> 2.2.1)
|
26
|
+
tzinfo (~> 0.3.29)
|
27
|
+
activeresource (3.1.3)
|
28
|
+
activemodel (= 3.1.3)
|
29
|
+
activesupport (= 3.1.3)
|
30
|
+
activesupport (3.1.3)
|
31
|
+
multi_json (~> 1.0)
|
32
|
+
arel (2.2.1)
|
33
|
+
authlogic (3.1.0)
|
34
|
+
activerecord (>= 3.0.7)
|
35
|
+
activerecord (>= 3.0.7)
|
36
|
+
builder (3.0.0)
|
37
|
+
cancan (1.6.7)
|
38
|
+
erubis (2.7.0)
|
39
|
+
hike (1.2.1)
|
40
|
+
i18n (0.6.0)
|
41
|
+
iq_rdf (0.1.0)
|
42
|
+
builder
|
43
|
+
bundler
|
44
|
+
iqvoc (3.3.3)
|
45
|
+
authlogic
|
46
|
+
bundler
|
47
|
+
cancan
|
48
|
+
iq_rdf (~> 0.1.0)
|
49
|
+
json
|
50
|
+
kaminari
|
51
|
+
rails (~> 3.1.3)
|
52
|
+
rails_autolink
|
53
|
+
iqvoc_skosxl (1.1.4)
|
54
|
+
bundler
|
55
|
+
iqvoc
|
56
|
+
json (1.6.5)
|
57
|
+
kaminari (0.13.0)
|
58
|
+
actionpack (>= 3.0.0)
|
59
|
+
activesupport (>= 3.0.0)
|
60
|
+
railties (>= 3.0.0)
|
61
|
+
mail (2.3.0)
|
62
|
+
i18n (>= 0.4.0)
|
63
|
+
mime-types (~> 1.16)
|
64
|
+
treetop (~> 1.4.8)
|
65
|
+
mime-types (1.17.2)
|
66
|
+
multi_json (1.0.4)
|
67
|
+
polyglot (0.3.3)
|
68
|
+
rack (1.3.6)
|
69
|
+
rack-cache (1.1)
|
70
|
+
rack (>= 0.4)
|
71
|
+
rack-mount (0.8.3)
|
72
|
+
rack (>= 1.0.0)
|
73
|
+
rack-ssl (1.3.2)
|
74
|
+
rack
|
75
|
+
rack-test (0.6.1)
|
76
|
+
rack (>= 1.0)
|
77
|
+
rails (3.1.3)
|
78
|
+
actionmailer (= 3.1.3)
|
79
|
+
actionpack (= 3.1.3)
|
80
|
+
activerecord (= 3.1.3)
|
81
|
+
activeresource (= 3.1.3)
|
82
|
+
activesupport (= 3.1.3)
|
83
|
+
bundler (~> 1.0)
|
84
|
+
railties (= 3.1.3)
|
85
|
+
rails_autolink (1.0.4)
|
86
|
+
rails (>= 3.1.0)
|
87
|
+
railties (3.1.3)
|
88
|
+
actionpack (= 3.1.3)
|
89
|
+
activesupport (= 3.1.3)
|
90
|
+
rack-ssl (~> 1.3.2)
|
91
|
+
rake (>= 0.8.7)
|
92
|
+
rdoc (~> 3.4)
|
93
|
+
thor (~> 0.14.6)
|
94
|
+
rake (0.9.2.2)
|
95
|
+
rdoc (3.12)
|
96
|
+
json (~> 1.4)
|
97
|
+
spork (0.9.0.rc9)
|
98
|
+
spork-testunit (0.0.7)
|
99
|
+
spork (>= 0.6.0)
|
100
|
+
sprockets (2.0.3)
|
101
|
+
hike (~> 1.2)
|
102
|
+
rack (~> 1.0)
|
103
|
+
tilt (~> 1.1, != 1.3.0)
|
104
|
+
sqlite3 (1.3.5)
|
105
|
+
test-unit (2.4.5)
|
106
|
+
thor (0.14.6)
|
107
|
+
tilt (1.3.3)
|
108
|
+
treetop (1.4.10)
|
109
|
+
polyglot
|
110
|
+
polyglot (>= 0.3.1)
|
111
|
+
tzinfo (0.3.31)
|
112
|
+
|
113
|
+
PLATFORMS
|
114
|
+
ruby
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
iqvoc (~> 3.3.3)
|
118
|
+
iqvoc_skosxl (~> 1.1.4)
|
119
|
+
spork (~> 0.9.0.rc)
|
120
|
+
spork-testunit
|
121
|
+
sqlite3
|
122
|
+
test-unit
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
require 'rake'
|
7
|
+
|
8
|
+
Iqvoc::Inflectionals::Application.load_tasks
|
9
|
+
|
10
|
+
require 'bundler'
|
11
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,345 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'digest/md5'
|
4
|
+
|
5
|
+
class Inflectional::Base < ActiveRecord::Base
|
6
|
+
|
7
|
+
class_attribute :rdf_namespace, :rdf_predicate
|
8
|
+
self.rdf_namespace = 'umt'
|
9
|
+
self.rdf_predicate = 'inflectional'
|
10
|
+
|
11
|
+
set_table_name 'inflectionals'
|
12
|
+
|
13
|
+
validates :value, :presence => true
|
14
|
+
validates :label_id, :presence => true
|
15
|
+
|
16
|
+
belongs_to :label, :class_name => Iqvoc::XLLabel.base_class_name
|
17
|
+
|
18
|
+
before_save do
|
19
|
+
self.normal_hash = self.class.normalize(self.value)
|
20
|
+
end
|
21
|
+
|
22
|
+
scope :by_query_value, lambda { |query|
|
23
|
+
where(["LOWER(#{table_name}.value) LIKE ?", query.to_s.downcase])
|
24
|
+
}
|
25
|
+
|
26
|
+
MAPPINGS = {
|
27
|
+
:de => {
|
28
|
+
:"50" => ["A", "EN", "AS"],
|
29
|
+
:"51" => [".", "S", "ES", "ER", "ERN"],
|
30
|
+
:"52" => [".", "S", "N", "E", "EN"],
|
31
|
+
:"61" => [".", "ES"],
|
32
|
+
:"62" => [".", "S", "ES"],
|
33
|
+
:"71" => [".", "ER"],
|
34
|
+
:"73" => [".", "E", "EM", "EN", "ER", "ES", "M", "N", "S"],
|
35
|
+
:"74" => [".", "R", "S"],
|
36
|
+
:"75" => ["A", "EN"],
|
37
|
+
:"77" => ["EN", "E", "EST", "ET", "T", "TE", "TEN", "TET"],
|
38
|
+
:"78" => [".", "T"],
|
39
|
+
:"7B" => [".", "N", "E", "EN", "EST", "ET", "ST", "T"],
|
40
|
+
:"80" => [".", "S", "E", "EN"],
|
41
|
+
:"95" => [".", "E", "ES", "ER", "ERN"],
|
42
|
+
:"9E" => [".", "ENS"],
|
43
|
+
:"9F" => [".", "SE", "SES", "SEN"],
|
44
|
+
:"A0" => [".", "EN", "E", "EST", "ET", "ST", "T", "TE", "TEN", "TET"],
|
45
|
+
:"A1" => [".", "EN", "E", "EST", "ET", "T", "TE", "TEN", "TET"],
|
46
|
+
:"A2" => [".", "N", "E", "ST", "T", "TE", "TEN", "TET"],
|
47
|
+
:"A3" => [".", "N", "ST", "T", "TE", "TEN", "TET"],
|
48
|
+
:"AB" => [".", "EN", "E", "EST", "ET", "ST", "T"],
|
49
|
+
:"AC" => [".", "EN", "E", "EST", "ET", "T"],
|
50
|
+
:"AD" => [".", "N", "ST", "T"],
|
51
|
+
:"AE" => [".", "N", "T"],
|
52
|
+
:"AX" => ["E", "N", "ST", "T", "TE", "TEN", "TET"],
|
53
|
+
:"AY" => ["E", "EN", "EST", "ET", "ST", "T", "TE", "TEN", "TET"],
|
54
|
+
:"AZ" => ["E", "N", "ST", "T", "TE", "TEN", "TET"],
|
55
|
+
:"B0" => [".", "EN", "EST", "ET", "ST", "T"],
|
56
|
+
:"B5" => ["T", "ST", "TEN", "TE", "TET"],
|
57
|
+
:"BA" => [".", "EN", "EST", "ET", "T"],
|
58
|
+
:"BB" => [".", "E", "EN", "EST", "ET", "ST"],
|
59
|
+
:"BC" => [".", "EN", "EST", "ET", "ST"],
|
60
|
+
:"BD" => [".", "EN", "EST", "ET"],
|
61
|
+
:"BF" => ["E", "EN", "EST", "ET"],
|
62
|
+
:"C0" => [".", "ST", "T"],
|
63
|
+
:"C1" => [".", "E", "ST", "T"],
|
64
|
+
:"C3" => ["ST", "T"],
|
65
|
+
:"C4" => [".", "ST"],
|
66
|
+
:"C7" => [".", "D", "DE", "DEM", "DEN", "DER", "DES"],
|
67
|
+
:"C8" => [".", "T", "TE", "TEN", "TET"],
|
68
|
+
:"C9" => [".", "D", "DE", "DEM", "DEN", "DER", "DES", "S"],
|
69
|
+
:"CA" => [".", "E", "EN", "ES", "S"],
|
70
|
+
:"CB" => [".", "EN", "ES"],
|
71
|
+
:"CC" => [".", "E", "EN", "ES"],
|
72
|
+
:"AD" => [".", "N", "ST", "T"],
|
73
|
+
:"AE" => [".", "N", "T"],
|
74
|
+
:"AX" => ["E", "N", "ST", "T", "TE", "TEN", "TET"],
|
75
|
+
:"AY" => ["E", "EN", "EST", "ET", "ST", "T", "TE", "TEN", "TET"],
|
76
|
+
:"AZ" => ["E", "N", "ST", "T", "TE", "TEN", "TET"],
|
77
|
+
:"B0" => [".", "EN", "EST", "ET", "ST", "T"],
|
78
|
+
:"B5" => ["T", "ST", "TEN", "TE", "TET"],
|
79
|
+
:"BA" => [".", "EN", "EST", "ET", "T"],
|
80
|
+
:"BB" => [".", "E", "EN", "EST", "ET", "ST"],
|
81
|
+
:"BC" => [".", "EN", "EST", "ET", "ST"],
|
82
|
+
:"BD" => [".", "EN", "EST", "ET"],
|
83
|
+
:"BF" => ["E", "EN", "EST", "ET"],
|
84
|
+
:"C0" => [".", "ST", "T"],
|
85
|
+
:"C1" => [".", "E", "ST", "T"],
|
86
|
+
:"C3" => ["ST", "T"],
|
87
|
+
:"C4" => [".", "ST"],
|
88
|
+
:"C7" => [".", "D", "DE", "DEM", "DEN", "DER", "DES"],
|
89
|
+
:"C8" => [".", "T", "TE", "TEN", "TET"],
|
90
|
+
:"C9" => [".", "D", "DE", "DEM", "DEN", "DER", "DES", "S"],
|
91
|
+
:"CA" => [".", "E", "EN", "ES", "S"],
|
92
|
+
:"CB" => [".", "EN", "ES"],
|
93
|
+
:"CC" => [".", "E", "EN", "ES"],
|
94
|
+
:"CD" => [".", "SE", "SEN"],
|
95
|
+
:"CE" => [".", "E", "ER", "ERN", "ES", "S"],
|
96
|
+
:"CF" => [".", "EN", "S"],
|
97
|
+
:"CG" => [".", "EN", "ES", "S"],
|
98
|
+
:"D0" => [".", "EN"],
|
99
|
+
:"D1" => [".", "NEN"],
|
100
|
+
:"D2" => [".", "R", "N"],
|
101
|
+
:"D3" => [".", "N"],
|
102
|
+
:"D4" => [".", "N", "NS"],
|
103
|
+
:"D5" => [".", "E", "ES", "S"],
|
104
|
+
:"D6" => [".", "E", "ES"],
|
105
|
+
:"D7" => [".", "S"],
|
106
|
+
:"D8" => [".", "EN", "ENS"],
|
107
|
+
:"D9" => [".", "N", "S"],
|
108
|
+
:"DA" => ["A", "AS", "ATA", "EN"],
|
109
|
+
:"DB" => ["A", "AS", "ATA", "ATE"],
|
110
|
+
:"DD" => ["UM", "EN", "UMS"],
|
111
|
+
:"DE" => ["UM", "A", "EN", "UMS"],
|
112
|
+
:"DF" => ["US", "EN"],
|
113
|
+
:"E0" => ["US", "EEN"],
|
114
|
+
:"E2" => ["US", "I"],
|
115
|
+
:"E3" => ["S", "SSES", "NTEN", "SSE", "SSEN"],
|
116
|
+
:"E4" => ["S", "DEN"],
|
117
|
+
:"E5" => ["S", "ZIEN"],
|
118
|
+
:"E6" => ["EX", "EXEN", "EXE", "ICES", "IZES"],
|
119
|
+
:"E7" => ["X", "CES", "ZES", "ZEN"],
|
120
|
+
:"E9" => ["O", "OS", "EN"],
|
121
|
+
:"EA" => ["ON", "A", "EN", "ONS"],
|
122
|
+
:"EB" => ["OS", "EN"],
|
123
|
+
:"EC" => ["IS", "EN"],
|
124
|
+
:"ED" => ["I", "IS", "EN", "E"],
|
125
|
+
:"EE" => ["Y", "IES", "YS"],
|
126
|
+
:"EF" => ["EN", "ENS", "INA"],
|
127
|
+
:"F0" => [".", "S", "E", "IEN"],
|
128
|
+
:"F1" => [".", "S", "ER"],
|
129
|
+
:"F3" => [".", "M", "N", "R", "S", "RE", "REM", "REN", "RER", "RES"],
|
130
|
+
:"F4" => [".", "M", "N", "R", "S"],
|
131
|
+
:"F5" => [".", "E", "EM", "EN", "ER", "ES", "ERE", "EREM", "EREN", "ERER", "ERES", "EST", "ESTE", "ESTEM", "ESTEN", "ESTER", "ESTES"],
|
132
|
+
:"F6" => [".", "E", "EM", "EN", "ER", "ES", "ERE", "EREM", "EREN", "ERER", "ERES", "ST", "STE", "STEM", "STEN", "STER", "STES"],
|
133
|
+
:"F7" => [".", "E", "EM", "EN", "ER", "ES"],
|
134
|
+
:"FC" => [".", "ER", "EN", "T", "TER", "TEN", "TES", "TEM", "TENS"],
|
135
|
+
:"FE" => [".", "E", "EM", "EN", "ER", "ES", "S"],
|
136
|
+
:"FF" => ["."],
|
137
|
+
:"FG" => [".", "EN", "ER"],
|
138
|
+
:"FH" => ["E", "EM", "EN", "ER", "ES", "S"],
|
139
|
+
:"G7" => [".", "E", "EM", "EN", "ES"],
|
140
|
+
:"N1" => [".", "ES"],
|
141
|
+
:"N2" => ["Y", "IES"],
|
142
|
+
:"N3" => ["F", "VES"],
|
143
|
+
:"N9" => ["US", "I", "USES"],
|
144
|
+
:"NA" => ["A", "AE"],
|
145
|
+
:"NB" => ["UM", "A"],
|
146
|
+
:"NC" => ["UM", "A", "UMS"],
|
147
|
+
:"ND" => ["O", "I"],
|
148
|
+
:"NE" => ["O", "I", "OS"],
|
149
|
+
:"NF" => ["ON", "A"],
|
150
|
+
:"NI" => ["IS", "ES", "ISES"],
|
151
|
+
:"NL" => ["EX", "ICES"],
|
152
|
+
:"NQ" => [".", "TA", "S"],
|
153
|
+
:"PP" => [".", "."],
|
154
|
+
:"T0" => [".", "E"],
|
155
|
+
:"TA" => [".", "E", "S"],
|
156
|
+
:"TF" => [".", "E", "EN"],
|
157
|
+
:"TK" => ["LE", "LER", "LES", "EL", "LEN", "LEM"],
|
158
|
+
:"U2" => ["A", "AS", "ATA"],
|
159
|
+
:"U3" => [".", "EN", "ST"],
|
160
|
+
:"U5" => [".", "EN", "N"],
|
161
|
+
:"U6" => [".", "EN", "T"],
|
162
|
+
:"U7" => [".", "E", "T"],
|
163
|
+
:"UA" => [".", "EN", "ST", "T"],
|
164
|
+
:"UB" => [".", "E", "ER", "ES"],
|
165
|
+
:"UC" => [".", "S", "ER", "ES"],
|
166
|
+
:"UD" => [".", "E", "EN", "ST"],
|
167
|
+
:"UE" => [".", "E", "EN", "T"],
|
168
|
+
:"UG" => [".", "S", "ES", "TEN"],
|
169
|
+
:"UI" => ["E", "EN", "T"],
|
170
|
+
:"UL" => [".", "ER", "ES"],
|
171
|
+
:"UM" => ["E", "EN", "EST", "ET", "T"],
|
172
|
+
:"XC" => ["N", "ST", "T", "TE", "TEN", "TET"],
|
173
|
+
:"XK" => ["E", "EN", "EST"],
|
174
|
+
:"XM" => ["E", "ST", "T", "EN", "EST", "ET"],
|
175
|
+
:"XO" => ["EN", "ST", "T"],
|
176
|
+
:"XT" => [".", "E", "N", "ST", "T", "TE", "TEN", "TES", "TET", "TEM", "TER"],
|
177
|
+
:"XU" => [".", "ST", "T", "TE", "TEM", "TEN", "TER", "TES", "TET"],
|
178
|
+
:"XV" => ["ST", "T", "TE", "TEM", "TEN", "TER", "TET", "TES"],
|
179
|
+
:"XW" => ["EN", "E", "EST", "ET", "ST", "T", "TE", "TEM", "TEN", "TER", "TES", "TET"],
|
180
|
+
:"Y0" => ["ES", "ER", "ERN"],
|
181
|
+
:"Y3" => [".", "E", "EN", "EST", "ET"],
|
182
|
+
:"Y4" => ["EN", "EST", "ET"],
|
183
|
+
:"YA" => [".", "EN", "E", "EST", "ET", "ST", "T", "TE", "TEM", "TEN", "TER", "TES", "TET"],
|
184
|
+
:"YB" => [".", "EN", "E", "EST", "ET", "T", "TE", "TEN", "TET", "ES"],
|
185
|
+
:"YC" => [".", "N", "E", "ST", "T", "TE", "TEN", "TE", "TET", "TEM", "TER", "TES"],
|
186
|
+
:"YD" => [".", "EN", "E", "EST", "ET", "TE", "TEN", "TET"],
|
187
|
+
:"YE" => ["E", "EN", "ST", "T", "TE", "TEN", "TEM", "TER", "TES"],
|
188
|
+
:"YF" => ["E", "N", "ST", "T", "TE", "TEN", "TEM", "TER", "TES", "TET"],
|
189
|
+
:"YL" => ["E", "T"],
|
190
|
+
:"YS" => ["ST", "N", "T"],
|
191
|
+
:"YW" => ["E", "N", "ES", "EN"],
|
192
|
+
:"Z1" => [".", "S", "N", "IN", "INNEN"],
|
193
|
+
:"Z2" => [".", "EN", "IN", "INNEN"],
|
194
|
+
:"Z4" => ["E", "ER", "EN", "IN", "INNEN"],
|
195
|
+
:"Z5" => [".", "S", "EN", "IN", "INNEN"],
|
196
|
+
:"Z6" => [".", "TER", "TEM", "TES", "TEN", "TE"],
|
197
|
+
:"Z7" => [".", "E", "EN", "IN", "INNEN", "S"],
|
198
|
+
:"Z8" => [".", "EN", "IN", "N", "INNEN"],
|
199
|
+
:"ZZ" => ["E", "EN", "IN", "INNEN"]
|
200
|
+
},
|
201
|
+
|
202
|
+
:en => {
|
203
|
+
:"D0" => [".", "EN"],
|
204
|
+
:"D7" => [".", "S"],
|
205
|
+
:"E2" => ["US", "I"],
|
206
|
+
:"EE" => ["Y", "IES", "YS"],
|
207
|
+
:"FF" => ["."],
|
208
|
+
:"N1" => [".", "ES"],
|
209
|
+
:"N2" => ["Y", "IES"],
|
210
|
+
:"N3" => ["F", "VES"],
|
211
|
+
:"N5" => ["F", "FS", "VES"],
|
212
|
+
:"N7" => [".", "REN"],
|
213
|
+
:"N8" => ["US", "I"],
|
214
|
+
:"NA" => ["A", "AE"],
|
215
|
+
:"NB" => ["UM", "A"],
|
216
|
+
:"NC" => ["UM", "A", "UMS"],
|
217
|
+
:"ND" => ["O", "I"],
|
218
|
+
:"NE" => ["O", "I", "OS"],
|
219
|
+
:"NF" => ["ON", "A"],
|
220
|
+
:"NG" => ["ON", "A", "ONS"],
|
221
|
+
:"NH" => ["IS", "ES"],
|
222
|
+
:"NM" => ["EX", "ICES", "EXES"],
|
223
|
+
:"NO" => ["X", "CES", "XES"],
|
224
|
+
:"PP" => [".", "."],
|
225
|
+
:"R0" => ["R", "ST"],
|
226
|
+
:"R1" => [".", "R", "ST"],
|
227
|
+
:"R2" => [".", "R", "ST", "LY"],
|
228
|
+
:"R3" => [".", "ER", "EST"],
|
229
|
+
:"R4" => ["Y", "IER", "IEST"],
|
230
|
+
:"R5" => [".", "LY"],
|
231
|
+
:"R6" => [".", "ER", "EST", "LY"],
|
232
|
+
:"R7" => ["Y", "IER", "IEST", "ILY"],
|
233
|
+
:"R8" => ["E", "ER", "EST", "LY"],
|
234
|
+
:"R9" => ["LE", "LY"],
|
235
|
+
:"RA" => ["Y", "ILY"],
|
236
|
+
:"V0" => [".", "S", "D"],
|
237
|
+
:"V1" => [".", "S", "ED"],
|
238
|
+
:"V2" => [".", "ED"],
|
239
|
+
:"V3" => [".", "ES", "ED"],
|
240
|
+
:"V4" => ["ED", "ING"],
|
241
|
+
:"V5" => ["E", "ES", "ING"],
|
242
|
+
:"V7" => [".", "S", "ED", "ING"],
|
243
|
+
:"V8" => [".", "ES", "ED", "ING"],
|
244
|
+
:"V9" => ["E", "ES", "ED", "ING"],
|
245
|
+
:"VA" => [".", "S", "LED", "LING"],
|
246
|
+
:"VB" => [".", "Y", "IES", "IED", "YING"],
|
247
|
+
:"VC" => [".", "S", "ING"],
|
248
|
+
:"VD" => [".", "ING"],
|
249
|
+
:"VE" => [".", "ED", "ING"],
|
250
|
+
:"VF" => [".", "S", "NED", "NING"],
|
251
|
+
:"VG" => [".", "S", "PED", "PING"],
|
252
|
+
:"VH" => [".", "S", "RED", "RING"],
|
253
|
+
:"VI" => [".", "S", "TED", "TING"],
|
254
|
+
:"VJ" => [".", "ES", "ING"],
|
255
|
+
:"VK" => [".", "S", "BED", "BING"],
|
256
|
+
:"VM" => [".", "S", "D", "ING"],
|
257
|
+
:"VN" => [".", "S", "DED", "DING"],
|
258
|
+
:"VP" => [".", "S", "EN", "ING"],
|
259
|
+
:"VQ" => [".", "S", "GED", "GING"],
|
260
|
+
:"VR" => [".", "S", "MED", "MING"],
|
261
|
+
:"VS" => [".", "S", "SED", "SING"],
|
262
|
+
:"VT" => ["US", "USSE", "USSEN", "EN"]
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
def self.codes_for_language(lang)
|
267
|
+
return [] if lang.blank? || !mappings.has_key?(lang.to_sym)
|
268
|
+
mappings[lang.to_sym].keys.sort {|a,b| a.to_s <=> b.to_s }
|
269
|
+
end
|
270
|
+
|
271
|
+
def self.for_language_and_code(lang, code)
|
272
|
+
return [] if lang.blank? || code.blank? || !mappings.has_key?(lang.to_sym) || !mappings[lang.to_sym].has_key?(code.to_sym)
|
273
|
+
mappings[lang.to_sym][code.to_sym]
|
274
|
+
end
|
275
|
+
|
276
|
+
def self.mappings_for_language(lang)
|
277
|
+
return [] if lang.blank? || !mappings.has_key?(lang.to_sym)
|
278
|
+
mappings[lang.to_sym].map.sort {|a,b| a.first.to_s <=> b.first.to_s }
|
279
|
+
end
|
280
|
+
|
281
|
+
def self.mappings
|
282
|
+
MAPPINGS
|
283
|
+
end
|
284
|
+
|
285
|
+
def self.forces_multi_query?
|
286
|
+
true
|
287
|
+
end
|
288
|
+
|
289
|
+
def self.single_query(params = {})
|
290
|
+
query_str = build_query_string(params)
|
291
|
+
|
292
|
+
by_query_value(query_str).
|
293
|
+
includes(:label).merge(Label::UMT::Base.by_language(params[:languages].to_a).published.order("LOWER(#{Label::Base.table_name}.value)"))
|
294
|
+
end
|
295
|
+
|
296
|
+
# def self.single_query(params = {})
|
297
|
+
# query_str = build_query_string(params)
|
298
|
+
#
|
299
|
+
# Label::UMT::Base.select("DISTINCT #{Label::UMT::Base.table_name}.*").
|
300
|
+
# joins(:inflectionals).
|
301
|
+
# where(Inflectional::Base.by_query_value(query_str)).
|
302
|
+
# by_language(params[:languages].to_a).
|
303
|
+
# published.
|
304
|
+
# order("LOWER(#{Inflectional::Base.table_name}.value)")
|
305
|
+
# end
|
306
|
+
|
307
|
+
def self.search_result_partial_name
|
308
|
+
'partials/inflectional/search_result'
|
309
|
+
end
|
310
|
+
|
311
|
+
def self.referenced_by(label_class)
|
312
|
+
# To something with the label class
|
313
|
+
label_class.send(:include, Inflectional::LabelExtension)
|
314
|
+
end
|
315
|
+
|
316
|
+
def self.deep_cloning_relations
|
317
|
+
self.name.to_relation_name
|
318
|
+
end
|
319
|
+
|
320
|
+
def self.view_section(obj)
|
321
|
+
"inflectionals"
|
322
|
+
end
|
323
|
+
|
324
|
+
def self.view_section_sort_key(obj)
|
325
|
+
200
|
326
|
+
end
|
327
|
+
|
328
|
+
def self.partial_name(obj)
|
329
|
+
"partials/inflectional/base"
|
330
|
+
end
|
331
|
+
|
332
|
+
def self.edit_partial_name(obj)
|
333
|
+
"partials/inflectional/edit_base"
|
334
|
+
end
|
335
|
+
|
336
|
+
def build_rdf(document, subject)
|
337
|
+
subject.Umt.inflectional(value, :lang => label.language)
|
338
|
+
end
|
339
|
+
|
340
|
+
def self.normalize(str)
|
341
|
+
str = str.to_s.mb_chars.downcase
|
342
|
+
Digest::MD5.hexdigest(str)
|
343
|
+
end
|
344
|
+
|
345
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Inflectional::LabelExtension
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
attr_reader :inflectionals_attributes
|
10
|
+
after_save :overwrite_inflectionals!
|
11
|
+
end
|
12
|
+
|
13
|
+
def endings
|
14
|
+
Inflectional::Base.for_language_and_code(language, inflectional_code)
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate_inflectionals!
|
18
|
+
return send(Inflectional::Base.name.to_relation_name) if base_form.blank?
|
19
|
+
|
20
|
+
converted_literal_form = OriginMapping.replace_umlauts(value)
|
21
|
+
|
22
|
+
diff = OriginMapping.sanitize_for_base_form(converted_literal_form).size - base_form.size
|
23
|
+
|
24
|
+
unless base_form.blank?
|
25
|
+
new_base_form = converted_literal_form[0..(base_form.length-1)]
|
26
|
+
end
|
27
|
+
|
28
|
+
Rails.logger.debug "converted_literal_form => #{converted_literal_form} (#{converted_literal_form.size}) |
|
29
|
+
base_form => #{base_form} (#{base_form.size}) |
|
30
|
+
new_base_form => #{new_base_form} |
|
31
|
+
value => #{value} (#{value.size}) |
|
32
|
+
diff => #{diff}"
|
33
|
+
|
34
|
+
endings.each do |ending|
|
35
|
+
value = ending == "." ? new_base_form : (new_base_form + ending.downcase)
|
36
|
+
send(Inflectional::Base.name.to_relation_name).create!(:value => value)
|
37
|
+
end
|
38
|
+
|
39
|
+
self.base_form = new_base_form
|
40
|
+
save(:validate => false)
|
41
|
+
|
42
|
+
send(Inflectional::Base.name.to_relation_name)
|
43
|
+
end
|
44
|
+
|
45
|
+
def inflectionals_attributes=(str)
|
46
|
+
@inflectionals_attributes = str.split("\r\n")
|
47
|
+
end
|
48
|
+
|
49
|
+
def overwrite_inflectionals!
|
50
|
+
return unless inflectionals_attributes
|
51
|
+
transaction do
|
52
|
+
send(Inflectional::Base.name.to_relation_name).delete_all
|
53
|
+
inflectionals_attributes.each do |value|
|
54
|
+
send(Inflectional::Base.name.to_relation_name).create!(:value => value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h4><%= t("txt.views.labels.inflectionals") %></h4>
|
2
|
+
<% labels_inflectionals_values = label.send(klass.name.to_relation_name).map(&:value) %>
|
3
|
+
<div class="relation">
|
4
|
+
<%= labels_inflectionals_values.join(', ') %>
|
5
|
+
<%
|
6
|
+
all_inflectionals = Inflectional::Base.where(:value => labels_inflectionals_values).all
|
7
|
+
# subtract initial and current version from the inflectionals collection
|
8
|
+
inflectionals_labels = Iqvoc::XLLabel.base_class.find(all_inflectionals.map(&:label_id)-[label.published_version_id, label.id].compact)
|
9
|
+
%>
|
10
|
+
<% if inflectionals_labels.present? %>
|
11
|
+
<p><%= t("txt.views.labels.inflectionals_used_in") %></p>
|
12
|
+
<ul>
|
13
|
+
<% inflectionals_labels.each do |inf| %>
|
14
|
+
<% if inf.published? %>
|
15
|
+
<li><%= link_to inf.value, label_path(:id => inf) %></li>
|
16
|
+
<% else %>
|
17
|
+
<li><%= link_to inf.value, versioned_label_path(:id => inf) %></li>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
</ul>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<dt>
|
2
|
+
<%= t("txt.views.search_results.search_term_in_results") %>: <%= result[:query] %><br>
|
3
|
+
Ergebnisse:<br>
|
4
|
+
<span style="font-weight: normal">
|
5
|
+
<% if result[:result].blank? %>
|
6
|
+
<%= t("txt.views.search_results.no_results") %>
|
7
|
+
<% else %>
|
8
|
+
<% result[:result].group_by{|i| i.label}.each do |key, value| %>
|
9
|
+
<%= link_to(key.value, label_path(:id => key)) %> (<%= value.map(&:value).join(", ") %>)<br>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
</span>
|
13
|
+
</dt>
|