mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-31 07:57:35 +03:00 
			
		
		
		
	add kb_loader and get_candidates back to EL API
This commit is contained in:
		
							parent
							
								
									e2f2ef3a5a
								
							
						
					
					
						commit
						2dfd919585
					
				|  | @ -622,7 +622,7 @@ others, but may not be as accurate, especially if texts are short. | ||||||
| 
 | 
 | ||||||
| An [`EntityLinker`](/api/entitylinker) component disambiguates textual mentions | An [`EntityLinker`](/api/entitylinker) component disambiguates textual mentions | ||||||
| (tagged as named entities) to unique identifiers, grounding the named entities | (tagged as named entities) to unique identifiers, grounding the named entities | ||||||
| into the "real world". This requires 3 main component | into the "real world". This requires 3 main components: | ||||||
| 
 | 
 | ||||||
| - A [`KnowledgeBase`](/api/kb) (KB) holding the unique identifiers, potential | - A [`KnowledgeBase`](/api/kb) (KB) holding the unique identifiers, potential | ||||||
|   synonyms and prior probabilities. |   synonyms and prior probabilities. | ||||||
|  |  | ||||||
|  | @ -40,13 +40,14 @@ architectures and their arguments and hyperparameters. | ||||||
| > nlp.add_pipe("entity_linker", config=config) | > nlp.add_pipe("entity_linker", config=config) | ||||||
| > ``` | > ``` | ||||||
| 
 | 
 | ||||||
| | Setting          | Description                                                                                                                                                                                | | | Setting          | Description                                                                                                                                                                                                                                                              | | ||||||
| | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||||||
| | `labels_discard` | NER labels that will automatically get a "NIL" prediction. Defaults to `[]`. ~~Iterable[str]~~                                                                                             | | | `labels_discard` | NER labels that will automatically get a "NIL" prediction. Defaults to `[]`. ~~Iterable[str]~~                                                                                                                                                                           | | ||||||
| | `incl_prior`     | Whether or not to include prior probabilities from the KB in the model. Defaults to `True`. ~~bool~~                                                                                       | | | `incl_prior`     | Whether or not to include prior probabilities from the KB in the model. Defaults to `True`. ~~bool~~                                                                                                                                                                     | | ||||||
| | `incl_context`   | Whether or not to include the local context in the model. Defaults to `True`. ~~bool~~                                                                                                     | | | `incl_context`   | Whether or not to include the local context in the model. Defaults to `True`. ~~bool~~                                                                                                                                                                                   | | ||||||
| | `model`          | The [`Model`](https://thinc.ai/docs/api-model) powering the pipeline component. Defaults to [EntityLinker](/api/architectures#EntityLinker). ~~Model~~                                     | | | `model`          | The [`Model`](https://thinc.ai/docs/api-model) powering the pipeline component. Defaults to [EntityLinker](/api/architectures#EntityLinker). ~~Model~~                                                                                                                   | | ||||||
| | `kb`             | The [`KnowledgeBase`](/api/kb). Defaults to [EmptyKB](/api/architectures#EmptyKB), a function returning an empty `KnowledgeBase` with an `entity_vector_length` of `64`. ~~KnowledgeBase~~ | | | `kb_loader`      | Function that creates a [`KnowledgeBase`](/api/kb) from a `Vocab` instance. Defaults to [EmptyKB](/api/architectures#EmptyKB), a function returning an empty `KnowledgeBase` with an `entity_vector_length` of `64`. ~~Callable[[Vocab], KnowledgeBase]~~                | | ||||||
|  | | `get_candidates` | Function that generates plausible candidates for a given `Span` object. Defaults to [CandidateGenerator](/api/architectures#CandidateGenerator), a function looking up exact, case-dependent aliases in the KB. ~~Callable[[KnowledgeBase, Span], Iterable[Candidate]]~~ | | ||||||
| 
 | 
 | ||||||
| ```python | ```python | ||||||
| https://github.com/explosion/spaCy/blob/develop/spacy/pipeline/entity_linker.py | https://github.com/explosion/spaCy/blob/develop/spacy/pipeline/entity_linker.py | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user