orkgnlp.nli.templates.recommender.TemplatesRecommender
- class TemplatesRecommender(*args, **kwargs)[source]
Bases:
ORKGNLPBaseServiceThe TemplatesRecommender requires a transformers.BertForSequenceClassification pretrained model and the templates used for training as premises. The required files are downloaded while initiation, if it has not happened before.
You can pass the parameter
force_download=Trueto 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__(title, abstract, top_n=5)[source]
Recommends templates for a research paper.
- Parameters:
title (
str) – Title of the research paper.abstract (
str) – Abstract of the research paper.top_n (
int) – Top n results to be extracted. Defaults to 5.
- Returns:
List of templates.
- release_memory()
Releases the memory of all available executors.