Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/Sastrawi/StopWordRemover/StopWordRemover.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ def __init__(self, dictionary):
def get_dictionary(self):
return self.dictionary

def remove(self, text):
def remove(self, text, min_length=1):
"""Remove stop words."""
words = text.split(' ')
stopped_words = [word for word in words if not self.dictionary.contains(word)]
stopped_words = [word for word in words if not self.dictionary.contains(word) and len(word) >= min_length]

return ' '.join(stopped_words)




Loading