mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-31 07:57:35 +03:00 
			
		
		
		
	Allow DocBin to take list of Doc objects.
This commit is contained in:
		
							parent
							
								
									95df028758
								
							
						
					
					
						commit
						0d22c6e006
					
				|  | @ -39,7 +39,7 @@ class DocBin(object): | ||||||
|     document from the DocBin. |     document from the DocBin. | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|     def __init__(self, attrs=None, store_user_data=False): |     def __init__(self, attrs=None, store_user_data=False, docs=[]): | ||||||
|         """Create a DocBin object to hold serialized annotations. |         """Create a DocBin object to hold serialized annotations. | ||||||
| 
 | 
 | ||||||
|         attrs (list): List of attributes to serialize. 'orth' and 'spacy' are |         attrs (list): List of attributes to serialize. 'orth' and 'spacy' are | ||||||
|  | @ -59,6 +59,8 @@ class DocBin(object): | ||||||
|         self.user_data = [] |         self.user_data = [] | ||||||
|         self.strings = set() |         self.strings = set() | ||||||
|         self.store_user_data = store_user_data |         self.store_user_data = store_user_data | ||||||
|  |         for doc in docs: | ||||||
|  |             self.add(docs) | ||||||
| 
 | 
 | ||||||
|     def __len__(self): |     def __len__(self): | ||||||
|         """RETURNS: The number of Doc objects added to the DocBin.""" |         """RETURNS: The number of Doc objects added to the DocBin.""" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user