rsyntaxtree 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -1
- data/README.md +1 -1
- data/app.rb +1 -2
- data/bin/linktree.rb +20 -0
- data/config.ru +0 -1
- data/helpers/helpers.rb +0 -0
- data/lib/rsyntaxtree/imgutils.rb +1 -1
- data/lib/rsyntaxtree/tree_graph.rb +1 -1
- data/lib/rsyntaxtree/version.rb +1 -1
- data/lib/rsyntaxtree.rb +2 -6
- data/public/js/rsyntaxtree.js +5 -5
- data/rsyntaxtree.gemspec +0 -1
- data/views/index.haml +2 -3
- data/views/layout.haml +10 -10
- data/views/navbar.haml +1 -1
- metadata +35 -34
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9a15703d35fdf78cb04cc1feab0b566831258c73
|
4
|
+
data.tar.gz: 892261a1d4a749b2bc5dd90099f9390212971f97
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 74b42d05ac9a5350abb93978a296b99432cd485a09aa9427a83a276cfd49f91949d55e279cb931046b9bc5b5774a8938fa7e0e5cbf9e651095b1ed95187588a1
|
7
|
+
data.tar.gz: 8e3af22d82521d900cc583d963f851497ba040f72b5a0efcb637f743f76387ee8682ebbfa69e569bee6484ff9b15572d5b17265bc85484818262389eb4107620
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -41,7 +41,7 @@ For the command-line interface, type `$rsyntaxtree -h` after installation. Here'
|
|
41
41
|
|
42
42
|
Every branch or leaf of a tree must belong to a node. To create a node, place a label right next to the opening bracket. Arbitrary number of branches can follow with a preceding space.
|
43
43
|
|
44
|
-
There are several modes in which the
|
44
|
+
There are several modes in which the connectors between terminal nodes and their leaves are drawn differently (auto, triangle, bar, and nothing). In auto mode, a triangle is used if the leaf contains one or more spaces inside (i.e. if it’s a phrase), but if it contains no spaces (i.e. if it is just a word), a straight bar will be drawn instead (unless the leaf contains a "^" symbol at the end which makes it a single-word phrase).
|
45
45
|
|
46
46
|
You can put a subscript to any node by putting the _ character between the main label and the subscript. For example, NP_TOP will be rendered as NP<sub>TOP</sub>. Or you can select the “Auto subscript” option so that nodes of the same label will be automatically numbered. (e.g. NP<sub>1</sub>, NP<sub>2</sub>)</p>
|
47
47
|
|
data/app.rb
CHANGED
@@ -9,7 +9,7 @@ require './lib/rsyntaxtree'
|
|
9
9
|
|
10
10
|
include Helpers
|
11
11
|
|
12
|
-
set :public_folder, File.dirname(__FILE__) + '/public'
|
12
|
+
# set :public_folder, File.dirname(__FILE__) + '/public'
|
13
13
|
|
14
14
|
configure do
|
15
15
|
enable :sessions
|
@@ -54,4 +54,3 @@ post '/download_pdf' do
|
|
54
54
|
rs_generator = RSGenerator.new(params)
|
55
55
|
rs_generator.draw_pdf
|
56
56
|
end
|
57
|
-
|
data/bin/linktree.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'linkparser'
|
2
|
+
require 'rsyntaxtree'
|
3
|
+
|
4
|
+
dict = LinkParser::Dictionary.new
|
5
|
+
sent = dict.parse( "I wonder if Tom knows Jill sneezed her handkerchief off the table" )
|
6
|
+
sent.subject # => "people"
|
7
|
+
sent.verb # => "use"
|
8
|
+
sent.object # => "Ruby"
|
9
|
+
bracketed = sent.constituent_tree_string(2)
|
10
|
+
bracketed = bracketed.chomp.gsub(/ [A-Z]+\]/){"]"}
|
11
|
+
bracketed = bracketed.gsub(/VP (.+?) \[NP/) do |text|
|
12
|
+
"VP [V #{$1}] [NP"
|
13
|
+
end
|
14
|
+
|
15
|
+
p bracketed
|
16
|
+
opts = {}
|
17
|
+
opts["data"] = bracketed
|
18
|
+
rsg = RSGenerator.new(opts)
|
19
|
+
outfile = File.new(File.expand_path("~/Desktop/test.png"), "wb")
|
20
|
+
outfile.write rsg.draw_png
|
data/config.ru
CHANGED
data/helpers/helpers.rb
CHANGED
File without changes
|
data/lib/rsyntaxtree/imgutils.rb
CHANGED
data/lib/rsyntaxtree/version.rb
CHANGED
data/lib/rsyntaxtree.rb
CHANGED
@@ -109,12 +109,7 @@ class RSGenerator
|
|
109
109
|
@params["format"] = "pdf"
|
110
110
|
draw_tree
|
111
111
|
end
|
112
|
-
|
113
|
-
def draw_svg
|
114
|
-
@params["format"] = "svg"
|
115
|
-
draw_svg
|
116
|
-
end
|
117
|
-
|
112
|
+
|
118
113
|
def draw_tree
|
119
114
|
sp = StringParser.new(@params["data"])
|
120
115
|
sp.parse
|
@@ -126,6 +121,7 @@ class RSGenerator
|
|
126
121
|
end
|
127
122
|
|
128
123
|
def draw_svg
|
124
|
+
@params["format"] = "svg"
|
129
125
|
sp = StringParser.new(@params["data"].gsub('&', '&'))
|
130
126
|
sp.parse
|
131
127
|
sp.auto_subscript if @params["autosub"]
|
data/public/js/rsyntaxtree.js
CHANGED
@@ -18,7 +18,7 @@ $(function(){
|
|
18
18
|
|
19
19
|
function draw_graph(data){
|
20
20
|
$.ajax({
|
21
|
-
url: 'draw_png',
|
21
|
+
url: '/draw_png',
|
22
22
|
type: 'POST',
|
23
23
|
data: make_params(data),
|
24
24
|
success: function (raw_data) {
|
@@ -55,7 +55,7 @@ $(function(){
|
|
55
55
|
data = escape_chrs(data);
|
56
56
|
$.ajax({
|
57
57
|
type: "POST",
|
58
|
-
url:"check",
|
58
|
+
url:"/check",
|
59
59
|
data:"data=" + data,
|
60
60
|
success: function(msg){
|
61
61
|
if(msg != "true"){
|
@@ -73,7 +73,7 @@ $(function(){
|
|
73
73
|
data = escape_chrs(data);
|
74
74
|
$.ajax({
|
75
75
|
type: "POST",
|
76
|
-
url:"check",
|
76
|
+
url:"/check",
|
77
77
|
data:"data=" + data,
|
78
78
|
success: function(msg){
|
79
79
|
if(msg != "true"){
|
@@ -92,7 +92,7 @@ $(function(){
|
|
92
92
|
data = escape_chrs(data);
|
93
93
|
$.ajax({
|
94
94
|
type: "POST",
|
95
|
-
url:"check",
|
95
|
+
url:"/check",
|
96
96
|
data:"data=" + data,
|
97
97
|
success: function(msg){
|
98
98
|
if(msg != "true"){
|
@@ -108,7 +108,7 @@ $(function(){
|
|
108
108
|
$("#check").click(function(){
|
109
109
|
$.ajax({
|
110
110
|
type: "POST",
|
111
|
-
url:"check",
|
111
|
+
url:"/check",
|
112
112
|
data:"data=" + escape_chrs($("#data").val()),
|
113
113
|
success: function(msg){
|
114
114
|
if(msg == "true"){
|
data/rsyntaxtree.gemspec
CHANGED
data/views/index.haml
CHANGED
@@ -28,7 +28,6 @@
|
|
28
28
|
%option{:value => "jp-gothic"}JP-Gothic
|
29
29
|
%option{:value => "jp-mincho"}JP-Mincho
|
30
30
|
%option{:value => "cjk"}CJK
|
31
|
-
%option{:value => "cjk"}CJK
|
32
31
|
%option{:value => "aru"}ARU
|
33
32
|
%option{:value => "tnr"}TNR
|
34
33
|
.span2
|
@@ -114,7 +113,7 @@
|
|
114
113
|
preceding space.
|
115
114
|
|
116
115
|
%p
|
117
|
-
There are several modes in which the
|
116
|
+
There are several modes in which the connectors between terminal nodes and their leaves are
|
118
117
|
drawn differently (auto, triangle, bar, and nothing). In auto mode, a triangle is used if the leaf
|
119
118
|
contains one or more spaces inside (i.e. if it’s a phrase), but if it contains no spaces (i.e. if
|
120
119
|
it is just a word), a straight bar will be drawn instead (unless the leaf contains a "^" symbol at the end
|
@@ -127,7 +126,7 @@
|
|
127
126
|
label will be automatically numbered. (e.g. NP<sub>1</sub>, NP<sub>2</sub>)</p>
|
128
127
|
|
129
128
|
%p
|
130
|
-
RSyntaxTree is
|
129
|
+
RSyntaxTree is capable of generating PNG, PDF and SVG files. SVG is very convenient
|
131
130
|
for those who want to modify output images on third party vector graphic software
|
132
131
|
(such as Adobe Illustrator and Microsoft Visio).
|
133
132
|
|
data/views/layout.haml
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
%meta{:name => "description", :content => ""}
|
7
7
|
%meta{:name => "author", :content => ""}
|
8
8
|
|
9
|
-
%link{ :href => "bootstrap/css/bootstrap.css", :type => "text/css", :rel => "stylesheet" }
|
9
|
+
%link{ :href => "/bootstrap/css/bootstrap.css", :type => "text/css", :rel => "stylesheet" }
|
10
10
|
|
11
11
|
:plain
|
12
12
|
<style type="text/css">
|
@@ -16,8 +16,8 @@
|
|
16
16
|
}
|
17
17
|
</style>
|
18
18
|
|
19
|
-
%link{ :href => "bootstrap/css/bootstrap-responsive.css", :type => "text/css", :rel => "stylesheet" }
|
20
|
-
%link{ :href => "css/rsyntaxtree.css", :type => "text/css", :rel => "stylesheet" }
|
19
|
+
%link{ :href => "/bootstrap/css/bootstrap-responsive.css", :type => "text/css", :rel => "stylesheet" }
|
20
|
+
%link{ :href => "/css/rsyntaxtree.css", :type => "text/css", :rel => "stylesheet" }
|
21
21
|
|
22
22
|
:plain
|
23
23
|
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
@@ -26,16 +26,16 @@
|
|
26
26
|
<![endif]-->
|
27
27
|
|
28
28
|
/ Le fav and touch icons
|
29
|
-
%link{ rel: "apple-touch-icon", href: "bootstrap/images/apple-touch-icon.png"}
|
30
|
-
%link{ rel: "shortcut icon", href: "bootstrap/images/favicon.ico"}
|
31
|
-
%link{ rel: "apple-touch-icon", sizes: "72x72", href: "bootstrap/images/apple-touch-icon-72x72.png"}
|
32
|
-
%link{ rel: "apple-touch-icon", sizes: "114x114", href: "bootstrap/images/apple-touch-icon-114x114.png"}
|
29
|
+
%link{ rel: "apple-touch-icon", href: "/bootstrap/images/apple-touch-icon.png"}
|
30
|
+
%link{ rel: "shortcut icon", href: "/bootstrap/images/favicon.ico"}
|
31
|
+
%link{ rel: "apple-touch-icon", sizes: "72x72", href: "/bootstrap/images/apple-touch-icon-72x72.png"}
|
32
|
+
%link{ rel: "apple-touch-icon", sizes: "114x114", href: "/bootstrap/images/apple-touch-icon-114x114.png"}
|
33
33
|
|
34
34
|
%body
|
35
35
|
%div= haml :navbar
|
36
36
|
%div= yield
|
37
37
|
|
38
38
|
/ Placed at the end of the document so the pages load faster
|
39
|
-
%script{ :type => "text/javascript", :src =>"bootstrap/js/jquery.js"}
|
40
|
-
%script{ :type => "text/javascript", :src =>"bootstrap/js/bootstrap.js"}
|
41
|
-
%script{ :type => "text/javascript", :src =>"js/rsyntaxtree.js"}
|
39
|
+
%script{ :type => "text/javascript", :src =>"/bootstrap/js/jquery.js"}
|
40
|
+
%script{ :type => "text/javascript", :src =>"/bootstrap/js/bootstrap.js"}
|
41
|
+
%script{ :type => "text/javascript", :src =>"/js/rsyntaxtree.js"}
|
data/views/navbar.haml
CHANGED
metadata
CHANGED
@@ -1,84 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsyntaxtree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Yoichiro Hasebe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rmagick
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: sinatra
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: haml
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - ">="
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '0'
|
44
48
|
type: :runtime
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: shotgun
|
49
|
-
requirement: &70313691228640 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *70313691228640
|
58
55
|
- !ruby/object:Gem::Dependency
|
59
56
|
name: trollop
|
60
|
-
requirement:
|
61
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
62
58
|
requirements:
|
63
|
-
- -
|
59
|
+
- - ">="
|
64
60
|
- !ruby/object:Gem::Version
|
65
61
|
version: '0'
|
66
62
|
type: :runtime
|
67
63
|
prerelease: false
|
68
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
69
|
description: Yet another syntax tree generator made with Ruby and RMagick
|
70
70
|
email:
|
71
71
|
- yohasebe@gmail.com
|
72
72
|
executables:
|
73
|
+
- linktree.rb
|
73
74
|
- rsyntaxtree
|
74
75
|
extensions: []
|
75
76
|
extra_rdoc_files: []
|
76
77
|
files:
|
77
|
-
- .gitignore
|
78
|
+
- ".gitignore"
|
78
79
|
- Gemfile
|
79
80
|
- README.md
|
80
81
|
- Rakefile
|
81
82
|
- app.rb
|
83
|
+
- bin/linktree.rb
|
82
84
|
- bin/rsyntaxtree
|
83
85
|
- config.ru
|
84
86
|
- fonts/DroidSans.ttf
|
@@ -114,26 +116,25 @@ files:
|
|
114
116
|
- views/navbar.haml
|
115
117
|
homepage: http://github.com/yohasebe/rsyntaxtree
|
116
118
|
licenses: []
|
119
|
+
metadata: {}
|
117
120
|
post_install_message:
|
118
121
|
rdoc_options: []
|
119
122
|
require_paths:
|
120
123
|
- lib
|
121
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
125
|
requirements:
|
124
|
-
- -
|
126
|
+
- - ">="
|
125
127
|
- !ruby/object:Gem::Version
|
126
128
|
version: '0'
|
127
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
130
|
requirements:
|
130
|
-
- -
|
131
|
+
- - ">="
|
131
132
|
- !ruby/object:Gem::Version
|
132
133
|
version: '0'
|
133
134
|
requirements: []
|
134
135
|
rubyforge_project: rsyntaxtree
|
135
|
-
rubygems_version:
|
136
|
+
rubygems_version: 2.4.4
|
136
137
|
signing_key:
|
137
|
-
specification_version:
|
138
|
+
specification_version: 4
|
138
139
|
summary: RSyntaxTree is a graphical syntax tree generator written in Ruby
|
139
140
|
test_files: []
|