rubyfca 0.2.10 → 0.2.11
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.
- data/.gitignore +19 -3
- data/Gemfile +4 -0
- data/LICENSE +1 -1
- data/README.rdoc +2 -3
- data/Rakefile +2 -56
- data/bin/rubyfca +2 -4
- data/lib/rubyfca.rb +13 -6
- data/lib/{ruby_graphviz.rb → rubyfca/ruby_graphviz.rb} +4 -1
- data/lib/{trollop.rb → rubyfca/trollop.rb} +1 -1
- data/lib/rubyfca/version.rb +3 -0
- data/rubyfca.gemspec +13 -56
- data/test/test_data.csv +7 -0
- data/test/test_data.cxt +6 -6
- metadata +39 -50
- data/VERSION +0 -1
data/.gitignore
CHANGED
@@ -1,5 +1,21 @@
|
|
1
|
-
*.
|
2
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
3
9
|
coverage
|
4
|
-
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
5
12
|
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
.DS_Store
|
19
|
+
*.bak
|
20
|
+
*.~
|
21
|
+
*.log
|
data/Gemfile
ADDED
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -4,7 +4,7 @@ Command line tool for Formal Concept Analysis (FCA) written in Ruby.
|
|
4
4
|
|
5
5
|
== Features
|
6
6
|
|
7
|
-
* Convert a Conexp's CXT file and generate a Graphviz DOT file, or a PNG/JPG/EPS image file.
|
7
|
+
* Convert a Conexp's CXT or CSV file and generate a Graphviz DOT file, or a PNG/JPG/EPS image file.
|
8
8
|
* Adopt the Ganter algorithm (through its Perl implementation of Fcastone by Uta Priss).
|
9
9
|
|
10
10
|
== Installation
|
@@ -33,7 +33,6 @@ Install the gem:
|
|
33
33
|
|
34
34
|
== ToDo
|
35
35
|
|
36
|
-
* Multiple input formats (such as CSV)
|
37
36
|
* Database connection capability
|
38
37
|
|
39
38
|
== Links
|
@@ -42,4 +41,4 @@ under construction
|
|
42
41
|
|
43
42
|
== Copyright
|
44
43
|
|
45
|
-
Copyright (c) 2009 Yoichiro Hasebe and Kow Kuroda. See LICENSE for details.
|
44
|
+
Copyright (c) 2009-2012 Yoichiro Hasebe and Kow Kuroda. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,56 +1,2 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "rubyfca"
|
8
|
-
gem.summary = %Q{Command line Formal Concept Ananlysis (FCA) tool written in Ruby}
|
9
|
-
gem.description = %Q{Command line Formal Concept Ananlysis (FCA) tool written in Ruby}
|
10
|
-
gem.email = "yohasebe@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/yohasebe/rubyfca"
|
12
|
-
gem.authors = ["Yoichiro Hasebe"]
|
13
|
-
gem.add_development_dependency "thoughtbot-shoulda"
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
rescue LoadError
|
17
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
-
end
|
19
|
-
|
20
|
-
require 'rake/testtask'
|
21
|
-
Rake::TestTask.new(:test) do |test|
|
22
|
-
test.libs << 'lib' << 'test'
|
23
|
-
test.pattern = 'test/**/*_test.rb'
|
24
|
-
test.verbose = true
|
25
|
-
end
|
26
|
-
|
27
|
-
begin
|
28
|
-
require 'rcov/rcovtask'
|
29
|
-
Rcov::RcovTask.new do |test|
|
30
|
-
test.libs << 'test'
|
31
|
-
test.pattern = 'test/**/*_test.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
34
|
-
rescue LoadError
|
35
|
-
task :rcov do
|
36
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
task :test => :check_dependencies
|
41
|
-
|
42
|
-
task :default => :test
|
43
|
-
|
44
|
-
require 'rake/rdoctask'
|
45
|
-
Rake::RDocTask.new do |rdoc|
|
46
|
-
if File.exist?('VERSION')
|
47
|
-
version = File.read('VERSION')
|
48
|
-
else
|
49
|
-
version = ""
|
50
|
-
end
|
51
|
-
|
52
|
-
rdoc.rdoc_dir = 'rdoc'
|
53
|
-
rdoc.title = "rubyfca #{version}"
|
54
|
-
rdoc.rdoc_files.include('README*')
|
55
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
-
end
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
data/bin/rubyfca
CHANGED
@@ -2,14 +2,12 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
4
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
5
|
-
require 'trollop'
|
6
5
|
require 'rubyfca'
|
7
|
-
require 'ruby_graphviz'
|
8
6
|
|
9
7
|
################ parse options ##########
|
10
8
|
|
11
9
|
opts = Trollop::options do
|
12
|
-
version
|
10
|
+
version RubyFCA::VERSION
|
13
11
|
banner <<-EOS
|
14
12
|
|
15
13
|
RubuFCA converts Conexp CXT data to Graphviz dot format.
|
@@ -79,7 +77,7 @@ end
|
|
79
77
|
#
|
80
78
|
begin
|
81
79
|
ctxt = FormalContext.new(inputdata, input_type, !opts[:full])
|
82
|
-
ctxt.
|
80
|
+
ctxt.calcurate
|
83
81
|
# rescue => e
|
84
82
|
# puts e
|
85
83
|
# showerror("Source data may have problems. Process aborted.", 1)
|
data/lib/rubyfca.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
1
4
|
## lib/rubyfca.rb -- Formal Concept Analysis tool in Ruby
|
2
5
|
## Author:: Yoichiro Hasebe (mailto: yohasebe@gmail.com)
|
3
6
|
## Kow Kuroda (mailto: kuroda@nict.go.jp)
|
4
|
-
## Copyright:: Copyright
|
7
|
+
## Copyright:: Copyright 2009 Yoichiro Hasebe and Kow Kuroda
|
5
8
|
## License:: GNU GPL version 3
|
6
9
|
|
7
|
-
|
10
|
+
$: << File.dirname(__FILE__) + "/rubyfca"
|
8
11
|
|
9
12
|
require 'csv'
|
10
13
|
require 'ruby_graphviz'
|
14
|
+
require 'version'
|
15
|
+
require 'trollop'
|
11
16
|
|
12
17
|
private
|
13
18
|
|
@@ -45,6 +50,7 @@ class FormalContext
|
|
45
50
|
if input.size == 0
|
46
51
|
showerror("File is empty", 1)
|
47
52
|
end
|
53
|
+
input.gsub!(" ", " ")
|
48
54
|
begin
|
49
55
|
case mode
|
50
56
|
when /cxt\z/
|
@@ -85,9 +91,10 @@ class FormalContext
|
|
85
91
|
|
86
92
|
def remove_blank(input)
|
87
93
|
blank_removed = ""
|
88
|
-
input.each do |line|
|
89
|
-
|
90
|
-
|
94
|
+
input.split("\n").each do |line|
|
95
|
+
line = line.strip
|
96
|
+
unless /\A\s*\z/ =~ line
|
97
|
+
blank_removed << line + "\n"
|
91
98
|
end
|
92
99
|
end
|
93
100
|
blank_removed
|
@@ -101,7 +108,7 @@ class FormalContext
|
|
101
108
|
end
|
102
109
|
|
103
110
|
## Apply a formal concept analysis on the matrix
|
104
|
-
def
|
111
|
+
def calcurate
|
105
112
|
@concepts, @extM, @intM = ganter_alg(@matrix)
|
106
113
|
@relM, @reltrans, @rank = create_rel(@intM)
|
107
114
|
@gammaM, @muM = gammaMu(@extM, @intM, @matrix)
|
@@ -1,6 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
1
4
|
## lib/ruby_graphviz.rb -- graphviz dot generator library
|
2
5
|
## Author:: Yoichiro Hasebe (mailto: yohasebe@gmail.com)
|
3
|
-
## Copyright:: Copyright
|
6
|
+
## Copyright:: Copyright 2009 Yoichiro Hasebe
|
4
7
|
## License:: GNU GPL version 3
|
5
8
|
|
6
9
|
class RubyGraphviz
|
@@ -413,7 +413,7 @@ class Parser
|
|
413
413
|
|
414
414
|
## Print the help message to +stream+.
|
415
415
|
def educate stream=$stdout
|
416
|
-
width # just
|
416
|
+
width # just calcurate it now; otherwise we have to be careful not to
|
417
417
|
# call this unless the cursor's at the beginning of a line.
|
418
418
|
|
419
419
|
left = {}
|
data/rubyfca.gemspec
CHANGED
@@ -1,60 +1,17 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/rubyfca/version', __FILE__)
|
5
3
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Yoichiro Hasebe", "Kow Kuroda"]
|
6
|
+
gem.email = ["yohasebe@gmail.com"]
|
7
|
+
gem.summary = %q{Command line FCA tool written in Ruby}
|
8
|
+
gem.description = %q{Command line Formal Concept Analysis (FCA) tool written in Ruby}
|
9
|
+
gem.homepage = "http://github.com/yohasebe/rubyfca"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
s.executables = ["rubyfca"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".gitignore",
|
24
|
-
"LICENSE",
|
25
|
-
"README.rdoc",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"bin/rubyfca",
|
29
|
-
"lib/ruby_graphviz.rb",
|
30
|
-
"lib/rubyfca.rb",
|
31
|
-
"lib/trollop.rb",
|
32
|
-
"rubyfca.gemspec",
|
33
|
-
"test/rubyfca_test.rb",
|
34
|
-
"test/test_data.cxt",
|
35
|
-
"test/test_helper.rb"
|
36
|
-
]
|
37
|
-
s.homepage = %q{http://github.com/yohasebe/rubyfca}
|
38
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
-
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.5}
|
41
|
-
s.summary = %q{Command line Formal Concept Ananlysis (FCA) tool written in Ruby}
|
42
|
-
s.test_files = [
|
43
|
-
"test/rubyfca_test.rb",
|
44
|
-
"test/test_helper.rb"
|
45
|
-
]
|
46
|
-
|
47
|
-
if s.respond_to? :specification_version then
|
48
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
-
s.specification_version = 3
|
50
|
-
|
51
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
52
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
53
|
-
else
|
54
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
55
|
-
end
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
58
|
-
end
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "rubyfca"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = RubyFCA::VERSION
|
59
17
|
end
|
60
|
-
|
data/test/test_data.csv
ADDED
data/test/test_data.cxt
CHANGED
@@ -8,18 +8,18 @@ Sparrow
|
|
8
8
|
Eagle
|
9
9
|
Lion
|
10
10
|
Bonobo
|
11
|
-
Human
|
11
|
+
Human being
|
12
12
|
bird
|
13
13
|
mammal
|
14
14
|
ape
|
15
15
|
flying
|
16
16
|
preying
|
17
17
|
talking
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
.X..X.
|
18
|
+
XXX...
|
19
|
+
...XXX
|
20
|
+
....XX
|
22
21
|
.XX...
|
23
|
-
|
22
|
+
..XX..
|
23
|
+
.....X
|
24
24
|
|
25
25
|
|
metadata
CHANGED
@@ -1,79 +1,68 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyfca
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.11
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Yoichiro Hasebe
|
9
|
+
- Kow Kuroda
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
-
|
16
|
-
|
17
|
-
type: :development
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
25
|
-
description: Command line Formal Concept Ananlysis (FCA) tool written in Ruby
|
26
|
-
email: yohasebe@gmail.com
|
27
|
-
executables:
|
13
|
+
date: 2012-06-05 00:00:00.000000000 Z
|
14
|
+
dependencies: []
|
15
|
+
description: Command line Formal Concept Analysis (FCA) tool written in Ruby
|
16
|
+
email:
|
17
|
+
- yohasebe@gmail.com
|
18
|
+
executables:
|
28
19
|
- rubyfca
|
29
20
|
extensions: []
|
30
|
-
|
31
|
-
|
32
|
-
- LICENSE
|
33
|
-
- README.rdoc
|
34
|
-
files:
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
35
23
|
- .document
|
36
24
|
- .gitignore
|
25
|
+
- Gemfile
|
37
26
|
- LICENSE
|
38
27
|
- README.rdoc
|
39
28
|
- Rakefile
|
40
|
-
- VERSION
|
41
29
|
- bin/rubyfca
|
42
|
-
- lib/ruby_graphviz.rb
|
43
30
|
- lib/rubyfca.rb
|
44
|
-
- lib/
|
31
|
+
- lib/rubyfca/ruby_graphviz.rb
|
32
|
+
- lib/rubyfca/trollop.rb
|
33
|
+
- lib/rubyfca/version.rb
|
45
34
|
- rubyfca.gemspec
|
35
|
+
- rubyfca.log
|
46
36
|
- test/rubyfca_test.rb
|
37
|
+
- test/test_data.csv
|
47
38
|
- test/test_data.cxt
|
48
39
|
- test/test_helper.rb
|
49
|
-
has_rdoc: true
|
50
40
|
homepage: http://github.com/yohasebe/rubyfca
|
51
41
|
licenses: []
|
52
|
-
|
53
42
|
post_install_message:
|
54
|
-
rdoc_options:
|
55
|
-
|
56
|
-
require_paths:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
57
45
|
- lib
|
58
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
70
58
|
requirements: []
|
71
|
-
|
72
59
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
60
|
+
rubygems_version: 1.8.10
|
74
61
|
signing_key:
|
75
62
|
specification_version: 3
|
76
|
-
summary: Command line
|
77
|
-
test_files:
|
63
|
+
summary: Command line FCA tool written in Ruby
|
64
|
+
test_files:
|
78
65
|
- test/rubyfca_test.rb
|
66
|
+
- test/test_data.csv
|
67
|
+
- test/test_data.cxt
|
79
68
|
- test/test_helper.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.10
|