stamina 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/CHANGELOG.md +22 -5
  2. data/LICENCE.md +2 -2
  3. data/bin/stamina +1 -7
  4. data/lib/stamina.rb +10 -19
  5. metadata +54 -333
  6. data/.gemtest +0 -0
  7. data/Gemfile +0 -2
  8. data/Gemfile.lock +0 -37
  9. data/Manifest.txt +0 -16
  10. data/README.md +0 -78
  11. data/Rakefile +0 -23
  12. data/example/adl/automaton.adl +0 -49
  13. data/example/adl/sample.adl +0 -53
  14. data/example/basic/characteristic_sample.adl +0 -32
  15. data/example/basic/target.adl +0 -9
  16. data/example/competition/31_test.adl +0 -1500
  17. data/example/competition/31_training.adl +0 -1759
  18. data/lib/stamina/abbadingo.rb +0 -2
  19. data/lib/stamina/abbadingo/random_dfa.rb +0 -48
  20. data/lib/stamina/abbadingo/random_sample.rb +0 -146
  21. data/lib/stamina/adl.rb +0 -298
  22. data/lib/stamina/automaton.rb +0 -1263
  23. data/lib/stamina/automaton/complete.rb +0 -36
  24. data/lib/stamina/automaton/equivalence.rb +0 -55
  25. data/lib/stamina/automaton/metrics.rb +0 -78
  26. data/lib/stamina/automaton/minimize.rb +0 -25
  27. data/lib/stamina/automaton/minimize/hopcroft.rb +0 -116
  28. data/lib/stamina/automaton/minimize/pitchies.rb +0 -64
  29. data/lib/stamina/automaton/strip.rb +0 -16
  30. data/lib/stamina/automaton/walking.rb +0 -363
  31. data/lib/stamina/classifier.rb +0 -52
  32. data/lib/stamina/command.rb +0 -45
  33. data/lib/stamina/command/abbadingo_dfa.rb +0 -81
  34. data/lib/stamina/command/abbadingo_samples.rb +0 -40
  35. data/lib/stamina/command/adl2dot.rb +0 -71
  36. data/lib/stamina/command/classify.rb +0 -48
  37. data/lib/stamina/command/help.rb +0 -27
  38. data/lib/stamina/command/infer.rb +0 -141
  39. data/lib/stamina/command/metrics.rb +0 -51
  40. data/lib/stamina/command/robustness.rb +0 -22
  41. data/lib/stamina/command/score.rb +0 -35
  42. data/lib/stamina/errors.rb +0 -23
  43. data/lib/stamina/ext/math.rb +0 -20
  44. data/lib/stamina/induction/blue_fringe.rb +0 -265
  45. data/lib/stamina/induction/commons.rb +0 -156
  46. data/lib/stamina/induction/rpni.rb +0 -186
  47. data/lib/stamina/induction/union_find.rb +0 -377
  48. data/lib/stamina/input_string.rb +0 -123
  49. data/lib/stamina/loader.rb +0 -1
  50. data/lib/stamina/markable.rb +0 -42
  51. data/lib/stamina/sample.rb +0 -267
  52. data/lib/stamina/scoring.rb +0 -213
  53. data/lib/stamina/utils.rb +0 -1
  54. data/lib/stamina/utils/decorate.rb +0 -81
  55. data/lib/stamina/version.rb +0 -14
  56. data/stamina.gemspec +0 -191
  57. data/stamina.noespec +0 -32
  58. data/tasks/debug_mail.rake +0 -78
  59. data/tasks/debug_mail.txt +0 -13
  60. data/tasks/gem.rake +0 -68
  61. data/tasks/spec_test.rake +0 -79
  62. data/tasks/unit_test.rake +0 -77
  63. data/tasks/yard.rake +0 -51
  64. data/test/stamina/abbadingo/random_dfa_test.rb +0 -16
  65. data/test/stamina/abbadingo/random_sample_test.rb +0 -78
  66. data/test/stamina/adl_test.rb +0 -516
  67. data/test/stamina/automaton/classifier_test.rb +0 -259
  68. data/test/stamina/automaton/complete_test.rb +0 -58
  69. data/test/stamina/automaton/equivalence_test.rb +0 -120
  70. data/test/stamina/automaton/metrics_test.rb +0 -36
  71. data/test/stamina/automaton/minimize/hopcroft_test.rb +0 -15
  72. data/test/stamina/automaton/minimize/minimize_test.rb +0 -55
  73. data/test/stamina/automaton/minimize/pitchies_test.rb +0 -15
  74. data/test/stamina/automaton/minimize/rice_edu_10.adl +0 -16
  75. data/test/stamina/automaton/minimize/rice_edu_10.min.adl +0 -13
  76. data/test/stamina/automaton/minimize/rice_edu_13.adl +0 -13
  77. data/test/stamina/automaton/minimize/rice_edu_13.min.adl +0 -7
  78. data/test/stamina/automaton/minimize/should_strip_1.adl +0 -8
  79. data/test/stamina/automaton/minimize/should_strip_1.min.adl +0 -6
  80. data/test/stamina/automaton/minimize/unknown_1.adl +0 -16
  81. data/test/stamina/automaton/minimize/unknown_1.min.adl +0 -12
  82. data/test/stamina/automaton/strip_test.rb +0 -36
  83. data/test/stamina/automaton/to_dot_test.rb +0 -64
  84. data/test/stamina/automaton/walking/dfa_delta_test.rb +0 -39
  85. data/test/stamina/automaton/walking_test.rb +0 -206
  86. data/test/stamina/automaton_additional_test.rb +0 -190
  87. data/test/stamina/automaton_test.rb +0 -1104
  88. data/test/stamina/exit.rb +0 -3
  89. data/test/stamina/induction/blue_fringe_test.rb +0 -83
  90. data/test/stamina/induction/induction_test.rb +0 -70
  91. data/test/stamina/induction/redblue_mergesamestatebug_expected.adl +0 -19
  92. data/test/stamina/induction/redblue_mergesamestatebug_pta.dot +0 -64
  93. data/test/stamina/induction/redblue_mergesamestatebug_sample.adl +0 -9
  94. data/test/stamina/induction/redblue_universal_expected.adl +0 -4
  95. data/test/stamina/induction/redblue_universal_sample.adl +0 -5
  96. data/test/stamina/induction/rpni_inria_expected.adl +0 -7
  97. data/test/stamina/induction/rpni_inria_sample.adl +0 -9
  98. data/test/stamina/induction/rpni_test.rb +0 -129
  99. data/test/stamina/induction/rpni_test_pta.dot +0 -22
  100. data/test/stamina/induction/rpni_universal_expected.adl +0 -4
  101. data/test/stamina/induction/rpni_universal_sample.adl +0 -4
  102. data/test/stamina/induction/union_find_test.rb +0 -124
  103. data/test/stamina/input_string_test.rb +0 -323
  104. data/test/stamina/markable_test.rb +0 -70
  105. data/test/stamina/randdfa.adl +0 -66
  106. data/test/stamina/sample.adl +0 -4
  107. data/test/stamina/sample_classify_test.rb +0 -149
  108. data/test/stamina/sample_test.rb +0 -290
  109. data/test/stamina/scoring_test.rb +0 -63
  110. data/test/stamina/small_dfa.dot +0 -16
  111. data/test/stamina/small_dfa.gif +0 -0
  112. data/test/stamina/small_nfa.dot +0 -18
  113. data/test/stamina/small_nfa.gif +0 -0
  114. data/test/stamina/stamina_test.rb +0 -80
  115. data/test/stamina/utils/decorate_test.rb +0 -65
  116. data/test/test_all.rb +0 -7
