Sha256: 34b8cc8f7c968b97c40f047338bd0b6f4602543429b2d5f865830fcb8935f02c
Contents?: true
Size: 927 Bytes
Versions: 2
Compression:
Stored size: 927 Bytes
Contents
# -*- coding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe 'Keyphrase' do before(:all) do YaCan.appid = ENV['YAHOO_API_APPID'] @phrase = '東京ミッドタウンから国立新美術館まで歩いて5分で着きます。' @xml = File.open(File.expand_path(File.dirname(__FILE__) + '/test_source/keyphrase.xml')).read end it 'should have alias method :extract' do YaCan::YahooAPI.stub!(:request).and_return @xml YaCan::Keyphrase.extract(@phrase).results.should == YaCan::Keyphrase.analyze(@phrase).results end describe "Result" do before(:all) do @res = YaCan::Keyphrase::Result.new(@xml) end it 'should analyze sentence' do @res.results.should have(3).items end it 'should take phrases' do @res.phrases.sort.should == ["国立新美術館", "東京ミッドタウン", "5分"].sort end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yacan-0.1.1 | spec/keyphrase_spec.rb |
yacan-0.1.0 | spec/keyphrase_spec.rb |