wordnet_japan_diagram 0.1.0 → 0.1.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: 7b079619d512bbb94f622ebceed258c67ee078cada25582767ccbd80ede79c93
4
- data.tar.gz: e4db7ce1b7cce5e04362380171554e7d8e206e8773cf2627fe8fe928de93dec7
3
+ metadata.gz: 832db3f091de521d66ad98b8c4f96dce13faac4f3382ea687655a050aa429f36
4
+ data.tar.gz: 05b0444573db1a97aba7822c5ca42b0d88134d063234820c4f5ed74fdf868f21
5
5
  SHA512:
6
- metadata.gz: 0c896e2f155c1e97884dc1dfee37e41cb9a997ee52326e3e9c43730c5f573df32b4f9bab30f91538904ab5b97cd21ea0ef2881ee9c6681e39e54b5e334b5c408
7
- data.tar.gz: 38f7155b6406dccfa7bcd3eb7a2d0c62231d2d55aa3927a1acd353eadb2d79131c4efe8796cc1f9223107b7e62fd2c507c8a588a61885b0fa1fc7373ae274bb5
6
+ metadata.gz: 740f37b8eb9a737f8df225e29dac04678dfc9041ba05b34caa8a0cf061abc8147d44c0a10c22da0f935a5fe844b9ef153d7d675ca980e9c77a2c7126f8ee6283
7
+ data.tar.gz: e41261374019aba180c148fc03b0df284fee68477394722a4676247fb73edae63e5e3be7fe41d68bf64c83f4adf88c77a965b65acea2ba89c974bc2a20d6a998
@@ -1,5 +1,84 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'choice'
4
+
3
5
  require 'wordnet_japan_diagram'
4
6
 
5
- WordnetJapanDiagram::CLI.execute
7
+ Choice.options do
8
+ header ''
9
+ header 'Specific options:'
10
+
11
+ option :wordnet_japan_db_file_path do
12
+ long '--wordnet_japan_db_file_path=text'
13
+ desc "Sets wordnet japan db file path\n" \
14
+ ' default: ./wnjpn.db'
15
+ default 'wnjpn.db'
16
+ end
17
+
18
+ option :search_word, required: true do
19
+ long '--search_word=text'
20
+ desc '[Required] Sets japanese word to search'
21
+ validate /\p{Hiragana}+|\p{Katakana}+|\p{Han}+/
22
+ end
23
+
24
+ option :graph_rankdir do
25
+ long '--graph_rankdir=[TB|BT|LR|RL]'
26
+ desc "Sets direction of graph layout\n" \
27
+ " default: BT\n" \
28
+ " TB: Top to bottom\n" \
29
+ " BT: Bottom to top\n" \
30
+ " LR: Left to right\n" \
31
+ ' RL: Right to left'
32
+ default 'BT'
33
+ valid %w(TB BT LR RL)
34
+ end
35
+
36
+ option :node_contents do
37
+ long '--node_contents=[synset|synset_and_words]'
38
+ desc "Sets node contents\n" \
39
+ ' default: synset_and_words'
40
+ default 'synset_and_words'
41
+ valid %w(synset synset_and_words)
42
+ end
43
+
44
+ option :height_from_target do
45
+ long '--height_from_target=number'
46
+ desc 'Sets height from target node'
47
+ validate /\d+/
48
+ end
49
+
50
+ option :depth_from_target do
51
+ long '--depth_from_target=number'
52
+ desc 'Sets depth from target node'
53
+ validate /\d+/
54
+ end
55
+
56
+ option :output_diagram_path do
57
+ long '--output_diagram_path=text'
58
+ desc "Sets output diagram path (The file extension is either .pdf, .png, .jpg, or .svg)\n" \
59
+ ' default: wordnet_japan_diagram_[%Y%m%d%H%M%S].png'
60
+ default "wordnet_japan_diagram_#{Time.current.strftime('%Y%m%d%H%M%S')}.png"
61
+ validate /[pdf|png|jpg|svg]$/
62
+ end
63
+
64
+ separator ''
65
+ separator 'Common options: '
66
+
67
+ option :help do
68
+ long '--help'
69
+ desc 'Show this options information'
70
+ end
71
+
72
+ option :version do
73
+ short '-v'
74
+ long '--version'
75
+ desc 'Show version and quit.'
76
+ action do
77
+ require 'wordnet_japan_diagram/version'
78
+ puts WordnetJapanDiagram::BANNER
79
+ exit
80
+ end
81
+ end
82
+ end
83
+
84
+ WordnetJapanDiagram::CLI.execute(options: Choice.choices)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'choice'
4
-
5
3
  require_relative 'command_options'
