Skip to content

Commit

Permalink
fixed tokens in the DRG png
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriobasile committed Jan 22, 2014
1 parent c96580b commit 72cddc6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
16 changes: 1 addition & 15 deletions drg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@
from unboxer.drg import DRGParser
import pygraphviz

def normalize_node_name(name):
return name
components = name.split(":")
if len(components)==1:
return name
elif len(components)==2:
return components[1]
elif len(components)==3:
if "(" in name:
return components[2]
else:
return components[1]
return name

def node_color(node):
color = "white"
if node.type == "discourse_unit":
Expand Down Expand Up @@ -48,7 +34,7 @@ def png(drg, pngfile):
taillabel = "%s" % tup.token_index
else:
taillabel = ""

if len(tup.tokens) > 0:
headlabel = "\\n\"%s\"" % " ".join(tup.tokens)
else:
Expand Down
3 changes: 1 addition & 2 deletions unboxer/drg.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ def parse_tup_lines(self, lines, debug=False):
# object representing an edge
def parse_tup_line(self, line, debug):
tup = DRGTuple()
fields = line[:-1].decode("utf-8").split()

fields = line.decode("utf-8").split()
tup.edge_type = u"{0}".format(fields[1].split("-")[0])

if self.drg.get_node_by_name(fields[0]) == None:
Expand Down

0 comments on commit 72cddc6

Please sign in to comment.