Skip to content

Commit

Permalink
Use str.strip()
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonMaxfield committed Feb 17, 2022
1 parent 4771d37 commit b5babdc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions cdp_backend/utils/string_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ def clean_text(
# Remove gaps in string
try:
cleaned_doc = re.sub(r" {2,}", " ", cleaned_text)
if cleaned_doc[0] == " ":
cleaned_doc = cleaned_doc[1:]
if cleaned_doc[-1] == " ":
cleaned_doc = cleaned_doc[:-1]
cleaned_doc = cleaned_doc.strip()

# IndexError occurs when the string was cleaned and it contained entirely stop
# words or punctuation for some reason
Expand Down

0 comments on commit b5babdc

Please sign in to comment.