6
4
  require_relative 'diagram_creater'
7
5
 
@@ -12,90 +10,31 @@ require_relative 'wordnet_japan/synset'
12
10
  require_relative 'wordnet_japan/synset_def'
13
11
  require_relative 'wordnet_japan/word'
14
12
 
15
- Choice.options do
16
- header ''
17
- header 'Specific options:'
18
-
19
- option :wordnet_japan_db_file_path do
20
- long '--wordnet_japan_db_file_path=text'
21
- desc "Sets wordnet japan db file path\n" \
22
- ' default: ./wnjpn.db'
23
- default 'wnjpn.db'
24
- end
25
-
26
- option :search_word, required: true do
27
- long '--search_word=text'
28
- desc '[Required] Sets japanese word to search'
29
- validate /\p{Hiragana}+|\p{Katakana}+|\p{Han}+/
30
- end
31
-
32
- option :graph_rankdir do
33
- long '--graph_rankdir=[TB|BT|LR|RL]'
34
- desc "Sets direction of graph layout\n" \
35
- " default: BT\n" \
36
- " TB: Top to bottom\n" \
37
- " BT: Bottom to top\n" \
38
- " LR: Left to right\n" \
39
- ' RL: Right to left'
40
- default 'BT'
41
- valid %w(TB BT LR RL)
42
- end
43
-
44
- option :node_contents do
45
- long '--node_contents=[synset|synset_and_words]'
46
- desc "Sets node contents\n" \
47
- ' default: synset_and_words'
48
- default 'synset_and_words'
49
- valid %w(synset synset_and_words)
50
- end
51
-
52
- option :height_from_target do
53
- long '--height_from_target=number'
54
- desc 'Sets height from target node'
55
- validate /\d+/
56
- end
57
-
58
- option :depth_from_target do
59
- long '--depth_from_target=number'
60
- desc 'Sets depth from target node'
61
- validate /\d+/
62
- end
63
-
64
- option :output_diagram_path do
65
- long '--output_diagram_path=text'
66
- desc "Sets output diagram path (The file extension is either .pdf, .png, .jpg, or .svg)\n" \
67
- ' default: wordnet_japan_diagram_[%Y%m%d%H%M%S].png'
68
- default "wordnet_japan_diagram_#{Time.current.strftime('%Y%m%d%H%M%S')}.png"
69
- validate /[pdf|png|jpg|svg]$/
70
- end
71
-
72
- option :help do
73
- long '--help'
74
- desc 'Show this options information'
75
- end
76
- end
77
-
78
13
  module WordnetJapanDiagram
79
14
  class CLI
80
15
  class << self
81
- def execute
82
- connect_database
83
- create_diagram
16
+ def execute(options:)
17
+ new(options).execute
84
18
  end
19
+ end
85
20
 
86
- private
21
+ def initialize(options)
22
+ @command_options = CommandOptions.new(options: options)
23
+ end
87
24
 
88
- def connect_database
89
- WordnetJapan::Database.connect(command_options)
90
- end
25
+ def execute
26
+ connect_database
27
+ create_diagram
28
+ end
91
29
 
92
- def create_diagram
93
- DiagramCreater.new(command_options).create
94
- end
30
+ private
95
31
 
96
- def command_options
97
- @command_options ||= CommandOptions.new(options: Choice.choices)
98
- end
32
+ def connect_database
33
+ WordnetJapan::Database.connect(@command_options)
34
+ end
35
+
36
+ def create_diagram
37
+ DiagramCreater.new(@command_options).create
99
38
  end
100
39
  end
101
40
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WordnetJapanDiagram
4
- VERSION = "0.1.0"
4
+ VERSION = '0.1.3'
5
+ BANNER = "WordnetJapanDiagram #{VERSION}"
5
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "wordnet_japan_diagram/version"
3
+ require_relative 'wordnet_japan_diagram/version'
4
4
 
