Skip to content

Commit

Permalink
Add some describe blocks for orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
lichtr committed Sep 4, 2014
1 parent 552c7d4 commit c347095
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions spec/lib/llt/segmenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ def load_fixture(filename)
sentences[2].to_s.should == "Marcus Antonius!"
end

it "creates indices by default" do
txt = "Cicero est; quis Caesar est? Marcus Antonius!"
sentences = segmenter.segment(txt)
sentences.map(&:id).should == [1, 2, 3]
end
describe "with options (indices)" do
it "creates indices by default" do
txt = "Cicero est; quis Caesar est? Marcus Antonius!"
sentences = segmenter.segment(txt)
sentences.map(&:id).should == [1, 2, 3]
end

it "indices can be turned off" do
txt = "Cicero est; quis Caesar est? Marcus Antonius!"
sentences = segmenter.segment(txt, indexing: false)
sentences.map(&:id).should == [nil, nil, nil]
it "indices can be turned off" do
txt = "Cicero est; quis Caesar est? Marcus Antonius!"
sentences = segmenter.segment(txt, indexing: false)
sentences.map(&:id).should == [nil, nil, nil]
end
end

it "handles abbreviated names" do
Expand All @@ -50,16 +52,18 @@ def load_fixture(filename)
sentences[1].to_s.should == "M. Tullius Cicero est."
end

it "handles abbreviated dates" do
txt = "Is dies erat a. d. V Kal. Apr. L. Pisone, A. Gabinio consulibus."
sentences = segmenter.segment(txt)
sentences.should have(1).item
end
describe "handles dates" do
it "with abbreviations" do
txt = "Is dies erat a. d. V Kal. Apr. L. Pisone, A. Gabinio consulibus."
sentences = segmenter.segment(txt)
sentences.should have(1).item
end

it "handles more dates" do
txt = "Is dies erat a. d. V Ian. Non. Feb. Octob. L. App. Pisone ."
sentences = segmenter.segment(txt)
sentences.should have(1).item
it "with more (and alternative) abbreviations" do
txt = "Is dies erat a. d. V Ian. Non. Feb. Octob. L. App. Pisone ."
sentences = segmenter.segment(txt)
sentences.should have(1).item
end
end

it "are only triggered when they have a leading word boundary" do
Expand Down

0 comments on commit c347095

Please sign in to comment.