Views
No views yet
| Edit Intention | Definition | Example |
|---|---|---|
| clarity | Make the text more formal, concise, readable and understandable. |
Original: It's like a house which anyone can enter in it. Revised: It's like a house which anyone can enter. |
| fluency | Fix grammatical errors in the text. |
Original: In the same year he became the Fellow of the Royal Society. Revised: In the same year, he became the Fellow of the Royal Society. |
| coherence | Make the text more cohesive, logically linked and consistent as a whole. |
Original: Achievements and awards Among his other activities, he founded the Karachi Film Guild and Pakistan Film and TV Academy. Revised: Among his other activities, he founded the Karachi Film Guild and Pakistan Film and TV Academy. |
| style | Convey the writer’s writing preferences, including emotions, tone, voice, etc.. |
Original: She was last seen on 2005-10-22. Revised: She was last seen on October 22, 2005. |
| meaning-changed | Update or add new information to the text. |
Original: This method improves the model accuracy from 64% to 78%. Revised: This method improves the model accuracy from 64% to 83%. |
1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4tokenizer = AutoTokenizer.from_pretrained("wanyu/IteraTeR-ROBERTA-Intention-Classifier")
5model = AutoModelForSequenceClassification.from_pretrained("wanyu/IteraTeR-ROBERTA-Intention-Classifier")
6
7id2label = {0: "clarity", 1: "fluency", 2: "coherence", 3: "style", 4: "meaning-changed"}
8
9before_text = 'I likes coffee.'
10after_text = 'I like coffee.'
11model_input = tokenizer(before_text, after_text, return_tensors='pt')
12model_output = model(**model_input)
13softmax_scores = torch.softmax(model_output.logits, dim=-1)
14pred_id = torch.argmax(softmax_scores)
15pred_label = id2label[pred_id.int()]