import torch
from transformers import pipeline

classifier=pipeline("fill-mask", model="roberta-base")
data=["PHYSICS", "CHEMISTRY", "BANKING", "MATHEMATICS", "ACCOUNTS"]

msc_words=["science", "mathematics", "physics", "technology", "chemistry", "research"]
mcom_words=["banking", "accounting", "business", "finance"]

for word in data:
  sentence=f"{word.lower()} is mainly related to <mask>."
  result=classifier(sentence,top_k=10)

  predicted="Unknown"
  for r in result:
    token=r["token_str"].strip()
    if token in msc_words:
      predicted="MSC"
    elif token in mcom_words:
      predicted="MCOM"

  print(f"{word:15s} -> {predicted}")