data/lib/stamina/utils.rb DELETED
@@ -1 +0,0 @@
1
- require 'stamina/utils/decorate'
@@ -1,81 +0,0 @@
1
- module Stamina
2
- module Utils
3
- #
4
- # Decorates states of an automaton by applying a propagation rule
5
- # until a fix point is reached.
6
- #
7
- class Decorate
8
-
9
- # The key to use to maintain the decoration on states (:invariant
10
- # is used by default)
11
- attr_writer :decoration_key
12
-
13
- # Creates a decoration algorithm instance
14
- def initialize(decoration_key = :invariant)
15
- @decoration_key = decoration_key
16
- @suppremum = nil
17
- @propagate = nil
18
- end
19
-
20
- # Installs a suppremum function through a block.
21
- def set_suppremum(&block)
22
- raise ArgumentError, 'Suppremum expected through a block' if block.nil?
23
- raise ArgumentError, 'Block of arity 2 expected' unless block.arity==2
24
- @suppremum = block
25
- end
26
-
27
- # Installs a propagate function through a block.
28
- def set_propagate(&block)
29
- raise ArgumentError, 'Propagate expected through a block' if block.nil?
30
- raise ArgumentError, 'Block of arity 2 expected' unless block.arity==2
31
- @propagate = block
32
- end
33
-
34
- # Computes the suppremum between two decorations. By default, this method
35
- # looks for a suppremum function installed with set_suppremum. If not found,
36
- # it tries calling a suppremum method on d0. If not found it raises an error.
37
- # This method may be overriden.
38
- def suppremum(d0, d1)
39
- return @suppremum.call(d0, d1) if @suppremum
40
- return d0.suppremum(d1) if d0.respond_to?(:suppremum)
41
- raise "No suppremum function installed or implemented by decorations"
42
- end
43
-
44
- # Computes the propagation rule. By default, this method looks for a propagate
45
- # function installed with set_propagate. If not found, it tries calling a +
46
- # method on deco. If not found it raises an error.
47
- # This method may be overriden.
48
- def propagate(deco, edge)
49
- return @propagate.call(deco, edge) if @propagate
50
- return deco.+(edge) if deco.respond_to?(:+)
51
- raise "No propagate function installed or implemented by decorations"
52
- end
53
-
54
- # Executes the propagation algorithm on a given automaton.
55
- def execute(fa, bottom, d0)
56
- # install initial decoration
57
- fa.states.each do |s|
58
- s[@decoration_key] = (s.initial? ? d0 : bottom)
59
- end
60
-
61
- # fix-point loop starting with initial states
62
- to_explore = fa.initial_states
63
- until to_explore.empty?
64
- source = to_explore.pop
65
- source.out_edges.each do |edge|
66
- target = edge.target
67
- p_decor = propagate(source[@decoration_key], edge)
68
- p_decor = suppremum(target[@decoration_key], p_decor)
69
- unless p_decor == target[@decoration_key]
70
- target[@decoration_key] = p_decor
71
- to_explore << target unless to_explore.include?(target)
72
- end
73
- end
74
- end
75
-
76
- fa
77
- end
78
-
79
- end # class Decorate
80
- end # module Utils
81
- end # module Stamina
@@ -1,14 +0,0 @@
1
- module Stamina
2
- module Version
3
-
4
- MAJOR = 0
5
- MINOR = 4
6
- TINY = 0
7
-
8
- def self.to_s
9
- [ MAJOR, MINOR, TINY ].join('.')
10
- end
11
-
12
- end
13
- VERSION = Version.to_s
14
- end
data/stamina.gemspec DELETED
@@ -1,191 +0,0 @@
1
- # We require your library, mainly to have access to the VERSION number.
2
- # Feel free to set $version manually.
3
- $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
- require "stamina/version"
5
- $version = Stamina::Version.to_s
6
-
7
- #
8
- # This is your Gem specification. Default values are provided so that your library
9
- # should be correctly packaged given what you have described in the .noespec file.
10
- #
11
- Gem::Specification.new do |s|
12
-
13
- ################################################################### ABOUT YOUR GEM
14
-
15
- # Gem name (required)
16
- s.name = "stamina"
17
-
18
- # Gem version (required)
19
- s.version = $version
20
-
21
- # A short summary of this gem
22
- #
23
- # This is displayed in `gem list -d`.
24
- s.summary = "Automaton and Regular Inference Toolkit"
25
-
26
- # A long description of this gem (required)
27
- #
28
- # The description should be more detailed than the summary. For example,
29
- # you might wish to copy the entire README into the description.
30
- s.description = "Stamina is an automaton and regular inference toolkit initially developped for the baseline \nof the Stamina Competition (stamina.chefbe.net)."
31
-
32
- # The URL of this gem home page (optional)
33
- s.homepage = "http://stamina.chefbe.net/"
34
-
35
- # Gem publication date (required but auto)
36
- #
37
- # Today is automatically used by default, uncomment only if
38
- # you know what you do!
39
- #
40
- # s.date = Time.now.strftime('%Y-%m-%d')
41
-
42
- # The license(s) for the library. Each license must be a short name, no
43
- # more than 64 characters.
44
- #
45
- # s.licences = %w{}
46
-
47
- # The rubyforge project this gem lives under (optional)
48
- #
49
- # s.rubyforge_project = nil
50
-
51
- ################################################################### ABOUT THE AUTHORS
52
-
53
- # The list of author names who wrote this gem.
54
- #
55
- # If you are providing multiple authors and multiple emails they should be
56
- # in the same order.
57
- #
58
- s.authors = ["Bernard Lambeau"]
59
-
60
- # Contact emails for this gem
61
- #
62
- # If you are providing multiple authors and multiple emails they should be
63
- # in the same order.
64
- #
65
- # NOTE: Somewhat strangly this attribute is always singular!
66
- # Don't replace by s.emails = ...
67
- s.email = ["blambeau@gmail.com"]
68
-
69
- ################################################################### PATHS, FILES, BINARIES
70
-
71
- # Paths in the gem to add to $LOAD_PATH when this gem is
72
- # activated (required).
73
- #
74
- # The default 'lib' is typically sufficient.
75
- s.require_paths = ["lib"]
76
-
77
- # Files included in this gem.
78
- #
79
- # By default, we take all files included in the Manifest.txt file on root
80
- # of the project. Entries of the manifest are interpreted as Dir[...]
81
- # patterns so that lazy people may use wilcards like lib/**/*
82
- #
83
- here = File.expand_path(File.dirname(__FILE__))
84
- s.files = File.readlines(File.join(here, 'Manifest.txt')).
85
- inject([]){|files, pattern| files + Dir[File.join(here, pattern.strip)]}.
86
- collect{|x| x[(1+here.size)..-1]}
87
-
88
- # Test files included in this gem.
89
- #
90
- s.test_files = Dir["test/**/*"] + Dir["spec/**/*"]
91
-
92
- # The path in the gem for executable scripts (optional)
93
- #
94
- s.bindir = "bin"
95
-
96
- # Executables included in the gem.
97
- #
98
- s.executables = (Dir["bin/*"]).collect{|f| File.basename(f)}
99
-
100
- ################################################################### REQUIREMENTS & INSTALL
101
- # Remember the gem version requirements operators and schemes:
102
- # = Equals version
103
- # != Not equal to version
104
- # > Greater than version
105
- # < Less than version
106
- # >= Greater than or equal to
107
- # <= Less than or equal to
108
- # ~> Approximately greater than
109
- #
110
- # Don't forget to have a look at http://lmgtfy.com/?q=Ruby+Versioning+Policies
111
- # for setting your gem version.
112
- #
113
- # For your requirements to other gems, remember that
114
- # ">= 2.2.0" (optimistic: specify minimal version)
115
- # ">= 2.2.0", "< 3.0" (pessimistic: not greater than the next major)
116
- # "~> 2.2" (shortcut for ">= 2.2.0", "< 3.0")
117
- # "~> 2.2.0" (shortcut for ">= 2.2.0", "< 2.3.0")
118
- #
119
-
120
- #
121
- # One call to add_dependency('gem_name', 'gem version requirement') for each
122
- # runtime dependency. These gems will be installed with your gem.
123
- # One call to add_development_dependency('gem_name', 'gem version requirement')
124
- # for each development dependency. These gems are required for developers
125
- #
126
- s.add_development_dependency("rake", "~> 0.8.7")
127
- s.add_development_dependency("bundler", "~> 1.0")
128
- s.add_development_dependency("rspec", "~> 2.4.0")
129
- s.add_development_dependency("yard", "~> 0.6.4")
130
- s.add_development_dependency("bluecloth", "~> 2.0.9")
131
- s.add_development_dependency("wlang", "~> 0.10.1")
132
- s.add_development_dependency("gnuplot", "~> 2.3.6")
133
- s.add_dependency("quickl", "~> 0.2.0")
134
-
135
- # The version of ruby required by this gem
136
- #
137
- # Uncomment and set this if your gem requires specific ruby versions.
138
- #
139
- # s.required_ruby_version = ">= 0"
140
-
141
- # The RubyGems version required by this gem
142
- #
143
- # s.required_rubygems_version = ">= 0"
144
-
145
- # The platform this gem runs on. See Gem::Platform for details.
146
- #
147
- # s.platform = nil
148
-
149
- # Extensions to build when installing the gem.
150
- #
151
- # Valid types of extensions are extconf.rb files, configure scripts
152
- # and rakefiles or mkrf_conf files.
153
- #
154
- s.extensions = []
155
-
156
- # External (to RubyGems) requirements that must be met for this gem to work.
157
- # It’s simply information for the user.
158
- #
159
- s.requirements = nil
160
-
161
- # A message that gets displayed after the gem is installed
162
- #
163
- # Uncomment and set this if you want to say something to the user
164
- # after gem installation
165
- #
166
- s.post_install_message = nil
167
-
168
- ################################################################### SECURITY
169
-
170
- # The key used to sign this gem. See Gem::Security for details.
171
- #
172
- # s.signing_key = nil
173
-
174
- # The certificate chain used to sign this gem. See Gem::Security for
175
- # details.
176
- #
177
- # s.cert_chain = []
178
-
179
- ################################################################### RDOC
180
-
181
- # An ARGV style array of options to RDoc
182
- #
183
- # See 'rdoc --help' about this
184
- #
185
- s.rdoc_options = []
186
-
187
- # Extra files to add to RDoc such as README
188
- #
189
- s.extra_rdoc_files = Dir["README.md"] + Dir["CHANGELOG.md"] + Dir["LICENCE.md"]
190
-
191
- end
data/stamina.noespec DELETED
@@ -1,32 +0,0 @@
1
- # Noe template for ruby gem libraries (https://github.com/blambeau/noe) - short version
2
- # Run 'noe show-spec' and 'noe help show-spec' for additional details.
3
- template-info:
4
- name: "ruby"
5
- version: 1.3.0
6
- variables:
7
- lower:
8
- stamina
9
- upper:
10
- Stamina
11
- version:
12
- 0.4.0
13
- summary: |-
14
- Automaton and Regular Inference Toolkit
15
- description: |-
16
- Stamina is an automaton and regular inference toolkit initially developped for the baseline
17
- of the Stamina Competition (stamina.chefbe.net).
18
- authors:
19
- - name: Bernard Lambeau
20
- email: blambeau@gmail.com
21
- links:
22
- - http://stamina.chefbe.net/
23
- - http://github.com/blambeau/stamina
24
- dependencies:
25
- - {name: quickl, version: "~> 0.2.0", groups: [runtime]}
26
- - {name: rake, version: "~> 0.8.7", groups: [development]}
27
- - {name: bundler, version: "~> 1.0", groups: [development]}
28
- - {name: rspec, version: "~> 2.4.0", groups: [development]}
29
- - {name: yard, version: "~> 0.6.4", groups: [development]}
30
- - {name: bluecloth, version: "~> 2.0.9", groups: [development]}
31
- - {name: wlang, version: "~> 0.10.1", groups: [development]}
32
- - {name: gnuplot, version: "~> 2.3.6", groups: [development]}
@@ -1,78 +0,0 @@
1
- # Installs a rake task for debuging the announcement mail.
2
- #
3
- # This file installs the 'rake debug_mail' that flushes an announcement mail
4
- # for your library on the standard output. It is automatically generated
5
- # by Noe from your .noespec file, and should therefore be configured there,
6
- # under the variables/rake_tasks/debug_mail entry, as illustrated below:
7
- #
8
- # variables:
9
- # rake_tasks:
10
- # debug_mail:
11
- # rx_changelog_sections: /^#/
12
- # nb_changelog_sections: 1
13
- # ...
14
- #
15
- # If you have specific needs requiring manual intervention on this file,
16
- # don't forget to set safe-override to false in your noe specification:
17
- #
18
- # template-info:
19
- # manifest:
20
- # tasks/debug_mail.rake:
21
- # safe-override: false
22
- #
23
- # The mail template used can be found in debug_mail.txt. That file may be
24
- # changed to tune the mail you want to send. If you do so, don't forget to
25
- # add a manifest entry in your .noespec file to avoid overriding you
26
- # changes. The mail template uses wlang, with parentheses for block
27
- # delimiters.
28
- #
29
- # template-info:
30
- # manifest:
31
- # tasks/debug_mail.txt:
32
- # safe-override: false
33
- #
34
- begin
35
- require 'wlang'
36
- require 'yaml'
37
-
38
- desc "Debug the release announcement mail"
39
- task :debug_mail do
40
- # Check that a .noespec file exists
41
- noespec_file = File.expand_path('../../stamina.noespec', __FILE__)
42
- unless File.exists?(noespec_file)
43
- raise "Unable to find .noespec project file, sorry."
44
- end
45
-
46
- # Load it as well as variables and options
47
- noespec = YAML::load(File.read(noespec_file))
48
- vars = noespec['variables'] || {}
49
-
50
- # Changes are taken from CHANGELOG
51
- logs = Dir[File.expand_path("../../CHANGELOG.*", __FILE__)]
52
- unless logs.size == 1
53
- abort "Unable to find a changelog file"
54
- end
55
-
56
- # Load interesting changesets
57
- changes, end_found = [], 0
58
- File.readlines(logs.first).select{|line|
59
- if line =~ /^#/
60
- break if end_found >= 1
61
- end_found += 1
62
- end
63
- changes << line
64
- }
65
- vars['changes'] = changes.join
66
-
67
- # WLang template
68
- template = File.expand_path('../debug_mail.txt', __FILE__)
69
-
70
- # Let's go!
71
- $stdout << WLang::file_instantiate(template, vars, "wlang/active-text")
72
- end
73
-
74
- rescue LoadError
75
- task :debug_mail do
76
- abort "wlang is not available. Try 'gem install wlang'"
77
- end
78
- end
data/tasks/debug_mail.txt DELETED
@@ -1,13 +0,0 @@
1
- Subject: [ANN] !{lower} !{version} Released
2
-
3
- !{lower} version !{version} has been released!
4
-
5
- !{summary}
6
-
7
- *{links as l}{* <!{l}>}{!{"\n"}}
8
-
9
- !{description}
10
-
11
- Changes:
12
-
13
- !{changes}
data/tasks/gem.rake DELETED
@@ -1,68 +0,0 @@
1
- # Installs rake tasks for gemming and packaging
2
- #
3
- # This file installs the 'rake package', 'rake gem' tasks and associates
4
- # (clobber_package, repackage, ...). It is automatically generated by Noe
5
- # from your .noespec file, and should therefore be configured there, under
6
- # the variables/rake_tasks/gem entry, as illustrated below:
7
- #
8
- # variables:
9
- # rake_tasks:
10
- # gem:
11
- # package_dir: pkg
12
- # need_tar: false
13
- # need_tar_gz: false
14
- # need_tar_bz2: false
15
- # need_zip: false
16
- # ...
17
- #
18
- # If you have specific needs requiring manual intervention on this file,
19
- # don't forget to set safe-override to false in your noe specification:
20
- #
21
- # template-info:
22
- # manifest:
23
- # tasks/gem.rake:
24
- # safe-override: false
25
- #
26
- begin
27
- require 'rubygems/package_task'
28
- Gem::PackageTask.new($gemspec) do |t|
29
-
30
- # Name of the package
31
- t.name = $gemspec.name
32
-
33
- # Version of the package
34
- t.version = $gemspec.version
35
-
36
- # Directory used to store the package files
37
- t.package_dir = "pkg"
38
-
39
- # True if a gzipped tar file (tgz) should be produced
40
- t.need_tar = false
41
-
42
- # True if a gzipped tar file (tar.gz) should be produced
43
- t.need_tar_gz = false
44
-
45
- # True if a bzip2'd tar file (tar.bz2) should be produced
46
- t.need_tar_bz2 = false
47
-
48
- # True if a zip file should be produced (default is false)
49
- t.need_zip = false
50
-
51
- # List of files to be included in the package.
52
- t.package_files = $gemspec.files
53
-
54
- # Tar command for gzipped or bzip2ed archives.
55
- t.tar_command = "tar"
56
-
57
- # Zip command for zipped archives.
58
- t.zip_command = "zip"
59
-
60
- end
61
- rescue LoadError
62
- task :gem do
63
- abort 'rubygems/package_task is not available. You should verify your rubygems installation'
64
- end
65
- task :package do
66
- abort 'rubygems/package_task is not available. You should verify your rubygems installation'
67
- end
68
- end