stopwords-filter icon indicating copy to clipboard operation
stopwords-filter copied to clipboard

Argument error with Stopwords::Snowball::WordSieve.new

Open PatrickMcSweeny opened this issue 2 years ago • 1 comments

After updating from 0.4.1 to 0.7.0, initializing the Stopwords::Snowball::WordSieve class produces the following error:

ArgumentError: Unknown locale: "fn"

I was able to get rid of the error by manually deleting the 'fn' file in lib/stopwords/snowball/locales folder.

PatrickMcSweeny avatar Mar 09 '22 18:03 PatrickMcSweeny

Here's a helper method to do this at runtime for anyone using this gem in the future.

def fix_stopwords_locales!
  dir = Gem::Specification.find_by_name("stopwords-filter").gem_dir
  path = File.join(dir, "lib/stopwords/snowball/locales/fn.csv")
  FileUtils.rm path if File.exist?(path)
end

I'll likely submit a pull request with a real fix to the maintained fork of this repo: https://github.com/aaronstillwell/stopwords-filter2

hopsoft avatar Sep 08 '23 06:09 hopsoft