mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-31 07:57:35 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			948 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			948 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from __future__ import unicode_literals
 | |
| 
 | |
| import pytest
 | |
| 
 | |
| 
 | |
| def test_single_period(EN):
 | |
|     string = 'A test sentence.'
 | |
|     words = EN(string)
 | |
|     assert len(words) == 4
 | |
|     assert len(list(words.sents)) == 1
 | |
|     assert sum(len(sent) for sent in words.sents) == len(words)
 | |
| 
 | |
| 
 | |
| def test_single_no_period(EN):
 | |
|     string = 'A test sentence'
 | |
|     words = EN(string)
 | |
|     assert len(words) == 3
 | |
|     assert len(list(words.sents)) == 1
 | |
|     assert sum(len(sent) for sent in words.sents) == len(words)
 | |
| 
 | |
| 
 | |
| def test_single_exclamation(EN):
 | |
|     string = 'A test sentence!'
 | |
|     words = EN(string)
 | |
|     assert len(words) == 4
 | |
|     assert len(list(words.sents)) == 1
 | |
|     assert sum(len(sent) for sent in words.sents) == len(words)
 | |
| 
 | |
| 
 | |
| def test_single_question(EN):
 | |
|     string = 'A test sentence?'
 | |
|     words = EN(string, tag=False, parse=False)
 | |
|     assert len(words) == 4
 | |
|     assert len(list(words.sents)) == 1
 | |
|     assert sum(len(sent) for sent in words.sents) == len(words)
 |