figurative-nlp/English-Simile-Generation
English-Simile-Generation is a seq2seq paraphrase model which can transform sentence A to sentence B containing figurative or simile expression.
A: Now I feel sad to see your scientific research progress is so slow.
B: Now I feel sad to see your scientific research progress is as slow as snail.
To our knowledge, our model have better performance,diversity and practicability compared to EMNLP21 paper (Generating similes effortlessly like a Pro: A Style Transfer Approach for Simile Generation).
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.frompretrained("figurative-nlp/English-Simile-Generation") model = AutoModelForSeq2SeqLM.frompretrained("figurative-nlp/Ehinese-Simile-Generation")
inputids = tokenizer( "Adrenaline shot through him powerful", returntensors="pt" ).inputids outputs = model.generate(inputids,numbeams = 5,maxlength = 64) result = tokenizer.decode(outputs[0], skipspecialtokens=True) print(result) #result : Adrenaline shot through him like an electric current
