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

fix tokenize whitespace issue (Issue #453) #471

Merged
merged 6 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions llmware/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,9 +795,15 @@ def __init__(self, lower_case=True, remove_punctuation=True, remove_stop_words=T
self.one_letter_removal = one_letter_removal

def tokenize(self, text):

# strip the whitespace from the beginning and end of the text so we can tokenize the data
text = text.strip()
# start with basic whitespace tokenizing,
#is there a reason the text is being split on one space only?
#text2 = text.split(" ")
# this line will split on whitespace regardless of tab or multispaces between words
text2 = text.split()

# start with basic whitespace tokenizing
text2 = text.split(" ")

if self.remove_punctuation:
text2 = Utilities().clean_list(text2)
Expand Down