Sha256: e953bc0457d9c3a26322650714647237d3a00a380875cc1cc3ff20884a4f12dc

Contents?: true

Size: 553 Bytes

Versions: 1

Compression:

Stored size: 553 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
require 'rbbt/ner/ngram_prefix_dictionary'
require 'rbbt/util/tmpfile'

class TestNGramPrefixDictionary < Test::Unit::TestCase
  def test_match
    lexicon =<<-EOF
C1;aa;AA;bb b
C2;11;22;3 3;bb
    EOF

    TmpFile.with_file(lexicon) do |file|
      index = NGramPrefixDictionary.new(TSV.new(file, :flat, :sep => ';'), "test")

      matches = index.match(' asdfa dsf asdf aa asdfasdf ')
      assert matches.select{|m| m.code.include? 'C1'}.any?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbbt-text-0.5.0 test/rbbt/ner/test_ngram_prefix_dictionary.rb