add enclitics test, fix multi-line should expectations
This commit is contained in:
parent
8f82086bb1
commit
0ed8a37761
|
@ -33,6 +33,24 @@ module Treat::Specs::Entities
|
|||
@adj_phrase << @adj
|
||||
@verb_phrase << [@aux, @verb]
|
||||
|
||||
@enc_phrase = Treat::Entities::Phrase.new
|
||||
@enc_noun_phrase = Treat::Entities::Phrase.new
|
||||
@enc_noun_phrase.set :tag, 'NP'
|
||||
@enc_verb_phrase = Treat::Entities::Phrase.new
|
||||
@enc_verb_phrase.set :tag, 'VP'
|
||||
@enc_pronoun = Treat::Entities::Word.new('It')
|
||||
@enc_pronoun.set :category, 'pronoun'
|
||||
@enc_pronoun.set :tag, 'PRP'
|
||||
@enc_enclitic = Treat::Entities::Enclitic.new('\'s')
|
||||
@enc_enclitic.set :category, 'verb'
|
||||
@enc_enclitic.set :tag, 'VBZ'
|
||||
@enc_adj = Treat::Entities::Word.new('hot')
|
||||
@enc_adj.set :category, 'adjectival'
|
||||
@enc_adj.set :tag, 'ADJP'
|
||||
|
||||
@enc_noun_phrase << @enc_pronoun
|
||||
@enc_verb_phrase << [ @enc_enclitic, @enc_adj ]
|
||||
@enc_phrase << [ @enc_noun_phrase, @enc_verb_phrase ]
|
||||
end
|
||||
|
||||
|
||||
|
@ -67,7 +85,7 @@ module Treat::Specs::Entities
|
|||
end
|
||||
|
||||
=begin
|
||||
|
||||
|
||||
describe "#frequency" do
|
||||
|
||||
it "returns the frequency of the entity's value in the root" do
|
||||
|
@ -82,9 +100,9 @@ module Treat::Specs::Entities
|
|||
it "returns the position of the entity's value "+
|
||||
"in the supplied parent type, or root if nil" do
|
||||
@noun_phrase.frequency_in(:sentence).should eql 1
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
=end
|
||||
|
@ -100,8 +118,9 @@ module Treat::Specs::Entities
|
|||
|
||||
Treat::Entities::Entity.call_worker(
|
||||
'$'.to_entity, :tag, :lingua,
|
||||
Treat::Workers::Lexicalizers::Taggers, {}).should
|
||||
Treat::Workers::Lexicalizers::Taggers, {}).should(
|
||||
eql '$'.tag(:lingua)
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
|
@ -284,25 +303,34 @@ module Treat::Specs::Entities
|
|||
describe "#to_s" do
|
||||
it "returns the string value of the " +
|
||||
"entity or its full subtree" do
|
||||
@paragraph.to_s.should
|
||||
eql 'The lazy fox is running.'
|
||||
@paragraph.to_s.should(
|
||||
eql 'The lazy fox is running.'
|
||||
)
|
||||
@noun.to_s.should eql 'fox'
|
||||
@enc_phrase.to_s.should(
|
||||
eql 'It\'s hot'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#inspect" do
|
||||
it "returns an informative string " +
|
||||
"concerning the entity" do
|
||||
@paragraph.inspect.should
|
||||
be_an_instance_of String
|
||||
@paragraph.inspect.should(
|
||||
be_an_instance_of String
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#short_value" do
|
||||
it "returns a shortened version of the " +
|
||||
"entity's string value" do
|
||||
@paragraph.short_value.should
|
||||
eql 'The lazy fox is running.'
|
||||
@paragraph.short_value.should(
|
||||
eql 'The lazy fox is running.'
|
||||
)
|
||||
@enc_phrase.short_value.should(
|
||||
eql 'It\'s hot'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue