This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Laboratory work #4, Tatiana Zheleznova - 22FPL2 #181
Closed
Closed
Changes from 91 commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
2ba3567
Добавила "Привет, мир!"
tanya-iron 5873a93
Merge branch 'fipl-hse:main' into main
artyomtugaryov 6722110
Merge branch 'fipl-hse:main' into main
artyomtugaryov 72ac755
Добавила задание на оценку 4(Шаг 1)
tanya-iron 4cd6517
Merge remote-tracking branch 'origin/main'
tanya-iron 5bf4ccc
Добавила задание на оценку 4(Шаг 1)
tanya-iron b252215
Добавила задание на оценку 4(Шаг 1)
tanya-iron e4d37a7
Добавила задание на оценку 4(Шаг 1)
tanya-iron 5b38cd1
Добавила задание на оценку 6.
tanya-iron c6ca7e8
Добавила шаг 4 и небольшие правки.
tanya-iron 7e3500a
Добавила шаг 4 и небольшие правки.(починенные)
tanya-iron 545386c
Merge branch 'fipl-hse:main' into main
artyomtugaryov 42cfffb
Коммит ради изменений seminars
tanya-iron aa1bc97
Коммит ради изменений seminars
tanya-iron e89b14c
Добавила задание на 8 и исправила замеченное преподавателем.
tanya-iron a38e725
Добавила задание на 8 и исправила замеченное преподавателем.
tanya-iron 8e98a65
Добавила задание на 8 и исправила замеченное преподавателем, а также …
tanya-iron 9aba643
Fixing mypy
tanya-iron 9cc3105
Fixing mypy more
tanya-iron 08fe22b
Добавила задание на 8 и исправила замеченное преподавателем, а также …
tanya-iron eb8d78d
Добавила задание на 8 и исправила замеченное преподавателем, а также …
tanya-iron 92ac870
Добавила задание на 8 и исправила замеченное преподавателем, а также …
tanya-iron 758cc61
Добавила задание на 8 и исправила замеченное преподавателем, а также …
tanya-iron 7a1ece8
Добавила задание на 8 и исправила замеченное преподавателем, а также …
tanya-iron b4e2dd3
Добавила задание на 8 и пытаюсь исправить ошибку start.py
tanya-iron 17e826c
Добавила задание на 8 и исправила все ошибки.
tanya-iron b7aabc2
Добавила задание на 8 и исправила все ошибки. Изменения code style
tanya-iron 7b16ea3
Добавила задание на 8 и исправила все ошибки. Изменения code style
tanya-iron 815141d
Добавила задание на 10.
tanya-iron b29f114
Добавила задание на 10. Исправила 1 codestyle
tanya-iron b2894b8
Добавила задание на 10. Исправила 1 codestyle
tanya-iron 0113f94
Добавила задание на 10. Исправила 1 codestyle
tanya-iron d2c08c6
Добавила задание на 10. Исправила 1 codestyle
tanya-iron 912a7d3
Добавила задание на 10. Исправила 1 codestyle
tanya-iron d05e2ca
Исправила по комментариям ментора.
tanya-iron e1f7d55
Исправила по комментариям ментора.
tanya-iron e44b710
Merge branch 'fipl-hse:main' into main
artyomtugaryov 9feddbf
Merge remote-tracking branch 'upstream/main'
tanya-iron b1fa5a8
Добавила задание на 4.
tanya-iron 49d8120
Merge remote-tracking branch 'origin/main'
tanya-iron db57482
Merge remote-tracking branch 'origin/main' into HEAD
artyomtugaryov 9f76368
checkout labs from the origin repository
artyomtugaryov 8e95a86
Merge branch 'fipl-hse:main' into main
artyomtugaryov ad502e0
Добавила задание на 4.
tanya-iron 3ab90cd
Commit for update
tanya-iron 1dce99b
Merge branch 'fipl-hse:main' into main
artyomtugaryov d9175fc
Merge branch 'fipl-hse:main' into main
artyomtugaryov 9d5d7e2
merge
tanya-iron c97972d
Commit for update
tanya-iron 85ca904
Merge branch 'main' of https://github.com/tanya-iron/2023-2-level-labs
tanya-iron ea58e11
Исравление по комментарием ментора и задание на 6.
tanya-iron caceee4
Исравление по комментарием ментора и задание на 6.
tanya-iron 89f9304
Задание на 8, которое не работает.
tanya-iron bc7fccd
Merge branch 'fipl-hse:main' into main
artyomtugaryov 0504bde
Задание на 8, которое работает.
tanya-iron b70944e
Merge remote-tracking branch 'origin/main'
tanya-iron d541915
Задание на 8, которое работает.
tanya-iron 58ec43d
Задание на 8, которое работает.
tanya-iron 84be2b9
Коммит 1 лабораторной
tanya-iron b928797
Коммит импортов
tanya-iron ab3b48f
Коммит импортов
tanya-iron 09cf847
Изменения для ментора
tanya-iron fba63e9
Merge remote-tracking branch 'origin/main' into HEAD
artyomtugaryov d619ff8
checkout labs from the origin repository
artyomtugaryov 97a02a8
checkout labs from the origin repository
artyomtugaryov 0dc2883
Merge branch 'fipl-hse:main' into main
artyomtugaryov b06bdb6
Задание на 4
tanya-iron 6a29fd7
Задание на 6, которое пока не работает
tanya-iron cbff581
Merge branch 'fipl-hse:main' into main
artyomtugaryov 1a65d87
Задание на 6, которое пока не работает
tanya-iron c10daff
Задание на 6, которое пока не работает
tanya-iron 466ccb6
Задание на 6, которое пока не работает. Почему не работает?
tanya-iron 5054a2e
Задание на 6, которое вроде работает
tanya-iron f6f2e31
Задание на 6, которое вроде работает
tanya-iron f181d37
Задание на 6, с замечаниями ментора
tanya-iron bbc3d3b
Задание на 6, с замечаниями ментора
tanya-iron 51b974b
Задание на 8
tanya-iron ca2eabb
Задание на 8, улучшенное
tanya-iron b0615f9
Задание на 8, улучшенное
tanya-iron 8169ec4
Задание на 8, улучшенное
tanya-iron c7a6daa
Задание на 8, улучшенное
tanya-iron 3a5d47d
Задание на 8, улучшенное
tanya-iron 6eb9832
Задание на 8, улучшенное
tanya-iron 48149f2
Задание на 10, господи
tanya-iron fc9bb16
Задание на 10, господи
tanya-iron 506bf4c
Задание на 10, господи
tanya-iron 411db03
Задание на 10, господи
tanya-iron 3088d64
Задание на 10, господи
tanya-iron 32bcc66
Merge remote-tracking branch 'origin/main' into HEAD
artyomtugaryov d66832a
checkout labs from the origin repository
artyomtugaryov a70856a
Unfinished for 6
tanya-iron f056836
Merge branch 'fipl-hse:main' into main
artyomtugaryov fbef37d
Merge branch 'fipl-hse:main' into main
artyomtugaryov c8b1f7e
Merge branch 'fipl-hse:main' into main
tanya-iron e9b2ed4
Unfinished for 6, commit of mentor's notes
tanya-iron 48036bf
finally 6? will she do more? only time will tell
tanya-iron 2bc8953
imports
tanya-iron a6e960e
imports
tanya-iron 2a6f6df
imports
tanya-iron b14b05f
Tasks for 8
tanya-iron ae5c30d
Tasks for 8
tanya-iron 3fe0586
Tasks for 10!!!!
tanya-iron f4112e2
Tasks for 10!!!! codestyle
tanya-iron c838e30
Tasks for 10!!!! codestyle
tanya-iron b6115cd
ValueError with comments
tanya-iron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
# pylint:disable=too-few-public-methods, too-many-arguments | ||
from lab_3_generate_by_ngrams.main import (BeamSearchTextGenerator, GreedyTextGenerator, | ||
NGramLanguageModel, TextProcessor) | ||
import re | ||
|
||
|
||
class WordProcessor(TextProcessor): | ||
|
@@ -28,6 +29,19 @@ 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: | ||
return ValueError | ||
new_text = re.sub(r'[!?.]', self._end_of_word_token, text) | ||
clean_text = '' | ||
for symbol in new_text.lower(): | ||
if symbol.isalpha or symbol.isspace() or symbol == self._end_of_word_token: | ||
clean_text += symbol | ||
final_text = clean_text.split(' ') | ||
for index, word in enumerate(final_text): | ||
if self._end_of_word_token in word: | ||
word = word[:-len(self._end_of_word_token)] | ||
final_text.insert(index + 1, self._end_of_word_token) | ||
return final_text | ||
|
||
def _put(self, element: str) -> None: | ||
""" | ||
|
@@ -39,6 +53,10 @@ def _put(self, element: str) -> None: | |
Raises: | ||
ValueError: In case of inappropriate type input argument or if input argument is empty. | ||
""" | ||
if not isinstance(element, str) or not element: | ||
return ValueError | ||
if element not in self._storage: | ||
self._storage[element] = len(self._storage) | ||
|
||
def _postprocess_decoded_text(self, decoded_corpus: tuple[str, ...]) -> str: # type: ignore | ||
""" | ||
|
@@ -56,6 +74,10 @@ def _postprocess_decoded_text(self, decoded_corpus: tuple[str, ...]) -> str: # | |
Raises: | ||
ValueError: In case of inappropriate type input argument or if input argument is empty. | ||
""" | ||
if not isinstance(decoded_corpus, tuple) or not decoded_corpus: | ||
return ValueError | ||
decoded_text = ' '.join(decoded_corpus).replace(self._end_of_word_token, '.').capitalize() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. split into 2 lines, please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
return decoded_text | ||
|
||
|
||
class TopPGenerator: | ||
|
@@ -80,6 +102,9 @@ def __init__( | |
word_processor (WordProcessor): WordProcessor instance to handle text processing | ||
p_value (float): Collective probability mass threshold | ||
""" | ||
self._word_processor = word_processor | ||
self._language_model = language_model | ||
self._p_value = p_value | ||
|
||
def run(self, seq_len: int, prompt: str) -> str: # type: ignore | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0 | ||
6 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
string concatination is a bad way
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 agree, Artyom from the Past
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, both Artyoms