tx_translate 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b256908a6fc0be8a6d077e516ac3e707fd50a11fedd9e10cc4603bf480098900
4
- data.tar.gz: cd8d09bff3b0f634b6fbe626f4d8ac8123b1f0ace6c5d3c4840d9196d94eea19
3
+ metadata.gz: 5ee77e13ad71da4e635abdd2049c950d7307ddb84e9f086d931013c8bc235660
4
+ data.tar.gz: 63be45f2f4dd79a26504c6b31acc01e153f75b572a4d51bbdcad54dc5a7fb8d1
5
5
  SHA512:
6
- metadata.gz: c19da536e5629f5207366af07cd6d87cb10786c174f4bea1b26431a5fdd23a80530a4574c42e816f6f598d5155db40adc1f9a28f3aaad1f677d5c67c54f355d9
7
- data.tar.gz: 38025d4ad3bbb5fdfa15abc237d1794f3ff7bf52175c3f20265f0ba1f80b90ba15bec7b7222193eb9432e5d87db94af3dd6d5a1139b1ae9ac023a8a48fa9e518
6
+ metadata.gz: b304a8da2a54c3af78f5f9802192d422a018ed348d1c352769be20df55045b1582e5904ed242e47d0d053f6dd6c3c82cffa2c95d3cdb79f05360408098b3288b
7
+ data.tar.gz: '09d5ed2f501e62fd06c1659b7e8bd0eb8b51c188815ab0966e4000874128f39dc443db57f8079e056828a7e94221dc28d261020316701a9cc969db5e37f3f0ec'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tx_translate (0.0.2)
4
+ tx_translate (0.0.3)
5
5
  activesupport
6
6
  httparty
7
7
  json
data/README.md CHANGED
@@ -30,7 +30,7 @@ gem 'tx_translate'
30
30
 
31
31
  * tx_translate word "This is a book" # 翻译一句话
32
32
  * tx_translate sbv FILENAME # 翻译字幕
33
- * tx_translate srt FILENAME # 翻译中英对照文档
33
+ * tx_translate srt FILENAME # 翻译字幕
34
34
  * tx_translate md FILENAME # 翻译中英对照文档
35
35
 
36
36
 
@@ -6,6 +6,7 @@ module TxTranslate
6
6
  file = File.open(filename, 'r')
7
7
  basename = File.basename(filename, "sbv")
8
8
  contents = file.read + "\n\n"
9
+ contents.gsub!("\r\n", "\n") # 处理 CRLF 转 LF 问题
9
10
 
10
11
  subbed = ''
11
12
 
@@ -5,7 +5,11 @@ module TxTranslate
5
5
  def self.run(filename)
6
6
  file = File.open(filename, 'r')
7
7
  basename = File.basename(filename, "srt")
8
+
8
9
  contents = file.read + "\n\n"
10
+ contents.gsub!("\r\n", "\n") # 处理 CRLF 转 LF 问题
11
+
12
+ puts contents
9
13
 
10
14
  subbed = ''
11
15
 
@@ -21,6 +25,8 @@ module TxTranslate
21
25
  context_content_array[i] = Regexp.last_match(3).to_s
22
26
  end
23
27
 
28
+ puts original_content_array.size
29
+
24
30
  context_content_array = TxTranslate::ParallelArray.new(context_content_array).parallel_process
25
31
 
26
32
  original_content_array.each_with_index do |_item, i|
@@ -1,3 +1,3 @@
1
1
  module TxTranslate
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tx_translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - xdite