Skip to content

Commit

Permalink
Handle common punctuation
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Dec 29, 2024
1 parent 2054387 commit 85a14da
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/packages/text_search.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ fn remove(index: TextSearchIndex, name: String) -> Result(Nil, Error) {

fn stem_words(phrase: String) -> List(String) {
phrase
|> string.replace(",", " ")
|> string.replace(".", " ")
|> string.replace("!", " ")
|> string.replace("/", " ")
|> string.replace("'", "")
|> string.split(" ")
|> list.filter(fn(word) { word != "" })
|> list.map(porter_stemmer.stem)
Expand Down

0 comments on commit 85a14da

Please sign in to comment.