Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nltk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
nltk
Commits
c8266298
Commit
c8266298
authored
Sep 07, 2014
by
Steven Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed incorrect tree initialization, now uses fromstring
parent
2905533c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
nltk/draw/tree.py
+4
-4
No files found.
nltk/draw/tree.py
View file @
c8266298
...
@@ -877,7 +877,7 @@ def demo():
...
@@ -877,7 +877,7 @@ def demo():
cf
=
CanvasFrame
(
width
=
550
,
height
=
450
,
closeenough
=
2
)
cf
=
CanvasFrame
(
width
=
550
,
height
=
450
,
closeenough
=
2
)
t
=
Tree
(
'''
t
=
Tree
.
fromstring
(
'''
(S (NP the very big cat)
(S (NP the very big cat)
(VP (Adv sorta) (V saw) (NP (Det the) (N dog))))'''
)
(VP (Adv sorta) (V saw) (NP (Det the) (N dog))))'''
)
...
@@ -896,7 +896,7 @@ def demo():
...
@@ -896,7 +896,7 @@ def demo():
return
OvalWidget
(
canvas
,
TextWidget
(
canvas
,
text
),
return
OvalWidget
(
canvas
,
TextWidget
(
canvas
,
text
),
fill
=
'cyan'
)
fill
=
'cyan'
)
treetok
=
Tree
(
'(S (NP this tree) (VP (V is) (AdjP shapeable)))'
)
treetok
=
Tree
.
fromstring
(
'(S (NP this tree) (VP (V is) (AdjP shapeable)))'
)
tc2
=
TreeWidget
(
cf
.
canvas
(),
treetok
,
boxit
,
ovalit
,
shapeable
=
1
)
tc2
=
TreeWidget
(
cf
.
canvas
(),
treetok
,
boxit
,
ovalit
,
shapeable
=
1
)
def
color
(
node
):
def
color
(
node
):
...
@@ -914,7 +914,7 @@ def demo():
...
@@ -914,7 +914,7 @@ def demo():
paren
=
ParenWidget
(
cf
.
canvas
(),
tc2
)
paren
=
ParenWidget
(
cf
.
canvas
(),
tc2
)
cf
.
add_widget
(
paren
,
tc
.
bbox
()[
2
]
+
10
,
10
)
cf
.
add_widget
(
paren
,
tc
.
bbox
()[
2
]
+
10
,
10
)
tree3
=
Tree
(
'''
tree3
=
Tree
.
fromstring
(
'''
(S (NP this tree) (AUX was)
(S (NP this tree) (AUX was)
(VP (V built) (PP (P with) (NP (N tree_to_treesegment)))))'''
)
(VP (V built) (PP (P with) (NP (N tree_to_treesegment)))))'''
)
tc3
=
tree_to_treesegment
(
cf
.
canvas
(),
tree3
,
tree_color
=
'green4'
,
tc3
=
tree_to_treesegment
(
cf
.
canvas
(),
tree3
,
tree_color
=
'green4'
,
...
@@ -949,7 +949,7 @@ built from tree_to_treesegment."""
...
@@ -949,7 +949,7 @@ built from tree_to_treesegment."""
textbox
=
BoxWidget
(
cf
.
canvas
(),
twidget
,
fill
=
'white'
,
draggable
=
1
)
textbox
=
BoxWidget
(
cf
.
canvas
(),
twidget
,
fill
=
'white'
,
draggable
=
1
)
cf
.
add_widget
(
textbox
,
tc3
.
bbox
()[
2
]
+
10
,
tc2
.
bbox
()[
3
]
+
10
)
cf
.
add_widget
(
textbox
,
tc3
.
bbox
()[
2
]
+
10
,
tc2
.
bbox
()[
3
]
+
10
)
tree4
=
Tree
(
'(S (NP this tree) (VP (V is) (Adj horizontal)))'
)
tree4
=
Tree
.
fromstring
(
'(S (NP this tree) (VP (V is) (Adj horizontal)))'
)
tc4
=
TreeWidget
(
cf
.
canvas
(),
tree4
,
draggable
=
1
,
tc4
=
TreeWidget
(
cf
.
canvas
(),
tree4
,
draggable
=
1
,
line_color
=
'brown2'
,
roof_color
=
'brown2'
,
line_color
=
'brown2'
,
roof_color
=
'brown2'
,
node_font
=
(
'helvetica'
,
-
12
,
'bold'
),
node_font
=
(
'helvetica'
,
-
12
,
'bold'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment