konjac 0.1.8.1 → 0.1.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,142 @@
1
+ = konjac
2
+
3
+ A Ruby command-line utility for translating files using a YAML wordlist
4
+
5
+ Homepage:: http://www.brymck.com
6
+ Author:: Bryan McKelvey
7
+ Copyright:: (c) 2012 Bryan McKelvey
8
+ License:: MIT
9
+
10
+ == Installation
11
+
12
+ === Stable
13
+
14
+ With {Ruby}[http://www.ruby-lang.org/en/downloads/] installed, run the
15
+ following in your terminal:
16
+
17
+ gem install konjac
18
+
19
+ === Development
20
+
21
+ With Ruby and {Git}[http://help.github.com/set-up-git-redirect] installed,
22
+ navigate in your command line to a directory of your choice, then run:
23
+
24
+ git clone git://github.com/brymck/konjac.git
25
+ cd konjac
26
+ rake install
27
+
28
+ == Usage
29
+
30
+ Translate all text files in the current directory from Japanese into English:
31
+
32
+ konjac translate *.txt --from japanese --to english
33
+ konjac translate *.txt -f ja -t en
34
+
35
+ Use multiple dictionaries:
36
+
37
+ konjac translate financial_report_en.txt --to japanese --using {finance,fluffery}
38
+ konjac translate financial_report_en.txt -t ja -u {finance,fluffery}
39
+
40
+ Extract text from a .docx document (creates a plain-text <tt>test.konjac</tt> file from
41
+ <tt>test.docx</tt>):
42
+
43
+ konjac export test
44
+
45
+ Extract text from a .docx document and process with a dictionary
46
+
47
+ konjac export test.docx --from japanese --to english --using pre
48
+ konjac export test.docx -f ja -t en -u pre
49
+
50
+ Import tags file back into .docx document (file created is named
51
+ <tt>test_imported.docx</tt>):
52
+
53
+ konjac import test
54
+
55
+ Add a word to your dictionary:
56
+
57
+ konjac add --original dog --from english --translation 犬 --to japanese
58
+ konjac add -o dog -f en -r 犬 -t ja
59
+
60
+ Translate a word using your dictionary:
61
+
62
+ konjac translate dog --from english --to japanese --word
63
+ konjac translate dog -f en -t ja -w
64
+
65
+ == Dictionary Format
66
+
67
+ Store terms in <tt>~/.konjac/dict.yml</tt>.
68
+
69
+ <em>Simple (two-way equivalent terms)</em> - English "I" is equivalent to Spanish
70
+ "yo":
71
+
72
+ -
73
+ en: I
74
+ es: yo
75
+
76
+ <em>Not as simple</em> - Japanese lacks a plural, therefore both "dog" and "dogs"
77
+ translate as 犬:
78
+
79
+ -
80
+ en: dog
81
+ ja:
82
+ ja: 犬
83
+ en: dogs? # i.e. the regular expression /dogs?/
84
+
85
+ == Extended Example
86
+
87
+ ~/.konjac/dict.yml:
88
+
89
+ -
90
+ en: I
91
+ ja: 僕
92
+ -
93
+ en: like
94
+ ja: 好き
95
+ -
96
+ en:
97
+ en: dog
98
+ ja: 犬
99
+ ja:
100
+ ja: 犬
101
+ en: dogs?
102
+ - # Periods
103
+ en:
104
+ en: ". "
105
+ ja: 。
106
+ ja:
107
+ ja: 。
108
+ en: !ruby/regexp '/\.(?:\s|$)/'
109
+ - # Spaces between non-ASCII characters
110
+ en:
111
+ en: " "
112
+ ja: !ruby/regexp /\s{2,}/
113
+ ja:
114
+ ja: "\\1\\2"
115
+ en: !ruby/regexp /([^\w])\s([^\w])/
116
+ - # Delete extraneous spaces
117
+ en:
118
+ en: ""
119
+ ja: !ruby/regexp /\s(?=[.,:]|$)/
120
+
121
+ ~/.konjac/test_en.txt:
122
+
123
+ I like dogs.
124
+
125
+ Run
126
+
127
+ konjac translate ~/.konjac/test_en.txt into japanese
128
+
129
+ ~/.konjac/test_ja.txt (result):
130
+
131
+ 僕好き犬。
132
+
133
+ Now, obviously that does require some fiddling to make it more grammatical, but
134
+ it's a start (=> <tt>僕は犬が好きだ。</tt>)
135
+
136
+ == Name
137
+
138
+ <em>Hon'yaku</em> means "translation" in Japanese. This utility relies on a
139
+ YAML wordlist. <em>Konnyaku</em> (Japanese for "konjac") rhymes with
140
+ <em>hon'yaku</em> and is a type of yam. Also, Doraemon had something called a
141
+ <em>hon'yaku konnyaku</em> that allowed one to listen to animals. But I
142
+ digress.
data/konjac.gemspec CHANGED
@@ -13,10 +13,11 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rubyforge_project = "konjac"
15
15
 
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
16
+ s.extra_rdoc_files = ["README.rdoc"]
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
20
21
 
21
22
  s.add_runtime_dependency "i18n"
22
23
  s.add_runtime_dependency "nokogiri"
data/lib/konjac/config.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "i18n"
1
2
  require "yaml"
2
3
 
3
4
  module Konjac
@@ -1,3 +1,3 @@
1
1
  module Konjac
2
- VERSION = "0.1.8.1"
2
+ VERSION = "0.1.8.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konjac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.1
4
+ version: 0.1.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &70338893761940 !ruby/object:Gem::Requirement
16
+ requirement: &70268052029780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70338893761940
24
+ version_requirements: *70268052029780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70338893777860 !ruby/object:Gem::Requirement
27
+ requirement: &70268052029360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70338893777860
35
+ version_requirements: *70268052029360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: term-ansicolor
38
- requirement: &70338893777340 !ruby/object:Gem::Requirement
38
+ requirement: &70268052028920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70338893777340
46
+ version_requirements: *70268052028920
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: trollop
49
- requirement: &70338893776780 !ruby/object:Gem::Requirement
49
+ requirement: &70268052028480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70338893776780
57
+ version_requirements: *70268052028480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: autotest
60
- requirement: &70338893776060 !ruby/object:Gem::Requirement
60
+ requirement: &70268052028040 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70338893776060
68
+ version_requirements: *70268052028040
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: autotest-fsevent
71
- requirement: &70338893775240 !ruby/object:Gem::Requirement
71
+ requirement: &70268052027580 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70338893775240
79
+ version_requirements: *70268052027580
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: autotest-growl
82
- requirement: &70338893774820 !ruby/object:Gem::Requirement
82
+ requirement: &70268052027160 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70338893774820
90
+ version_requirements: *70268052027160
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: bundler
93
- requirement: &70338893774360 !ruby/object:Gem::Requirement
93
+ requirement: &70268052026720 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70338893774360
101
+ version_requirements: *70268052026720
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &70338893773740 !ruby/object:Gem::Requirement
104
+ requirement: &70268052026300 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70338893773740
112
+ version_requirements: *70268052026300
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: sdoc
115
- requirement: &70338893773060 !ruby/object:Gem::Requirement
115
+ requirement: &70268052025880 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,21 +120,22 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70338893773060
123
+ version_requirements: *70268052025880
124
124
  description: A Ruby command-line utility for translating files using a YAML wordlist
125
125
  email:
126
126
  - bryan.mckelvey@gmail.com
127
127
  executables:
128
128
  - konjac
129
129
  extensions: []
130
- extra_rdoc_files: []
130
+ extra_rdoc_files:
131
+ - README.rdoc
131
132
  files:
132
133
  - .autotest
133
134
  - .gitignore
134
135
  - .rspec
135
136
  - Gemfile
136
137
  - LICENSE
137
- - README.md
138
+ - README.rdoc
138
139
  - Rakefile
139
140
  - bin/konjac
140
141
  - konjac.gemspec
data/README.md DELETED
@@ -1,134 +0,0 @@
1
- konjac
2
- ======
3
-
4
- A Ruby command-line utility for translating files using a YAML wordlist
5
-
6
- **Homepage**: http://brymck.herokuapp.com
7
- **Author**: Bryan McKelvey
8
- **Copyright**: (c) 2012 Bryan McKelvey
9
- **License**: MIT
10
-
11
- Installation
12
- ------------
13
-
14
- ### Stable
15
-
16
- With [Ruby](http://www.ruby-lang.org/en/downloads/) installed, run the
17
- following in your terminal:
18
-
19
- gem install konjac
20
-
21
- ### Development
22
-
23
- With Ruby and [Git](http://help.github.com/set-up-git-redirect) installed,
24
- navigate in your command line to a directory of your choice, then run:
25
-
26
- git clone git://github.com/brymck/konjac.git
27
- cd konjac
28
- rake install
29
-
30
- Dictionary Format
31
- -----------------
32
-
33
- Store terms in `~/.konjac/dict.yml`.
34
-
35
- **Simple (two-way equivalent terms)** - English "I" is equivalent to Spanish
36
- "yo":
37
-
38
- -
39
- en: I
40
- es: yo
41
-
42
- **Not as simple** - Japanese lacks a plural, therefore both "dog" and "dogs"
43
- translate as 犬:
44
-
45
- -
46
- en: dog
47
- ja:
48
- ja: 犬
49
- en: dogs? # i.e. the regular expression /dogs?/
50
-
51
- Usage
52
- -----
53
-
54
- Translate all text files in the current directory from Japanese into English:
55
-
56
- konjac translate *.txt --from japanese --to english
57
-
58
- Utilize a document's implied language (English) and translate into Japanese:
59
-
60
- konjac translate test_en.txt --to japanese
61
-
62
- Use multiple dictionaries:
63
-
64
- konjac translate financial_report_en.txt --to japanese --using finance
65
-
66
- Extract text from a DOCX document (creates a plain-text `test.konjac` file from
67
- `test.docx`):
68
-
69
- konjac export test
70
-
71
- Import tags file back into DOCX document (file created is named
72
- `test_imported.docx`):
73
-
74
- konjac import test
75
-
76
- Extended Example
77
- ----------------
78
-
79
- ~/.konjac/dict.yml:
80
-
81
- -
82
- en: I
83
- ja: 僕
84
- -
85
- en: like
86
- ja: 好き
87
- -
88
- en:
89
- en: dog
90
- ja: 犬
91
- ja:
92
- ja: 犬
93
- en: dogs?
94
- - # Periods
95
- en:
96
- en: ". "
97
- ja: 。
98
- ja:
99
- ja: 。
100
- en: !ruby/regexp '/\.(?:\s|$)/'
101
- - # Spaces between non-ASCII characters
102
- en:
103
- en: " "
104
- ja: !ruby/regexp /\s{2,}/
105
- ja:
106
- ja: "\\1\\2"
107
- en: !ruby/regexp /([^\w])\s([^\w])/
108
- - # Delete extraneous spaces
109
- en:
110
- en: ""
111
- ja: !ruby/regexp /\s(?=[.,:]|$)/
112
-
113
- ~/.konjac/test_en.txt:
114
-
115
- I like dogs.
116
-
117
- Run
118
-
119
- konjac translate ~/.konjac/test_en.txt into japanese
120
-
121
- ~/.konjac/test_ja.txt (result):
122
-
123
- 僕好き犬。
124
-
125
- Now, obviously that does require some fiddling to make it more grammatical, but
126
- it's a start (=> `僕は犬が好きだ。`)
127
-
128
- Name
129
- ----
130
-
131
- *Hon'yaku* means "translation" in Japanese. This utility relies on a YAML
132
- wordlist. *Konnyaku* (Japanese for "konjac") rhymes with *hon'yaku* and is a
133
- type of yam. Also, Doraemon had something called a *hon'yaku konnyaku* that
134
- allowed one to listen to animals. But I digress.