Sha256: bfa79521fa9a112580296be2a80fc8b33259b1781c0776f2928a0f8cd1b02882

Contents?: true

Size: 858 Bytes

Versions: 4

Compression:

Stored size: 858 Bytes

Contents

# coding:utf-8
require File.dirname(__FILE__) + '/test_helper'
require 'tempfile'

class StopWordsTest < Test::Unit::TestCase
  def test_en
    assert_equal 80, Classifier::StopWords.for('en').size
  end

  def test_ru
    assert_equal 159, Classifier::StopWords.for('ru').size
  end

  def test_stopword_es
    list = Classifier::StopWords.for('es')
    assert list.include?('más')
  end

  def test_unknown
    assert_equal [], Classifier::StopWords.for('_unknown_')
  end

  def setup
    @tmp = nil
  end
  def teardown
    Classifier::StopWords.reset
    File.delete(@tmp) unless @tmp.nil?
  end

  def test_custom_lang_file
    lang = 'xxyyzz'
    @tmp = File.join(File.dirname(__FILE__), lang)
    File.open(@tmp, 'w') { |f| f.puts "str1\nstr2" }
    assert_equal ["str1", "str2"], Classifier::StopWords.for(lang,
      File.dirname(@tmp))
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
logankoester-classifier-1.4.3 test/stopwords_test.rb
luisparravicini-classifier-1.4.2 test/stopwords_test.rb
luisparravicini-classifier-1.4.1 test/stopwords_test.rb
luisparravicini-classifier-1.4.0 test/stopwords_test.rb