Public interface for the atap_context_extractor module
Can be imported using:
from atap_context_extractor import ContextExtractor
ContextExtractor constructor
Params
Example
extractor = ContextExtractor(run_logger=True)
Inherited from panel.viewable.Viewer. Call ContextExtractor.servable() in a Jupyter notebook context to display the ContextExtractor widget.
Example
extractor = ContextExtractor(run_logger=True)
extractor.servable()
Returns: CorpusLoader - the CorpusLoader object that the ContextExtractor is attached to
Example
extractor = ContextExtractor()
corpus_loader = extractor.get_corpus_loader()
corpus_loader.trigger_event('update')
Returns the corpora object that contains the loaded corpus objects. This allows adding to the corpora from outside the CorpusLoader as the object returned is mutable, not a copy. The Corpora object has a unique name constraint, meaning a corpus object cannot be added to the corpora if another corpus with the same name is already present. The same constraint applies to the rename method of corpus objects added to the corpora.
Returns: TCorpora - the mutable corpora object that contains the loaded corpus objects
Example
extractor = ContextExtractor(run_logger=True)
corpora_object = extractor.get_mutable_corpora()
corpus = corpora_object.get("example")
The following snippet could be used as a cell in a Jupyter notebook.
from atap_context_extractor import ContextExtractor
from atap_corpus_loader import CorpusLoader
loader = CorpusLoader(root_directory='example_dir', include_meta_loader=True, run_logger=True)
context_extractor: ContextExtractor = ContextExtractor(corpus_loader=loader, run_logger=True)
context_extractor.servable()