Skip to content

Instantly share code, notes, and snippets.

@MSch
Forked from avgerin0s/stem.ex
Last active August 29, 2015 14:02
Show Gist options
  • Save MSch/73856f51180146dd31dc to your computer and use it in GitHub Desktop.
Save MSch/73856f51180146dd31dc to your computer and use it in GitHub Desktop.
defmodule Stemmer do
def stem(word) do
IO.puts "stemming #{word}"
case Regex.run(~r/^(.+?)(ASD|QWE)$/u, word) do
[pattern_matching, like, "ASD"] -> IO.inspect like
[pattern_matching, like, "QWE"] -> IO.puts "whatever"
end
end
end
Stemmer.stem("blabla ASD")
Stemmer.stem("blabla QWE")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment