Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing whitespace is removed after parsing. #792

Closed
latkins opened this issue Jan 31, 2017 · 1 comment
Closed

Trailing whitespace is removed after parsing. #792

latkins opened this issue Jan 31, 2017 · 1 comment
Labels
bug Bugs and behaviour differing from documentation

Comments

@latkins
Copy link
Contributor

latkins commented Jan 31, 2017

There appears to be a bug when parsing a string:

import spacy

nlp = spacy.load('en')

text = "This is a string "
doc = nlp(text)
print(doc.text_with_ws)
print([token.text_with_ws for token in doc])
assert(doc.text_with_ws == text)

Gives

'This is a string'
['This ', 'is ', 'a ', 'string']

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-51-da27fad27bad> in <module>()
      5 print([t.text_with_ws for t in doc])
      6 
----> 7 assert(doc.text_with_ws == text)

AssertionError: 

Your Environment

  • Operating System: OSX 10.12.2

  • Python Version Used: 3.5

  • spaCy Version Used: 1.6.0

  • Environment Information:

@ines ines added the bug Bugs and behaviour differing from documentation label Jan 31, 2017
latkins added a commit to latkins/spaCy that referenced this issue Jan 31, 2017
ines added a commit that referenced this issue Jan 31, 2017
Added regression test for Issue #792.
@ines ines added this to the Debug parser transition system milestone Feb 18, 2017
@lock
Copy link

lock bot commented May 9, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation
Projects
None yet
Development

No branches or pull requests

2 participants