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

GH-2972: Change output of .text to original string #2974

Merged
merged 3 commits into from
Oct 28, 2022

Conversation

alanakbik
Copy link
Collaborator

Closes #2972

The .text property of the Sentence and Span object currently print a whitespace tokenized version of the string. This PR changes this so that .text will print the untokenized string instead.

# make example sentence
sentence = Sentence("George   Washington was here")
print(sentence)

# get a span from the sentence and print its text
entity = sentence.get_span(0, 2)
print(entity)
print(entity.text)

This now prints:

Sentence: "George   Washington was here"
Span[0:2]: "George   Washington"
George   Washington

Before, it printed:

Sentence: "George Washington was here"
Span[0:2]: "George Washington"
George Washington

@alanakbik alanakbik merged commit d099d60 into master Oct 28, 2022
@alanakbik alanakbik deleted the GH-2972-print-original-text branch October 29, 2022 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get original text after tokenizer in flair 0.11
1 participant