span / noun chunk has +1 because end is exclusive

This commit is contained in:
svlandeg 2020-05-21 19:56:56 +02:00
parent 84d5b7ad0a
commit 51715b9f72
7 changed files with 15 additions and 15 deletions

View File

@ -36,12 +36,12 @@ def noun_chunks(doclike):
# check for patterns such as γραμμή παραγωγής
for potential_nmod in word.rights:
if potential_nmod.dep == nmod:
prev_end = potential_nmod.i + 1
prev_end = potential_nmod.i
yield word.left_edge.i, potential_nmod.i + 1, np_label
flag = True
break
if flag is False:
prev_end = word.i + 1
prev_end = word.i
yield word.left_edge.i, word.i + 1, np_label
elif word.dep == conj:
# covers the case: έχει όμορφα και έξυπνα παιδιά
@ -50,7 +50,7 @@ def noun_chunks(doclike):
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.i + 1
prev_end = word.i
yield word.left_edge.i, word.i + 1, np_label

View File

@ -36,7 +36,7 @@ def noun_chunks(doclike):
if word.left_edge.i <= prev_end:
continue
if word.dep in np_deps:
prev_end = word.i + 1
prev_end = word.i
yield word.left_edge.i, word.i + 1, np_label
elif word.dep == conj:
head = word.head
@ -44,7 +44,7 @@ def noun_chunks(doclike):
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.i + 1
prev_end = word.i
yield word.left_edge.i, word.i + 1, np_label

View File

@ -36,7 +36,7 @@ def noun_chunks(doclike):
if word.left_edge.i <= prev_end:
continue
if word.dep in np_deps:
prev_end = word.i + 1
prev_end = word.i
yield word.left_edge.i, word.i + 1, np_label
elif word.dep == conj:
head = word.head
@ -44,7 +44,7 @@ def noun_chunks(doclike):
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.i + 1
prev_end = word.i
yield word.left_edge.i, word.i + 1, np_label

View File

@ -35,7 +35,7 @@ def noun_chunks(doclike):
if word.left_edge.i <= prev_end:
continue
if word.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label
elif word.dep == conj:
head = word.head
@ -43,7 +43,7 @@ def noun_chunks(doclike):
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label

View File

@ -35,7 +35,7 @@ def noun_chunks(doclike):
if word.left_edge.i <= prev_end:
continue
if word.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label
elif word.dep == conj:
head = word.head
@ -43,7 +43,7 @@ def noun_chunks(doclike):
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label

View File

@ -35,7 +35,7 @@ def noun_chunks(doclike):
if word.left_edge.i <= prev_end:
continue
if word.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label
elif word.dep == conj:
head = word.head
@ -43,7 +43,7 @@ def noun_chunks(doclike):
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label

View File

@ -36,7 +36,7 @@ def noun_chunks(doclike):
if word.left_edge.i <= prev_end:
continue
if word.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label
elif word.dep == conj:
head = word.head
@ -44,7 +44,7 @@ def noun_chunks(doclike):
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.right_edge.i + 1
prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label