sanzang 1.0.7 → 1.0.8

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 02df4608ca9a12c096a4ab7dc91c972c70652977
4
+ data.tar.gz: eb9f6ea45c05aa404d41af5586f9de52bf463b12
5
+ SHA512:
6
+ metadata.gz: f09ffb33b6a25ea423e53d9f675b857554edc1f819a29a2b6487f050a5035f6fa2a33acbb01fbbc1def817fe267cf9133d31340ae9af0e796e9d7793cdf151ba
7
+ data.tar.gz: d4502378f5c920209a791dd0fbe93218acf3244f61b13ba072dff1e81aefa7a64ea40be6d97719e326a541b5d807473fb5472f3c5a6890a3f9b1ddaa578db07a
data/README.rdoc CHANGED
@@ -10,7 +10,7 @@ Buddhist canon, the program is called \Sanzang (三藏), a literal translation o
10
10
  the Sanskrit word "Tripitaka," which is a general term for the Buddhist canon.
11
11
  As demonstrated by the _sanzang_ program itself:
12
12
 
13
- $ echo '三藏' | sanzang t sztab
13
+ $ echo 三藏 | sanzang t sztab
14
14
  [1.1] 三藏
15
15
  [1.2] sānzàng
16
16
  [1.3] tripiṭaka
@@ -36,10 +36,10 @@ automatically download and install \Sanzang onto your computer.
36
36
  After this, you should be able to run the _sanzang_ command. Run the following
37
37
  command to verify your installation and print version information.
38
38
 
39
- # sanzang -V
39
+ # sanzang --version
40
40
 
41
41
  This command should show a summary of your \Sanzang version and environment.
42
42
 
43
- sanzang 1.0.4 [ruby_1.9.3] [x86_64-linux] [UTF-8]
43
+ sanzang 1.0.8 (UTF-8) ruby-2.1.0p0 x86_64-linux
44
44
 
45
45
  You now have \Sanzang installed on your computer.
@@ -67,6 +67,9 @@ module Sanzang::Command
67
67
  return 0
68
68
  rescue SystemExit => err
69
69
  return err.status
70
+ rescue Interrupt
71
+ puts
72
+ return 0
70
73
  rescue Errno::EPIPE
71
74
  return 0
72
75
  rescue Exception => err
@@ -74,6 +74,9 @@ module Sanzang::Command
74
74
  return 0
75
75
  rescue SystemExit => err
76
76
  return err.status
77
+ rescue Interrupt
78
+ puts
79
+ return 0
77
80
  rescue Errno::EPIPE
78
81
  return 0
79
82
  rescue Exception => err
@@ -67,7 +67,10 @@ module Sanzang::Command
67
67
  return 1
68
68
  rescue SystemExit => err
69
69
  return err.status
70
- rescue Errno::EPIPE
70
+ rescue Interrupt
71
+ puts
72
+ return 0
73
+ rescue Errno::EPIPE
71
74
  return 0
72
75
  rescue Exception => err
73
76
  $stderr.puts "#{@name}: #{err.inspect}"
@@ -84,7 +87,7 @@ module Sanzang::Command
84
87
  info << "ruby_encoding_int = #{Encoding.default_internal or 'none'}\n"
85
88
  info << "ruby_multiproc = #{Sanzang::Platform.unix_processes?}\n"
86
89
  info << "ruby_platform = #{RUBY_PLATFORM}\n"
87
- info << "ruby_version = #{RUBY_VERSION}\n"
90
+ info << "ruby_version = #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}\n"
88
91
  info << "sanzang_encoding = #{Sanzang::Platform.data_encoding}\n"
89
92
  info << "sanzang_parallel = #{Parallel::VERSION}\n"
90
93
  info << "sanzang_version = #{Sanzang::VERSION}\n"
@@ -93,8 +96,8 @@ module Sanzang::Command
93
96
  # This is a string giving a brief one-line summary of version information
94
97
  #
95
98
  def version_info
96
- "sanzang #{Sanzang::VERSION} [ruby_#{RUBY_VERSION}] [#{RUBY_PLATFORM}]" \
97
- + " [#{Sanzang::Platform.data_encoding}]"
99
+ "sanzang #{Sanzang::VERSION} (#{Sanzang::Platform.data_encoding})" \
100
+ + " ruby-#{RUBY_VERSION}p#{RUBY_PATCHLEVEL} #{RUBY_PLATFORM}"
98
101
  end
99
102
 
100
103
  # Name of the command
@@ -78,6 +78,9 @@ module Sanzang::Command
78
78
  return 0
79
79
  rescue SystemExit => err
80
80
  return err.status
81
+ rescue Interrupt
82
+ puts
83
+ return 0
81
84
  rescue Errno::EPIPE
82
85
  return 0
83
86
  rescue Exception => err
@@ -104,8 +104,11 @@ module Sanzang::Platform
104
104
  Encoding.list.find_all do |e|
105
105
  begin
106
106
  Encoding::Converter.search_convpath(e, Encoding::UTF_8)
