File size: 1,415 Bytes
4c382b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
This model can convert the figurative/metaphorical expression to the literal expression. Below is the usage of our model:


    from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
    
    tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/t5-figurative-paraphrase")
    model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/t5-figurative-paraphrase")
    
    
    input_ids = tokenizer(
        "paraphrase the sentence : i will talk this story to you from A to Z", return_tensors="pt"
    ).input_ids  # Batch size 1
    outputs = model.generate(input_ids,num_beams = 5)
    result = tokenizer.decode(outputs[0], skip_special_tokens=True)
    #result : i will talk this story to you from beginning to end..
    



For example:

   **Input**: He is always bang on when he makes a speech.
   
   **Output**: He is always presice when he makes a speech.
   
   **Input**: He always buy what he said.
   
   **Output**: He always agree with what he said.   
   
   **Input**: Your team will be done like dinner if they play against the all-star team.
   
   **Output**: Your team will be defeated if they play against the all-star team. (the one is not particularly accurate)
   
   
   
 Note: the figurative language here includes metaphor, idiom and  simile. We don't guarantee that the results generated results are satisfactory to you. We are trying to improve the effect of the model.