figurative-nlp's picture
Update README.md
9184a5c
|
raw
history blame
1.22 kB

English-Simile-Generative is a seq2seq paraphrase model which can tranforme sentence A to sentence B containing figurative or simile expression.

A: I think I rated you very high at the beginning. Now I feel sad to see your scientific research progress is so slow.

B: I think I rated you very high at the beginning. 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.from_pretrained("figurative-nlp/English-Simile-Generation")
  model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/Ehinese-Simile-Generation")
  
  
  input_ids = tokenizer(
      "Adrenaline shot through him powerful", return_tensors="pt"
  ).input_ids
  outputs = model.generate(input_ids,num_beams = 5,max_length = 64)
  result = tokenizer.decode(outputs[0], skip_special_tokens=True)
  print(result)
  #result : Adrenaline shot through him like an electric current