Views
No views yet
1@article{wahle2021incorporating,
2 title={Incorporating Word Sense Disambiguation in Neural Language Models},
3 author={Wahle, Jan Philip and Ruas, Terry and Meuschke, Norman and Gipp, Bela},
4 journal={arXiv preprint arXiv:2106.07967},
5 year={2021}
6}1from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
2
3model = AutoModelForSeq2SeqLM.from_pretrained("jpelhaw/t5-word-sense-disambiguation")
4tokenizer = AutoTokenizer.from_pretrained("jpelhaw/t5-word-sense-disambiguation")
5
6input = '''question: which description describes the word " java "\
7 best in the following context? \
8descriptions:[ " A drink consisting of an infusion of ground coffee beans ",
9 " a platform-independent programming language ", or
10 " an island in Indonesia to the south of Borneo " ]
11context: I like to drink " java " in the morning .'''
12
13
14example = tokenizer.tokenize(input, add_special_tokens=True)
15
16answer = model.generate(input_ids=example['input_ids'],
17 attention_mask=example['attention_mask'],
18 max_length=135)
19
20# "a drink consisting of an infusion of ground coffee beans"