我在Google Colab上有一个机器学习模型,我有这个代码
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文件,看起来像这一个
我如何将ML模型的输出与CSV文件的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
1条答案
按热度按时间mklgxw1f1#