22
33module Boilerpipe ::Filters
44 describe BlockProximityFusion do
5- let ( :text_block1 ) { Boilerpipe ::Document ::TextBlock . new ( 'one' , 0 , 0 , 0 , 0 , 0 ) }
6- let ( :text_block2 ) { Boilerpipe ::Document ::TextBlock . new ( 'two' , 0 , 0 , 0 , 0 , 1 ) }
7- let ( :text_block3 ) { Boilerpipe ::Document ::TextBlock . new ( 'three' , 0 , 0 , 0 , 0 , 2 ) }
8- let ( :text_block4 ) { Boilerpipe ::Document ::TextBlock . new ( 'four' , 0 , 0 , 0 , 0 , 3 ) }
5+ let ( :text_block1 ) { Boilerpipe ::Document ::TextBlock . new ( 'one' , 0 , 0 , 0 , 1 , 0 ) }
6+ let ( :text_block2 ) { Boilerpipe ::Document ::TextBlock . new ( 'two' , 0 , 0 , 0 , 1 , 1 ) }
7+ let ( :text_block3 ) { Boilerpipe ::Document ::TextBlock . new ( 'three' , 0 , 0 , 0 , 1 , 2 ) }
8+ let ( :text_block4 ) { Boilerpipe ::Document ::TextBlock . new ( 'four' , 0 , 0 , 0 , 1 , 3 ) }
99
1010 let ( :text_blocks ) { [ text_block1 , text_block2 , text_block3 , text_block4 ] }
1111 let! ( :doc ) { Boilerpipe ::Document ::TextDocument . new ( '' , text_blocks ) }
@@ -18,6 +18,7 @@ module Boilerpipe::Filters
1818
1919 describe '#process' do
2020 context 'where blocks exceed distance' do
21+ # only_content: true, same_tag_level: false
2122 it 'doesnt change blocks' do
2223 expect ( doc . text_blocks . size ) . to eq 4
2324 filter = BlockProximityFusion . new ( 1 , true , false )
@@ -27,10 +28,15 @@ module Boilerpipe::Filters
2728 end
2829
2930 context 'where blocks do not exceed distance' do
31+ # only_content: false, same_tag_level: false
3032 it 'Fuses adjacent blocks' do
33+ puts doc . text_blocks . map ( &:text ) . inspect
34+ puts doc . debug_s
3135 expect ( doc . text_blocks . last . text . size ) . to eq 4
3236 filter = BlockProximityFusion . new ( 1 , false , false )
3337 filter . process ( doc )
38+ puts doc . text_blocks . map ( &:text ) . inspect
39+ puts doc . debug_s
3440 expect ( doc . text_blocks . last . text ) . to eq "three\n four"
3541 end
3642
0 commit comments