107
+ true
107
108
  rescue Encoding::ConverterNotFoundError
108
109
  e == Encoding::UTF_8 ? true : false
110
+ rescue TypeError
111
+ false
109
112
  end
110
113
  end.sort_by! {|e| e.to_s.upcase }
111
114
  end
@@ -116,7 +119,13 @@ module Sanzang::Platform
116
119
  # UTF-8 since these are effectively obsolete, or they are subsets of UTF-8.
117
120
  #
118
121
  def data_encoding
119
- if Encoding.default_external.to_s =~ /ASCII|IBM/
122
+ if ENV["SANZANG_ENCODING"] and ENV["SANZANG_ENCODING"].strip != ""
123
+ encoding = Encoding.find(ENV["SANZANG_ENCODING"])
124
+ if encoding != Encoding::UTF_8
125
+ Encoding::Converter.search_convpath(encoding, Encoding::UTF_8)
126
+ end
127
+ encoding
128
+ elsif Encoding.default_external.to_s =~ /ASCII|IBM/
120
129
  Encoding::UTF_8
121
130
  else
122
131
  Encoding.default_external
@@ -19,6 +19,6 @@ module Sanzang
19
19
 
20
20
  # Current version number of Sanzang
21
21
  #
22
- VERSION = "1.0.7"
22
+ VERSION = "1.0.8"
23
23
 
24
24
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanzang
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
5
- prerelease:
4
+ version: 1.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Lapis Lazuli Texts
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-17 00:00:00.000000000 Z
11
+ date: 2013-12-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: parallel
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0.8'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0.8'
30
27
  description: Sanzang is a program built for machine translation of natural languages.
@@ -43,58 +40,57 @@ extra_rdoc_files:
43
40
  - MANUAL.rdoc
44
41
  - README.rdoc
45
42
  files:
43
+ - HACKING.rdoc
44
+ - LICENSE.rdoc
45
+ - MANUAL.rdoc
46
+ - README.rdoc
46
47
  - bin/sanzang
47
- - test/utf-8/batch/README
48
- - test/utf-8/stage_3.txt
49
- - test/utf-8/file_4.txt
50
- - test/utf-8/file_3.txt
51
- - test/utf-8/file_1.txt
52
- - test/utf-8/stage_1.txt
53
- - test/utf-8/table.txt
54
- - test/utf-8/file_2.txt
55
- - test/utf-8/stage_2.txt
56
- - test/tc_reflow_encodings.rb
57
- - test/tc_simple_translation.rb
58
48
  - lib/sanzang.rb
59
- - lib/sanzang/text_formatter.rb
60
- - lib/sanzang/translation_table.rb
61
49
  - lib/sanzang/batch_translator.rb
62
- - lib/sanzang/version.rb
63
- - lib/sanzang/platform.rb
50
+ - lib/sanzang/command/batch.rb
64
51
  - lib/sanzang/command/reflow.rb
65
52
  - lib/sanzang/command/sanzang_cmd.rb
66
53
  - lib/sanzang/command/translate.rb
67
- - lib/sanzang/command/batch.rb
54
+ - lib/sanzang/platform.rb
55
+ - lib/sanzang/text_formatter.rb
56
+ - lib/sanzang/translation_table.rb
68
57
  - lib/sanzang/translator.rb
69
- - HACKING.rdoc
70
- - LICENSE.rdoc
71
- - MANUAL.rdoc
72
- - README.rdoc
58
+ - lib/sanzang/version.rb
59
+ - test/tc_reflow_encodings.rb
60
+ - test/tc_simple_translation.rb
61
+ - test/utf-8/batch/README
62
+ - test/utf-8/file_1.txt
63
+ - test/utf-8/file_2.txt
64
+ - test/utf-8/file_3.txt
65
+ - test/utf-8/file_4.txt
66
+ - test/utf-8/stage_1.txt
67
+ - test/utf-8/stage_2.txt
68
+ - test/utf-8/stage_3.txt
69
+ - test/utf-8/table.txt
73
70
  homepage: http://www.lapislazulitexts.com/sanzang/
74
71
  licenses:
75
72
  - GPL-3
73
+ metadata: {}
76
74
  post_install_message:
77
75
  rdoc_options: []
78
76
  require_paths:
79
77
  - lib
80
78
  required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
79
  requirements:
83
- - - ! '>='
80
+ - - ">="
84
81
  - !ruby/object:Gem::Version
85
82
  version: 1.9.0
86
83
  required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
84
  requirements:
89
- - - ! '>='
85
+ - - ">="
90
86
  - !ruby/object:Gem::Version
91
87
  version: '0'
92
88
  requirements:
93
89
  - parallel ~> 0.8
94
90
  rubyforge_project:
95
- rubygems_version: 1.8.23
91
+ rubygems_version: 2.2.0
96
92
  signing_key:
97
- specification_version: 3
93
+ specification_version: 4
98
94
  summary: Machine translation for CJK languages
99
95
  test_files:
100
96
  - test/tc_reflow_encodings.rb