mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Merge pull request #5127 from svlandeg/docs/empty-doc
is_XXX is True if doc is empty
This commit is contained in:
		
						commit
						4130fef4ec
					
				| 
						 | 
					@ -260,7 +260,7 @@ cdef class Doc:
 | 
				
			||||||
    def is_nered(self):
 | 
					    def is_nered(self):
 | 
				
			||||||
        """Check if the document has named entities set. Will return True if
 | 
					        """Check if the document has named entities set. Will return True if
 | 
				
			||||||
        *any* of the tokens has a named entity tag set (even if the others are
 | 
					        *any* of the tokens has a named entity tag set (even if the others are
 | 
				
			||||||
        unknown values).
 | 
					        unknown values), or if the document is empty.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if len(self) == 0:
 | 
					        if len(self) == 0:
 | 
				
			||||||
            return True
 | 
					            return True
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -657,10 +657,10 @@ The L2 norm of the document's vector representation.
 | 
				
			||||||
| `user_data`                             | -            | A generic storage area, for user custom data.                                                                                                                                                                                                                                              |
 | 
					| `user_data`                             | -            | A generic storage area, for user custom data.                                                                                                                                                                                                                                              |
 | 
				
			||||||
| `lang` <Tag variant="new">2.1</Tag>     | int          | Language of the document's vocabulary.                                                                                                                                                                                                                                                     |
 | 
					| `lang` <Tag variant="new">2.1</Tag>     | int          | Language of the document's vocabulary.                                                                                                                                                                                                                                                     |
 | 
				
			||||||
| `lang_` <Tag variant="new">2.1</Tag>    | unicode      | Language of the document's vocabulary.                                                                                                                                                                                                                                                     |
 | 
					| `lang_` <Tag variant="new">2.1</Tag>    | unicode      | Language of the document's vocabulary.                                                                                                                                                                                                                                                     |
 | 
				
			||||||
| `is_tagged`                             | bool         | A flag indicating that the document has been part-of-speech tagged.                                                                                                                                                                                                                        |
 | 
					| `is_tagged`                             | bool         | A flag indicating that the document has been part-of-speech tagged. Returns `True` if the `Doc` is empty.                                                                                                                                                                                  |
 | 
				
			||||||
| `is_parsed`                             | bool         | A flag indicating that the document has been syntactically parsed.                                                                                                                                                                                                                         |
 | 
					| `is_parsed`                             | bool         | A flag indicating that the document has been syntactically parsed. Returns `True` if the `Doc` is empty.                                                                                                                                                                                   |
 | 
				
			||||||
| `is_sentenced`                          | bool         | A flag indicating that sentence boundaries have been applied to the document.                                                                                                                                                                                                              |
 | 
					| `is_sentenced`                          | bool         | A flag indicating that sentence boundaries have been applied to the document. Returns `True` if the `Doc` is empty.                                                                                                                                                                        |
 | 
				
			||||||
| `is_nered` <Tag variant="new">2.1</Tag> | bool         | A flag indicating that named entities have been set. Will return `True` if _any_ of the tokens has an entity tag set, even if the others are unknown.                                                                                                                                      |
 | 
					| `is_nered` <Tag variant="new">2.1</Tag> | bool         | A flag indicating that named entities have been set. Will return `True` if the `Doc` is empty, or if _any_ of the tokens has an entity tag set, even if the others are unknown.                                                                                                            |
 | 
				
			||||||
| `sentiment`                             | float        | The document's positivity/negativity score, if available.                                                                                                                                                                                                                                  |
 | 
					| `sentiment`                             | float        | The document's positivity/negativity score, if available.                                                                                                                                                                                                                                  |
 | 
				
			||||||
| `user_hooks`                            | dict         | A dictionary that allows customization of the `Doc`'s properties.                                                                                                                                                                                                                          |
 | 
					| `user_hooks`                            | dict         | A dictionary that allows customization of the `Doc`'s properties.                                                                                                                                                                                                                          |
 | 
				
			||||||
| `user_token_hooks`                      | dict         | A dictionary that allows customization of properties of `Token` children.                                                                                                                                                                                                                  |
 | 
					| `user_token_hooks`                      | dict         | A dictionary that allows customization of properties of `Token` children.                                                                                                                                                                                                                  |
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user