Clone Doc to never merge punctuation on original Doc

This commit is contained in:
ines 2017-06-03 13:24:43 +02:00
parent c60431357d
commit 70fbba7d08
1 changed files with 2 additions and 1 deletions

View File

@ -65,12 +65,13 @@ def app(environ, start_response):
return [res]
def parse_deps(doc, options={}):
def parse_deps(orig_doc, options={}):
"""Generate dependency parse in {'words': [], 'arcs': []} format.
doc (Doc): Document do parse.
RETURNS (dict): Generated dependency parse keyed by words and arcs.
"""
doc = Doc(orig_doc.vocab).from_bytes(orig_doc.to_bytes())
if options.get('collapse_punct', True):
spans = []
for word in doc[:-1]: