txt_tm_importer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +71 -0
- data/Rakefile +5 -0
- data/lib/txt_tm_importer.rb +190 -0
- data/lib/txt_tm_importer/version.rb +3 -0
- data/spec/sample_files/rtf_1.txt +107 -0
- data/spec/sample_files/wordfast_1(utf-8).txt +408 -0
- data/spec/sample_files/wordfast_1.txt +0 -0
- data/spec/sample_files/wordfast_2.txt +0 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/txt_tm_importer_spec.rb +155 -0
- data/txt_tm_importer.gemspec +26 -0
- metadata +135 -0
Binary file
|
Binary file
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TxtTmImporter do
|
4
|
+
it 'has a version number' do
|
5
|
+
expect(TxtTmImporter::VERSION).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#stats' do
|
9
|
+
it 'reports the stats of a wordfast txt file 1' do
|
10
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1.txt')
|
11
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).stats
|
12
|
+
expect(txt).to eq({:tu_count=>407, :seg_count=>814, :language_pairs=>[['PT-BR', 'EN-US']]})
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'reports the stats of a wordfast txt file 2' do
|
16
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_2.txt')
|
17
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).stats
|
18
|
+
expect(txt).to eq({:tu_count=>1859, :seg_count=>3718, :language_pairs=>[["EN", "ES"]]})
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'reports the stats of a wordfast txt file 3' do
|
22
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1(utf-8).txt')
|
23
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).stats
|
24
|
+
expect(txt).to eq({:tu_count=>407, :seg_count=>814, :language_pairs=>[['PT-BR', 'EN-US']]})
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'reports the stats of a wordfast txt file 4' do
|
28
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/rtf_1.txt')
|
29
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).stats
|
30
|
+
expect(txt).to eq({:tu_count=>2, :seg_count=>4, :language_pairs=>[['ES-EM', 'EN-US']]})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#import' do
|
35
|
+
it 'imports a txt file 1' do
|
36
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1.txt')
|
37
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
38
|
+
expect(txt[0][-1][0]).to eq(txt[1][-1][0])
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'imports a txt file 2' do
|
42
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1.txt')
|
43
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
44
|
+
expect(txt[0].length).to eq(407)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'imports a txt file 3' do
|
48
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1.txt')
|
49
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
50
|
+
expect(txt[1].length).to eq(814)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'imports a txt file 4' do
|
54
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1.txt')
|
55
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
56
|
+
expect(txt[1][5][3]).to eq("EN-US")
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'imports a txt file 5' do
|
60
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1.txt')
|
61
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
62
|
+
expect(txt[1][6][3]).to eq("PT-BR")
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'imports a txt file 6' do
|
66
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1(utf-8).txt')
|
67
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
68
|
+
expect(txt[0][-1][0]).to eq(txt[1][-1][0])
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'imports a txt file 7' do
|
72
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1(utf-8).txt')
|
73
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
74
|
+
expect(txt[0].length).to eq(407)
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'imports a txt file 8' do
|
78
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1(utf-8).txt')
|
79
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
80
|
+
expect(txt[1].length).to eq(814)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'imports a txt file 9' do
|
84
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1(utf-8).txt')
|
85
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
86
|
+
expect(txt[1][5][3]).to eq("EN-US")
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'imports a txt file 10' do
|
90
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_1(utf-8).txt')
|
91
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
92
|
+
expect(txt[1][6][3]).to eq("PT-BR")
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'imports a txt file 11' do
|
96
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_2.txt')
|
97
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
98
|
+
expect(txt[0][-1][0]).to eq(txt[1][-1][0])
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'imports a txt file 12' do
|
102
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_2.txt')
|
103
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
104
|
+
expect(txt[0].length).to eq(1859)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'imports a txt file 13' do
|
108
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_2.txt')
|
109
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
110
|
+
expect(txt[1].length).to eq(3718)
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'imports a txt file 14' do
|
114
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_2.txt')
|
115
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
116
|
+
expect(txt[1][5][3]).to eq("ES")
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'imports a txt file 15' do
|
120
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/wordfast_2.txt')
|
121
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
122
|
+
expect(txt[1][6][3]).to eq("EN")
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'imports a txt file 16' do
|
126
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/rtf_1.txt')
|
127
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
128
|
+
expect(txt[0][-1][0]).to eq(txt[1][-1][0])
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'imports a txt file 17' do
|
132
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/rtf_1.txt')
|
133
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
134
|
+
expect(txt[0].length).to eq(2)
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'imports a txt file 18' do
|
138
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/rtf_1.txt')
|
139
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
140
|
+
expect(txt[1].length).to eq(4)
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'imports a txt file 19' do
|
144
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/rtf_1.txt')
|
145
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
146
|
+
expect(txt[1][3][3]).to eq("EN-US")
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'imports a txt file 20' do
|
150
|
+
file_path = File.expand_path('../txt_tm_importer/spec/sample_files/rtf_1.txt')
|
151
|
+
txt = TxtTmImporter::Tm.new(file_path: file_path).import
|
152
|
+
expect(txt[1][2][4]).to eq("La renovación de procesos con nuevos equipamientos beneficiará directamente a clientes y pacientes que utilizan medicamentos y alimentación parenteral suministrados por el grupo")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'txt_tm_importer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "txt_tm_importer"
|
8
|
+
spec.version = TxtTmImporter::VERSION
|
9
|
+
spec.authors = ["Kevin S. Dias"]
|
10
|
+
spec.email = ["diasks2@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{.txt translation memory file importer}
|
13
|
+
spec.description = %q{Import the content of a .txt translation memory file.}
|
14
|
+
spec.homepage = "https://github.com/diasks2/txt_tm_importer"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_runtime_dependency "pretty_strings", "~> 0.5.0"
|
25
|
+
spec.add_runtime_dependency "charlock_holmes_bundle_icu", "~> 0.6.9.2"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: txt_tm_importer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin S. Dias
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pretty_strings
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: charlock_holmes_bundle_icu
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.6.9.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.6.9.2
|
83
|
+
description: Import the content of a .txt translation memory file.
|
84
|
+
email:
|
85
|
+
- diasks2@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- lib/txt_tm_importer.rb
|
98
|
+
- lib/txt_tm_importer/version.rb
|
99
|
+
- spec/sample_files/rtf_1.txt
|
100
|
+
- spec/sample_files/wordfast_1(utf-8).txt
|
101
|
+
- spec/sample_files/wordfast_1.txt
|
102
|
+
- spec/sample_files/wordfast_2.txt
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
- spec/txt_tm_importer_spec.rb
|
105
|
+
- txt_tm_importer.gemspec
|
106
|
+
homepage: https://github.com/diasks2/txt_tm_importer
|
107
|
+
licenses: []
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.4.1
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: ".txt translation memory file importer"
|
129
|
+
test_files:
|
130
|
+
- spec/sample_files/rtf_1.txt
|
131
|
+
- spec/sample_files/wordfast_1(utf-8).txt
|
132
|
+
- spec/sample_files/wordfast_1.txt
|
133
|
+
- spec/sample_files/wordfast_2.txt
|
134
|
+
- spec/spec_helper.rb
|
135
|
+
- spec/txt_tm_importer_spec.rb
|