Skip to content

Commit

Permalink
test(wink-nlp-specs): add case for nbsp reconstruction with preceding…
Browse files Browse the repository at this point in the history
… spaces

references #135

Co-authored-by: Rachna <rachna@graype.in>
  • Loading branch information
sanjayaksaxena and rachnachakraborty committed Mar 31, 2024
1 parent 6b17414 commit e2b952c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/wink-nlp-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ describe( 'wink-nlp test-coverage and basic behavior', function () {
expect( doc4mark.out(its.markedUpText) ).to.equal( markedText );
} );

it( 'should correctly reconstruct non-breaking spaces with its.precedingSpaces', function () {
var text = 'U.S.A is my birth place. \u00a0 I was born\u00a0on 06.12.1924.';
var reconstructed = [];
nlp.readDoc( text ).sentences().itemAt(1).tokens().each( ( t ) => reconstructed.push( t.out(its.precedingSpaces), t.out() ));
// Reconstruction.
expect( reconstructed.join( '' ) ).to.equal( ' \u00a0 I was born\u00a0on 06.12.1924.' );
} );

it( 'should not contain empty tokens', function () {
var doc = nlp.readDoc( sentence );
expect( findEmptyTokens( doc ) ).deep.equal( [] );
Expand Down

0 comments on commit e2b952c

Please sign in to comment.