5
- require_relative "wordnet_japan_diagram/cli"
5
+ require_relative 'wordnet_japan_diagram/cli'
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Draw a diagram of Japanese WordNet about the hypernyms and hyponyms of the search word."
13
13
  spec.homepage = "https://github.com/tommy-012/wordnet_japan_diagram"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.6.0"
15
+ spec.required_ruby_version = ">= 3.1.4"
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/tommy-012/wordnet_japan_diagram"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordnet_japan_diagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tommy-012
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-19 00:00:00.000000000 Z
11
+ date: 2024-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -80,7 +80,6 @@ files:
80
80
  - CHANGELOG.md
81
81
  - CODE_OF_CONDUCT.md
82
82
  - Gemfile
83
- - Gemfile.lock
84
83
  - LICENSE.txt
85
84
  - README.md
86
85
  - Rakefile
@@ -114,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
113
  requirements:
115
114
  - - ">="
116
115
  - !ruby/object:Gem::Version
117
- version: 2.6.0
116
+ version: 3.1.4
118
117
  required_rubygems_version: !ruby/object:Gem::Requirement
119
118
  requirements:
120
119
  - - ">="
data/Gemfile.lock DELETED
@@ -1,85 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- wordnet_japan_diagram (0.1.0)
5
- activerecord (~> 7.0.4)
6
- choice (~> 0.2.0)
7
- ruby-graphviz (~> 1.2.5)
8
- sqlite3 (~> 1.5.4)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- activemodel (7.0.8)
14
- activesupport (= 7.0.8)
15
- activerecord (7.0.8)
16
- activemodel (= 7.0.8)
17
- activesupport (= 7.0.8)
18
- activesupport (7.0.8)
19
- concurrent-ruby (~> 1.0, >= 1.0.2)
20
- i18n (>= 1.6, < 2)
21
- minitest (>= 5.1)
22
- tzinfo (~> 2.0)
23
- ast (2.4.2)
24
- choice (0.2.0)
25
- concurrent-ruby (1.2.3)
26
- diff-lcs (1.5.1)
27
- i18n (1.14.1)
28
- concurrent-ruby (~> 1.0)
29
- json (2.7.1)
30
- language_server-protocol (3.17.0.3)
31
- minitest (5.22.2)
32
- parallel (1.24.0)
33
- parser (3.3.0.5)
34
- ast (~> 2.4.1)
35
- racc
36
- racc (1.7.3)
37
- rainbow (3.1.1)
38
- rake (13.1.0)
39
- regexp_parser (2.9.0)
40
- rexml (3.2.6)
41
- rspec (3.13.0)
42
- rspec-core (~> 3.13.0)
43
- rspec-expectations (~> 3.13.0)
44
- rspec-mocks (~> 3.13.0)
45
- rspec-core (3.13.0)
46
- rspec-support (~> 3.13.0)
47
- rspec-expectations (3.13.0)
48
- diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.13.0)
50
- rspec-mocks (3.13.0)
51
- diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.13.0)
53
- rspec-support (3.13.0)
54
- rubocop (1.60.2)
55
- json (~> 2.3)
56
- language_server-protocol (>= 3.17.0)
57
- parallel (~> 1.10)
58
- parser (>= 3.3.0.2)
59
- rainbow (>= 2.2.2, < 4.0)
60
- regexp_parser (>= 1.8, < 3.0)
61
- rexml (>= 3.2.5, < 4.0)
62
- rubocop-ast (>= 1.30.0, < 2.0)
63
- ruby-progressbar (~> 1.7)
64
- unicode-display_width (>= 2.4.0, < 3.0)
65
- rubocop-ast (1.30.0)
66
- parser (>= 3.2.1.0)
67
- ruby-graphviz (1.2.5)
68
- rexml
69
- ruby-progressbar (1.13.0)
70
- sqlite3 (1.5.4-arm64-darwin)
71
- tzinfo (2.0.6)
72
- concurrent-ruby (~> 1.0)
73
- unicode-display_width (2.5.0)
74
-
75
- PLATFORMS
76
- arm64-darwin-22
77
-
78
- DEPENDENCIES
79
- rake (~> 13.0)
80
- rspec (~> 3.0)
81
- rubocop (~> 1.21)
82
- wordnet_japan_diagram!
83
-
84
- BUNDLED WITH
85
- 2.3.26