Merge pull request #616 from TiagoMRodrigues/master

Make span.merge return Token
This commit is contained in:
Ines Montani 2016-11-09 20:04:39 +01:00 committed by GitHub
commit bad005f2b9
2 changed files with 8 additions and 1 deletions

View File

@ -52,6 +52,13 @@ def test_np_merges(EN):
merged = tokens.merge(start, end, label, lemma, label)
assert merged != None, (start, end, label, lemma)
tokens = EN(u'One test with entities like New York City so the ents list is not void')
for span in tokens.ents:
merged = span.merge()
assert merged != None, (span.start, span.end, span.label_, span.lemma_)
@pytest.mark.models
def test_entity_merge(EN):
tokens = EN(u'Stewart Lee is a stand up comedian who lives in England and loves Joe Pasquale.\n')

View File

@ -99,7 +99,7 @@ cdef class Span:
token (Token):
The newly merged token.
"""
self.doc.merge(self.start_char, self.end_char, *args, **attributes)
return self.doc.merge(self.start_char, self.end_char, *args, **attributes)
def similarity(self, other):
'''Make a semantic similarity estimate. The default estimate is cosine