Skip to content

Commit

Permalink
fix possible error on empty sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeronymous committed Apr 25, 2023
1 parent 24f581d commit def5330
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.1.1
- Fix error on empty sentences

# 1.1.0
- Added service registration
- Updated README
Expand All @@ -11,4 +14,4 @@

# 1.0.0
- Punctuation service.
- HTTP or Celery serving.
- HTTP or Celery serving.
4 changes: 3 additions & 1 deletion celery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def punctuation_task(self, text: Union[str, list]):
else:
print("Failed to predict punctuation on sentence: >{sentence}<")
punctuated_sentence = sentence
punctuated_sentence = punctuated_sentence[0].upper() + punctuated_sentence[1:]
# First letter in capital
if len(punctuated_sentence):
punctuated_sentence = punctuated_sentence[0].upper() + punctuated_sentence[1:]
punctuated_sentences.append(punctuated_sentence)

return (
Expand Down
7 changes: 4 additions & 3 deletions http_server/ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ def punctuate():
if result.status_code == 200:
punctuated_sentence = result.text
# First letter in capital
punctuated_sentence = (
punctuated_sentence[0].upper() + punctuated_sentence[1:]
)
if len(punctuated_sentence):
punctuated_sentence = (
punctuated_sentence[0].upper() + punctuated_sentence[1:]
)
punctuated_sentences.append(punctuated_sentence)
else:
raise Exception(result.text)
Expand Down

0 comments on commit def5330

Please sign in to comment.