orkgnlp.annotation.tdm.extractor.TdmExtractor
- class TdmExtractor(*args, **kwargs)[source]
Bases:
ORKGNLPBaseService
The TdmExtractor requires a transformers.XLNetForSequenceClassification pretrained model and a TDM gold labels file. The required files are downloaded while initiation, if it has not happened before.
You can pass the parameter
force_download=True
to remove and re-download the previous downloaded service files.- Parameters
service – Service name.
force_download – Indicates whether the required files are to be downloaded again. Defaults to False.
batch_size – Size of the batches used during model prediction. This argument is used by services that applies batch evaluation. Defaults to 16.
Methods
Releases the memory of all available executors.
Attributes
SERVICE_NAME
- __call__(text, top_n=5)[source]
Extracts Task-Dataset-Metric (TDM) entities from a given DocTAET (Title, Abstract, ExperimentalSetup, TableInfo)
text
- Parameters
text (
str
) – DocTAET represented text.top_n (
int
) – Top n results to be extracted. Defaults to 5.
- Return type
Any
- Returns
A list of TDMs.
- release_memory()
Releases the memory of all available executors.