ruby_pager 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/ruby_pager.iml +60 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/TODO.txt +14 -0
- data/bin/baseline_noise +43 -0
- data/bin/console +14 -0
- data/bin/line_edit +56 -0
- data/bin/page_create +51 -0
- data/bin/region_edit +55 -0
- data/bin/setup +8 -0
- data/lib/ruby_pager/application_logger.rb +15 -0
- data/lib/ruby_pager/coord.rb +50 -0
- data/lib/ruby_pager/coords.rb +81 -0
- data/lib/ruby_pager/extendmatrix2.rb +138 -0
- data/lib/ruby_pager/gaussian_noise.rb +36 -0
- data/lib/ruby_pager/histogram.rb +102 -0
- data/lib/ruby_pager/image.rb +338 -0
- data/lib/ruby_pager/image_data.rb +53 -0
- data/lib/ruby_pager/intersect.rb +33 -0
- data/lib/ruby_pager/metadata.rb +56 -0
- data/lib/ruby_pager/page.rb +167 -0
- data/lib/ruby_pager/reading_order.rb +18 -0
- data/lib/ruby_pager/text_line.rb +72 -0
- data/lib/ruby_pager/text_region.rb +130 -0
- data/lib/ruby_pager/version.rb +3 -0
- data/lib/ruby_pager/xml.rb +90 -0
- data/lib/ruby_pager.rb +18 -0
- data/no_lines.xml +14 -0
- data/no_regions.xml +11 -0
- data/one_line.xml +21 -0
- data/ruby_pager.gemspec +45 -0
- data/test.jpg +0 -0
- data/test.xml +281 -0
- metadata +286 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 566196f2bc296b888b46cd0baabe7fe68bad959c
|
4
|
+
data.tar.gz: 521a72d4e29ef85804d570c65d439e692582b4fd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 26596873ba0ee11e2b936651e8b85d1a2f633ef92fe3da10d566bcc15171fc6170756321af571aa15dbe28490aeaf75316134b34c899bd83b3e45fe6278814a1
|
7
|
+
data.tar.gz: 4a950ddd5b7aa7bce25a42cbebb3b26e846d2a9f17af2633fbaffb1fdfb2a7aefc85effed5f7ead953c9249cdd6e7d43f23324e19d5216f08b56c28cc97df921
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/ruby_pager.iml" filepath="$PROJECT_DIR$/.idea/ruby_pager.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
8
|
+
<orderEntry type="jdk" jdkName="ruby-2.3.3-p222 (1)" jdkType="RUBY_SDK" />
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="aruba (v0.14.3, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="atk (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.8.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="backports (v3.11.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="cairo (v1.15.11, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="cairo-gobject (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="childprocess (v0.8.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.2, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="contracts (v0.16.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="cucumber (v3.1.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="cucumber-core (v3.1.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="cucumber-expressions (v5.0.13, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="cucumber-tag_expressions (v1.1.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="cucumber-wire (v0.0.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.1.5, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="extendmatrix (v0.4, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.18, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="gdk3 (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="gdk_pixbuf2 (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="gherkin (v5.0.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="gio2 (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="glib2 (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="gobject-introspection (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="gtk3 (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.1.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.3.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.13.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_test (v0.1.2, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="native-package-installer (v1.0.6, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.8.2, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="nori (v2.6.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="pango (v3.2.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="pkg-config (v1.2.9, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="pry (v0.11.3, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="rmagick (v2.16.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.7.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.7.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.7.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.7.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.7.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.15.1, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.10.2, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v0.20.0, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
58
|
+
<orderEntry type="library" scope="PROVIDED" name="trollop (v2.1.2, ruby-2.3.3-p222 (1)) [gem]" level="application" />
|
59
|
+
</component>
|
60
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at TODO: Write your email address. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ruby_pager (0.1.0)
|
5
|
+
awesome_print
|
6
|
+
extendmatrix
|
7
|
+
gosu
|
8
|
+
nokogiri
|
9
|
+
nori
|
10
|
+
pry
|
11
|
+
rgeo
|
12
|
+
rmagick
|
13
|
+
trollop
|
14
|
+
|
15
|
+
GEM
|
16
|
+
remote: https://rubygems.org/
|
17
|
+
specs:
|
18
|
+
aruba (0.14.6)
|
19
|
+
childprocess (>= 0.6.3, < 0.10.0)
|
20
|
+
contracts (~> 0.9)
|
21
|
+
cucumber (>= 1.3.19)
|
22
|
+
ffi (~> 1.9.10)
|
23
|
+
rspec-expectations (>= 2.99)
|
24
|
+
thor (~> 0.19)
|
25
|
+
awesome_print (1.8.0)
|
26
|
+
backports (3.11.3)
|
27
|
+
builder (3.2.3)
|
28
|
+
childprocess (0.9.0)
|
29
|
+
ffi (~> 1.0, >= 1.0.11)
|
30
|
+
coderay (1.1.2)
|
31
|
+
contracts (0.16.0)
|
32
|
+
cucumber (3.1.2)
|
33
|
+
builder (>= 2.1.2)
|
34
|
+
cucumber-core (~> 3.2.0)
|
35
|
+
cucumber-expressions (~> 6.0.1)
|
36
|
+
cucumber-wire (~> 0.0.1)
|
37
|
+
diff-lcs (~> 1.3)
|
38
|
+
gherkin (~> 5.1.0)
|
39
|
+
multi_json (>= 1.7.5, < 2.0)
|
40
|
+
multi_test (>= 0.1.2)
|
41
|
+
cucumber-core (3.2.0)
|
42
|
+
backports (>= 3.8.0)
|
43
|
+
cucumber-tag_expressions (~> 1.1.0)
|
44
|
+
gherkin (>= 5.0.0)
|
45
|
+
cucumber-expressions (6.0.1)
|
46
|
+
cucumber-tag_expressions (1.1.1)
|
47
|
+
cucumber-wire (0.0.1)
|
48
|
+
diff-lcs (1.3)
|
49
|
+
docile (1.3.1)
|
50
|
+
extendmatrix (0.4)
|
51
|
+
ffi (1.9.25)
|
52
|
+
gherkin (5.1.0)
|
53
|
+
gosu (0.13.3)
|
54
|
+
json (2.1.0)
|
55
|
+
method_source (0.9.0)
|
56
|
+
mini_portile2 (2.3.0)
|
57
|
+
multi_json (1.13.1)
|
58
|
+
multi_test (0.1.2)
|
59
|
+
nokogiri (1.8.4)
|
60
|
+
mini_portile2 (~> 2.3.0)
|
61
|
+
nori (2.6.0)
|
62
|
+
pry (0.11.3)
|
63
|
+
coderay (~> 1.1.0)
|
64
|
+
method_source (~> 0.9.0)
|
65
|
+
rake (12.3.1)
|
66
|
+
rgeo (1.1.1)
|
67
|
+
rmagick (2.16.0)
|
68
|
+
rspec (3.8.0)
|
69
|
+
rspec-core (~> 3.8.0)
|
70
|
+
rspec-expectations (~> 3.8.0)
|
71
|
+
rspec-mocks (~> 3.8.0)
|
72
|
+
rspec-core (3.8.0)
|
73
|
+
rspec-support (~> 3.8.0)
|
74
|
+
rspec-expectations (3.8.1)
|
75
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
76
|
+
rspec-support (~> 3.8.0)
|
77
|
+
rspec-mocks (3.8.0)
|
78
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
+
rspec-support (~> 3.8.0)
|
80
|
+
rspec-support (3.8.0)
|
81
|
+
simplecov (0.16.1)
|
82
|
+
docile (~> 1.1)
|
83
|
+
json (>= 1.8, < 3)
|
84
|
+
simplecov-html (~> 0.10.0)
|
85
|
+
simplecov-html (0.10.2)
|
86
|
+
thor (0.20.0)
|
87
|
+
trollop (2.1.3)
|
88
|
+
|
89
|
+
PLATFORMS
|
90
|
+
ruby
|
91
|
+
|
92
|
+
DEPENDENCIES
|
93
|
+
aruba
|
94
|
+
bundler
|
95
|
+
rake
|
96
|
+
rspec
|
97
|
+
ruby_pager!
|
98
|
+
simplecov
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# RubyPager
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruby_pager`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ruby_pager'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ruby_pager
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruby_pager. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the RubyPager project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ruby_pager/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/TODO.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
https://github.com/cedlemo/ruby-gtk3-tutorial
|
3
|
+
http://iridakos.com/tutorials/2018/01/25/creating-a-gtk-todo-application-with-ruby
|
4
|
+
http://bundler.io/v1.12/guides/creating_gem.html
|
5
|
+
https://relishapp.com/rspec/rspec-expectations/v/3-7/docs/built-in-matchers
|
6
|
+
|
7
|
+
CALCULATIONS: RGEO
|
8
|
+
http://daniel-azuma.com/articles/georails/part-3i -->Rgeo
|
9
|
+
|
10
|
+
INTERFACE: GOSU
|
11
|
+
https://github.com/gosu/gosu-examples
|
12
|
+
https://github.com/gosu/gosu/wiki/Getting-Started-on-Linux
|
13
|
+
https://github.com/gosu/gosu/wiki/Ruby-Tutorial
|
14
|
+
|
data/bin/baseline_noise
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby_pager"
|
5
|
+
#require_relative "../lib/ruby_pager.rb"
|
6
|
+
require "trollop"
|
7
|
+
require "ap"
|
8
|
+
|
9
|
+
|
10
|
+
opts = Trollop::options do
|
11
|
+
version "baseline_noise 0.0.1 (c) 2018 Vicente Bosch Campos"
|
12
|
+
banner <<-EOS
|
13
|
+
baseline_noise is a command tool that adds gaussian noise to each baseline point of each baseline present in the page document
|
14
|
+
Usage:
|
15
|
+
generate_htk_language_model [options]
|
16
|
+
where [options] are:
|
17
|
+
EOS
|
18
|
+
opt :mode ,"Three operation modes exist: ver (adds vertical noise), hor (adds horizontal noise) , all (adds both vertical and horizontal noise).", :type=> :string, :default => "ver"
|
19
|
+
opt :input_file, "page input file used as base for the region creation/edition/deletion", :type => :string, :default => "input.xml"
|
20
|
+
opt :output_file, "page output file where the updated xml page will be saved", :type => :string, :default => "output.xml"
|
21
|
+
opt :std_dev, "new label id of the region that is being edited", :type => :float, :default => 0.0
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
Trollop::die :mode, "Operation mode was not selected" unless opts[:mode]
|
26
|
+
Trollop::die :mode, "Operation mode selected must be either ver (vertical), hor (horizontal) or all (both vertical and horizontal)" unless opts[:mode]=="ver" or opts[:mode]=="hor" or opts[:mode]=="all"
|
27
|
+
Trollop::die :input_file, "Input page file name was not indicated" unless opts[:input_file]
|
28
|
+
Trollop::die :input_file, "Indicated input page file does not exist which is required" unless File.exist?(opts[:input_file])
|
29
|
+
Trollop::die :output_file, "Output page file name was not indicated" unless opts[:output_file]
|
30
|
+
Trollop::die :output_file, "Indicated output page file exists which will cause the command to overwrite it" if File.exist?(opts[:output_file])
|
31
|
+
Trollop::die :std_dev, "Standard deviation must be zero or a positive floating number" if opts[:std_dev]<0.0
|
32
|
+
|
33
|
+
input_page = RubyPager::Page.load_from_xml(opts[:input_file])
|
34
|
+
|
35
|
+
if opts[:mode]=="ver"
|
36
|
+
input_page.each_region{|region| region.baseline_vertical_noise(opts[:std_dev])}
|
37
|
+
elsif opts[:mode]=="hor"
|
38
|
+
puts "Horizontal option currently not developed"
|
39
|
+
else
|
40
|
+
puts "All option currently not developed"
|
41
|
+
end
|
42
|
+
|
43
|
+
input_page.save(opts[:output_file])
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby_pager"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/line_edit
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby_pager"
|
5
|
+
require "trollop"
|
6
|
+
require "ap"
|
7
|
+
|
8
|
+
|
9
|
+
opts = Trollop::options do
|
10
|
+
version "line_edit 0.0.1 (c) 2018 Vicente Bosch Campos"
|
11
|
+
banner <<-EOS
|
12
|
+
line_edit is a command tool that allows the creation,edition or deletion of text lines in a Page XML file
|
13
|
+
Usage:
|
14
|
+
generate_htk_language_model [options]
|
15
|
+
where [options] are:
|
16
|
+
EOS
|
17
|
+
opt :mode ,"Three operation modes exist: mk (creates a region), rm (removes a region as per region id provided) , ed (edit a region as per data provided).", :type=> :string, :default => "image"
|
18
|
+
opt :input_file, "page input file used as base for the region creation/edition/deletion", :type => :string, :default => "input.xml"
|
19
|
+
opt :output_file, "page output file where the updated xml page will be saved", :type => :string, :default => "output.xml"
|
20
|
+
opt :region_id, "label id of the region to be added, edited or deleted", :type => :string
|
21
|
+
opt :line_id, "label id of the region to be added, edited or deleted", :type => :string
|
22
|
+
opt :coords, "coords to be used in the addition of edition of a text region. Format: \"x1,y1 x2,y2 x3,y3...\" (quotation marks required)" , :type => :string
|
23
|
+
opt :new_label_id, "new label id of the region that is being edited", :type => :string
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
Trollop::die :mode, "Operation mode was not selected" unless opts[:mode]
|
28
|
+
Trollop::die :mode, "Operation mode selected must be either mk (make), rm (remove) or ed (edit)" unless opts[:mode]=="mk" or opts[:mode]=="rm" or opts[:mode]=="ed"
|
29
|
+
Trollop::die :input_file, "Input page file name was not indicated" unless opts[:input_file]
|
30
|
+
Trollop::die :input_file, "Indicated input page file does not exist which is required" unless File.exist?(opts[:input_file])
|
31
|
+
Trollop::die :output_file, "Output page file name was not indicated" unless opts[:output_file]
|
32
|
+
Trollop::die :output_file, "Indicated output page file exists which will cause the command to overwrite it" if File.exist?(opts[:output_file])
|
33
|
+
Trollop::die :label_id, "Label id of region to be added/edited/deleted was not specified" unless opts[:label_id]
|
34
|
+
Trollop::die :coords, "Region was selected to be addedd but no coordinates for the contour were provided" if opts[:mode]=="mk" and not opts[:coords]
|
35
|
+
|
36
|
+
input_page = RubyPager::Page.load_from_xml(opts[:input_file])
|
37
|
+
|
38
|
+
if opts[:mode]=="mk"
|
39
|
+
new_region=RubyPager::Text_Region.blank
|
40
|
+
new_region.id=opts[:label_id]
|
41
|
+
new_region.contour.reload(opts[:coords])
|
42
|
+
input_page.push(new_region)
|
43
|
+
elsif opts[:mode]=="rm"
|
44
|
+
if input_page.has_region? opts[:label_id]
|
45
|
+
input_page.delete opts[:label_id]
|
46
|
+
end
|
47
|
+
else
|
48
|
+
if input_page.has_region? opts[:label_id]
|
49
|
+
input_page[opts[:label_id]].contour.reload(opts[:coords]) if opts[:coords]
|
50
|
+
if opts[:new_label_id]
|
51
|
+
input_page[opts[:label_id]].id = opts[:new_label_id] unless input_page.has_region? opts[:new_label_id]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
input_page.save(opts[:output_file])
|
data/bin/page_create
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby_pager"
|
5
|
+
require "trollop"
|
6
|
+
require "ap"
|
7
|
+
|
8
|
+
|
9
|
+
opts = Trollop::options do
|
10
|
+
version "page_create 0.0.1 (c) 2018 Vicente Bosch Campos"
|
11
|
+
banner <<-EOS
|
12
|
+
page_create is a command tool that creates Page format xmls as per defined input
|
13
|
+
Usage:
|
14
|
+
generate_htk_language_model [options]
|
15
|
+
where [options] are:
|
16
|
+
EOS
|
17
|
+
opt :mode ,"operation mode for the page_create tool two modes exist data or image. Data creates a simple xml from the data provide while image takes the information from the image file", :type=> :string, :default => "image"
|
18
|
+
opt :image_file, "image file used to collect data (image mode) or just used to fill the image parameter in the xml (data mode)", :type => :string, :default => "input.jpg"
|
19
|
+
opt :output_file, "output file where the generated xml page will be saved", :type => :string, :default => "output.xml"
|
20
|
+
opt :creator, "name used to fill the creator parameter in the generated xml (image/page mode)", :type => :string, :default => "page_create"
|
21
|
+
opt :width, "Image width used for the xml generation and full region creation (data mode)", :type => :int , :default => 0
|
22
|
+
opt :height, "Image height used for the xml generation and full region creation (data mode)", :type => :int , :default => 0
|
23
|
+
opt :full, "Creates a full text region of the size of the image", :type=> :boolean , :default => false
|
24
|
+
opt :region_name, "Label to be used for the full text region created", :type=>:string, :default => "region_1"
|
25
|
+
end
|
26
|
+
|
27
|
+
Trollop::die :mode, "Operation mode was not selected" unless opts[:mode]
|
28
|
+
Trollop::die :mode, "Operation mode selected must be either data or image" unless opts[:mode]=="data" or opts[:mode]=="image"
|
29
|
+
Trollop::die :image_file, "Image file name was not indicated" unless opts[:image_file]
|
30
|
+
Trollop::die :image_file, "Indicated image file does not exist which is required in image mode" unless File.exist?(opts[:image_file]) or opts[:mode]=="data"
|
31
|
+
Trollop::die :creator, "Creator name was not indicated" unless opts[:creator]
|
32
|
+
Trollop::die :width, "Width parameter can not be a negative value" unless opts[:width] >= 0
|
33
|
+
Trollop::die :height, "Height parameter can not be a negative value" unless opts[:height] >= 0
|
34
|
+
Trollop::die :region_name, "Region name can't be empty if the creation of the full text region was selected" if opts[:full] and opts[:region_name].empty?
|
35
|
+
|
36
|
+
|
37
|
+
if opts[:mode] == "image"
|
38
|
+
img_page = RubyPager::Page.create_from_image(opts[:image_file])
|
39
|
+
img_page.metadata.creator=opts[:creator]
|
40
|
+
img_page.create_full_page_region(opts[:region_name]) if opts[:full]
|
41
|
+
img_page.save(opts[:output_file])
|
42
|
+
else
|
43
|
+
data_page = RubyPager::Page.blank(opts[:image_file])
|
44
|
+
data_page.metadata.creator=opts[:creator]
|
45
|
+
data_page.image_data.file_name=opts[:image_file]
|
46
|
+
data_page.image_data.width=opts[:width]
|
47
|
+
data_page.image_data.height=opts[:height]
|
48
|
+
data_page.create_full_page_region(opts[:region_name]) if opts[:full]
|
49
|
+
data_page.save(opts[:output_file])
|
50
|
+
|
51
|
+
end
|
data/bin/region_edit
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby_pager"
|
5
|
+
require "trollop"
|
6
|
+
require "ap"
|
7
|
+
|
8
|
+
|
9
|
+
opts = Trollop::options do
|
10
|
+
version "region_edit 0.0.1 (c) 2018 Vicente Bosch Campos"
|
11
|
+
banner <<-EOS
|
12
|
+
region_edit is a command tool that allows the creation,edition or deletion of text regions in a Page XML file
|
13
|
+
Usage:
|
14
|
+
generate_htk_language_model [options]
|
15
|
+
where [options] are:
|
16
|
+
EOS
|
17
|
+
opt :mode ,"Three operation modes exist: mk (creates a region), rm (removes a region as per region id provided) , ed (edit a region as per data provided).", :type=> :string, :default => "image"
|
18
|
+
opt :input_file, "page input file used as base for the region creation/edition/deletion", :type => :string, :default => "input.xml"
|
19
|
+
opt :output_file, "page output file where the updated xml page will be saved", :type => :string, :default => "output.xml"
|
20
|
+
opt :label_id, "label id of the region to be added, edited or deleted", :type => :string
|
21
|
+
opt :coords, "coords to be used in the addition of edition of a text region. Format: \"x1,y1 x2,y2 x3,y3...\" (quotation marks required)" , :type => :string
|
22
|
+
opt :new_label_id, "new label id of the region that is being edited", :type => :string
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
Trollop::die :mode, "Operation mode was not selected" unless opts[:mode]
|
27
|
+
Trollop::die :mode, "Operation mode selected must be either mk (make), rm (remove) or ed (edit)" unless opts[:mode]=="mk" or opts[:mode]=="rm" or opts[:mode]=="ed"
|
28
|
+
Trollop::die :input_file, "Input page file name was not indicated" unless opts[:input_file]
|
29
|
+
Trollop::die :input_file, "Indicated input page file does not exist which is required" unless File.exist?(opts[:input_file])
|
30
|
+
Trollop::die :output_file, "Output page file name was not indicated" unless opts[:output_file]
|
31
|
+
Trollop::die :output_file, "Indicated output page file exists which will cause the command to overwrite it" if File.exist?(opts[:output_file])
|
32
|
+
Trollop::die :label_id, "Label id of region to be added/edited/deleted was not specified" unless opts[:label_id]
|
33
|
+
Trollop::die :coords, "Region was selected to be addedd but no coordinates for the contour were provided" if opts[:mode]=="mk" and not opts[:coords]
|
34
|
+
|
35
|
+
input_page = RubyPager::Page.load_from_xml(opts[:input_file])
|
36
|
+
|
37
|
+
if opts[:mode]=="mk"
|
38
|
+
new_region=RubyPager::Text_Region.blank
|
39
|
+
new_region.id=opts[:label_id]
|
40
|
+
new_region.contour.reload(opts[:coords])
|
41
|
+
input_page.push(new_region)
|
42
|
+
elsif opts[:mode]=="rm"
|
43
|
+
if input_page.has_region? opts[:label_id]
|
44
|
+
input_page.delete opts[:label_id]
|
45
|
+
end
|
46
|
+
else
|
47
|
+
if input_page.has_region? opts[:label_id]
|
48
|
+
input_page[opts[:label_id]].contour.reload(opts[:coords]) if opts[:coords]
|
49
|
+
if opts[:new_label_id]
|
50
|
+
input_page[opts[:label_id]].id = opts[:new_label_id] unless input_page.has_region? opts[:new_label_id]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
input_page.save(opts[:output_file])
|