mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-14 18:40:33 +03:00
Fix parser test
This commit is contained in:
parent
a78427d640
commit
c09019aa8d
|
@ -17,13 +17,13 @@ def get_sequence_costs(M, words, heads, deps, transitions):
|
||||||
gold = golds[0]
|
gold = golds[0]
|
||||||
cost_history = []
|
cost_history = []
|
||||||
for gold_action in transitions:
|
for gold_action in transitions:
|
||||||
|
gold.update(state)
|
||||||
state_costs = {}
|
state_costs = {}
|
||||||
for i in range(M.n_moves):
|
for i in range(M.n_moves):
|
||||||
name = M.class_name(i)
|
name = M.class_name(i)
|
||||||
state_costs[name] = M.get_cost(state, gold, i)
|
state_costs[name] = M.get_cost(state, gold, i)
|
||||||
M.transition(state, gold_action)
|
M.transition(state, gold_action)
|
||||||
cost_history.append(state_costs)
|
cost_history.append(state_costs)
|
||||||
gold.update(state)
|
|
||||||
return state, cost_history
|
return state, cost_history
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ def test_oracle_four_words(arc_eager, vocab):
|
||||||
assert state_costs[actions[i]] == 0.0, actions[i]
|
assert state_costs[actions[i]] == 0.0, actions[i]
|
||||||
for other_action, cost in state_costs.items():
|
for other_action, cost in state_costs.items():
|
||||||
if other_action != actions[i]:
|
if other_action != actions[i]:
|
||||||
assert cost >= 1
|
assert cost >= 1, (i, other_action)
|
||||||
|
|
||||||
|
|
||||||
annot_tuples = [
|
annot_tuples = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user