mirror of https://github.com/explosion/spaCy.git
Clone Doc to never merge punctuation on original Doc
This commit is contained in:
parent
c60431357d
commit
70fbba7d08
|
@ -65,12 +65,13 @@ def app(environ, start_response):
|
||||||
return [res]
|
return [res]
|
||||||
|
|
||||||
|
|
||||||
def parse_deps(doc, options={}):
|
def parse_deps(orig_doc, options={}):
|
||||||
"""Generate dependency parse in {'words': [], 'arcs': []} format.
|
"""Generate dependency parse in {'words': [], 'arcs': []} format.
|
||||||
|
|
||||||
doc (Doc): Document do parse.
|
doc (Doc): Document do parse.
|
||||||
RETURNS (dict): Generated dependency parse keyed by words and arcs.
|
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):
|
if options.get('collapse_punct', True):
|
||||||
spans = []
|
spans = []
|
||||||
for word in doc[:-1]:
|
for word in doc[:-1]:
|
||||||
|
|
Loading…
Reference in New Issue