Skip to content

Commit

Permalink
More debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
momandine committed Jul 18, 2013
1 parent 749ce93 commit cb27e1e
Show file tree
Hide file tree
Showing 9 changed files with 2,018 additions and 504 deletions.
23 changes: 18 additions & 5 deletions cky_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def get_max_of_all(i, j, sent, X, pg):
best = float("-inf")
Y = None
Z = None
best_right = float("-inf")
best_left = float("-inf")
LEFT = ''
RIGHT = ''

for rule in rule_possibilites:
for s in range(i, j):
Expand All @@ -54,14 +58,23 @@ def get_max_of_all(i, j, sent, X, pg):
right, p_right = cky_help(s+1, j, sent, z, pg)

prob = p_right + p_left + p_rule
#if i == 0 and j == len(sent) - 1:
# print y, z, p_rule, p_right, p_left


if i == 0 and j == len(sent) - 1:
print y, z, rule, p_rule, left, p_left, right, p_left

if best_left < p_left:
best_left = p_left
LEFT = left
if best_right < p_right:
best_right = p_right
RIGHT = right
if prob > best:
best = prob
Y = left
Z = right

if i == 0 and j == len(sent) - 1:
print "AND THE FINAL RESULTS ARE:"
print LEFT, best_left, RIGHT, best_right

return Y, Z, best

Expand All @@ -84,5 +97,5 @@ def write_trees(json_trees, dest_name):
dest.write('\n')

if __name__ == '__main__':
main(ProbGen('new.counts'), 'problem_sentences.dat', 'out_problem.dat')
main(ProbGen('new.counts'), 'problem_sentences.dat', 'problem_out.dat')

499 changes: 499 additions & 0 deletions latest_out.dat

Large diffs are not rendered by default.

998 changes: 499 additions & 499 deletions out_dev.dat

Large diffs are not rendered by default.

499 changes: 499 additions & 0 deletions out_leq.dat

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions out_problem.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["SBARQ", ["WHADVP+ADV", "Where"], ["SBARQ", ["SQ", ["VERB", "is"], ["SQ", ["NP", ["DET", "the"], ["NP", ["NP", ["NOUN", "massive"], ["NOUN", "North"]], ["PP", ["ADP", "Korean"], ["NP", ["NOUN", "nuclear"], ["NOUN", "complex"]]]]], ["VP+VERB", "located"]]], [".", "?"]]]
1 change: 1 addition & 0 deletions out_problems.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["S", ["NP", [".", null, null], ["NP+NOUN", "located"]], ["S", "?"]]
499 changes: 499 additions & 0 deletions out_sbarq.dat

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions problem_out.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["SBARQ", null, null]
1 change: 1 addition & 0 deletions problem_sentences.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
What are John C. Calhoun and Henry Clay known as ?

0 comments on commit cb27e1e

Please sign in to comment.