Skip to content

HW_3#5

Open
veronica-kirenkina wants to merge 1 commit intomainfrom
veronica-kirenkina-1
Open

HW_3#5
veronica-kirenkina wants to merge 1 commit intomainfrom
veronica-kirenkina-1

Conversation

@veronica-kirenkina
Copy link
Owner

Реализация класса CountVectorizer, имеющего

  • метод fit_transform
  • метод get_feature_names

@veronica-kirenkina veronica-kirenkina changed the title hw_3.py HW_3 Nov 13, 2023
Comment on lines +40 to +42
for word in string.lower().split():
if word not in self.uniquewords:
self.uniquewords.append(word)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь получается довольно высокая сложность О(N^2)
Можно сделать оптимальнее, если хранить уникальные слова не в массиве, а в какой-то другой структуре

Comment on lines +46 to +47
for word in self.uniquewords:
result.append(string.lower().count(word))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Второй раз приводим в нижний регистр те же данные
К тому же, тут может быть баг, если мы передадим к примеру строку "bla blablabla", то в результате получим [4, 1] так как bla найдется 4 раза

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants