orkgnlp.annotation.rfclf.classifier.ResearchFieldClassifier
- class ResearchFieldClassifier(*args, **kwargs)[source]
Bases:
ORKGNLPBaseServiceThe ResearchFieldClassifier requires a torch-script model trained on abstracts and a label dictionary file containing research fields and corresponding indices. 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__(raw_input, top_n=5)[source]
Classifies a paper into a research field by processing the given abstract.
- Parameters:
raw_input (
str) – Combined paper’s title and abstracttop_n (
int) – The top n research fields to be retrieved
- Return type:
Any- Returns:
A list of n most likely research fields for the paper
- Raises:
orkgnlp.common.util.exceptions.ORKGNLPValidationError – If no abstract is given
- release_memory()
Releases the memory of all available executors.