Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以在 python 中做这样的事情吗?我有3句话:
I like cats. I like cats I like cats
有可能当我给我喜欢的时候,脚本返回猫?
有人可以给我建议/工具或一些例子吗?
有无数种方法可以做到这一点。您可以制作一个脚本来执行此操作:
print("cats")
但是,我认为这不是你想要的。您正在寻找语言模型。同样,有很多方法可以做到这一点,从相当简单的贝叶斯模型到更高级的神经网络语言模型。如果您想构建自己的,我建议您查看TensorFlow的语言模型教程。否则,您可以使用更现成的东西,例如NLTK的语言模型(参见此处的示例)。