-
Notifications
You must be signed in to change notification settings - Fork 48
Laboratory work #4, Mashkovtseva Alesia - 22FPL2 #196
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to review today
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!!
Don't forget to remove unused code
lab_4_fill_words_by_ngrams/main.py
Outdated
@@ -28,6 +32,22 @@ def _tokenize(self, text: str) -> tuple[str, ...]: # type: ignore | |||
Raises: | |||
ValueError: In case of inappropriate type input argument or if input argument is empty. | |||
""" | |||
if not isinstance(text, str) or not text: | |||
raise ValueError('Type input is inappropriate or input argument is empty.') | |||
text = repr(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will need an explanation :)
lab_4_fill_words_by_ngrams/main.py
Outdated
for letter in word: | ||
if not result or (len(result) > 2 and result[-2] == '.'): | ||
result += letter.upper() | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we write it without else
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
lab_4_fill_words_by_ngrams/main.py
Outdated
elif generator_type == 1: | ||
self._generator = TopPGenerator(language_model, word_processor, 0.5) | ||
elif self._generator_type == 2: | ||
self._generator = BeamSearchTextGenerator(language_model, word_processor, 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use dictionary here? to avoid situations when it is not initialized due to wrong input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good!
There are some unaddressed comments though, answer them or react
Well done! Good job! |
No description provided.