Skip to content

Commit 9a07f5c

Browse files
committed
Fixed another error in CompleteFullGraph class
1 parent 2494e39 commit 9a07f5c

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

modules/graphs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, tokens):
9090
self.heads[0].append(new_arc)
9191
for token1 in tokens:
9292
dependents = []
93-
for token2 in (token2 for token2 in tokens if token2.head == token1.id):
93+
for token2 in (token2 for token2 in tokens if token2.id != token1.id):
9494
new_arc = FullArc(token1.id, token2.id, token1.form, token2.form, token1.lemma, token2.lemma, \
9595
token1.pos, token2.pos, token2.rel)
9696
dependents.append(new_arc)

modules/token.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ def __init__(self, line):
1111
self.form = entries[1]
1212
self.lemma = entries[2]
1313
self.pos = entries[3]
14-
self.head = int(entries[6])
14+
if entries[6] == "_": # happens for test data, in that case it can't be 'integered'
15+
self.head = None
16+
else:
17+
self.head = int(entries[6])
1518
self.rel = entries[7].rstrip()
1619

1720
def sentences(file_stream):

start-cle.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ EVALUATIONS="evaluations"
1111
#python -u dependency-parser.py -train -i $CORPORA/train/wsj_train.first-5k.conll06 -m model -e 1 -decrease-alpha -shuffle-sentences
1212

1313
#train
14-
python -u dependency-parser.py -train -i ../dependency-parsing-files/data/english/train/wsj_train.conll06 -m $MODELS/m_e-10_da_ss -e 2 -decrease-alpha -shuffle-sentences
14+
#python -u dependency-parser.py -train -i ../dependency-parsing-files/data/english/train/wsj_train.conll06 -m $MODELS/m_e-10_da_ss -e 2 -decrease-alpha -shuffle-sentences
1515

1616
#test
17-
#python -u dependency-parser.py -test -i $CORPORA/dev/wsj_dev.conll06 -m model -o predicted.conll06
17+
python -u dependency-parser.py -test -i $CORPORA/dev/wsj_dev_wit.conll06 -m model -o predicted.conll06
1818
#python -u dependency-parser.py -test -i $CORPORA/train/wsj_train.conll06 -m $MODELS/m_e-10_da_ss -o predicted.conll06
1919

2020
#python -u dependency-parser.py -ev -i predicted.conll06 -g $CORPORA/dev/wsj_dev.conll06 -o evaluation_sentence.txt

start-cle_automated.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ EVALUATIONS="evaluations"
1010
#python -u dependency-parser.py -train -i ${CORPORA}/train/wsj_train.conll06 -m ${MODELS}/$2 -e $1 $5 $6
1111

1212
#test
13-
python -u dependency-parser.py -test -i ${CORPORA}/dev/wsj_dev.conll06 -m ${MODELS}/$2 -o ${PREDICTIONS}/$3".conll06"
13+
python -u dependency-parser.py -test -i ${CORPORA}/dev/wsj_dev_without_head.conll06 -m ${MODELS}/$2 -o ${PREDICTIONS}/$3".conll06"
1414

1515
# sentence based evaluation
1616
python -u dependency-parser.py -ev -i ${PREDICTIONS}/$3".conll06" -g ${CORPORA}/dev/wsj_dev.conll06 -o ${EVALUATIONS}/$4"_sentence".txt

0 commit comments

Comments
 (0)