如何将Google Colab中ML模型输出与CSV列B数据对比并标记正误?
模型输出与CSV对比标记实现
现有模型代码
wrong_english=[ "I has a dog", "They is going to the park", "She don't like coffee.", "The book belong to him.", "He play soccer very well.", "My sister and me are going to the party.", "I'm not sure who's car is parked outside.", "There is many people in the room.", "She sings good.", ] tokenized=tokenizer( wrong_english, padding="longest", max_length=MAX_LENGTH, truncation=True, return_tensors='tf' ) out = model.generate(**tokenized, max_length=128) print(out) for i in range(len(wrong_english)): print(wrong_english[i]+"------------>"+tokenizer.decode(out[i], skip_special_tokens=True))
模型当前输出
I has a dog------------>I have a dog. They is going to the park------------>They are going to the park. She don't like coffee.------------>She doesn't like coffee. The book belong to him.------------>The book belongs to him. He play soccer very well.------------>He plays soccer very well. My sister and me are going to the party.------------>My sister and me are going to the party. I'm not sure who's car is parked outside.------------>I'm not sure who's car is parked outside. There is many people in the room.------------>There are many people in the room. She sings good.------------>She sings good.
需求说明
需将上述模型输出与某CSV文件的B列逐条对比:
- 若模型输出内容与B列对应记录匹配,标记为CORRECT
- 若不匹配,标记为INCORRECT
预期效果示例
I has a dog------------>I have a dog. -> CORRECT They is going to the park------------>They are going to the park. -> CORRECT She don't like coffee.------------>She doesn't like coffee. -> CORRECT The book belong to him.------------>The book belongs to him. -> CORRECT He play soccer very well.------------>He plays soccer very well. -> CORRECT My sister and me are going to the party.------------>My sister and me are going to the party. -> CORRECT I'm not sure who's car is parked outside.------------>I'm not sure who's car is parked outside. -> INCORRECT There is many people in the room.------------>There are many people in the room. -> CORRECT She sings good.------------>She sings good. -> CORRECT
内容的提问来源于stack exchange,提问作者aps
相关产品推荐
相关产品推荐

