词序:神经网络能按正确的顺序排列单词吗?

2017年09月07日 由 yining 发表 865695 0
当学习第二语言时,最困难的挑战之一可能是熟悉单词顺序。词序在机器翻译中也很重要,因为翻译大致上是一种处理目标语言词汇的过程,它与源语言是对等的。也许你已经做过一个把打乱的单词或字母放在原来顺序的游戏。我想看看神经网络是否能做到这一点。

神经网络

要求



  • NumPy > = 1.11.1

  • TensorFlow==1.2(可能使用1.3也可以运行,不过我没有测试过)

  • matplotlib

  • 距离

  • tqdm


模型架构


到2017年,我使用的转换器是在机器翻译任务中最先进的模型,并已经被人们所熟知。这有一篇介绍转换器的文章,地址:https://arxiv.org/abs/1706.03762
然而,我不知道它是否适合这个任务。实际上,我认为一个更简单的架构可能会起作用。如下:

神经网络

文件说明



  • hyperparams.py 包括所有需要的超参数。

  • data_load.py 包含关于加载和批处理数据的函数。

  • modules.py 具有编码/解码网络的所有构建块。

  • train.py 包含模型和训练代码。

  • eval.py 用于评估和推理。


训练



训练损失和准确性



  • 训练损失


神经网络

  • 训练准确性


神经网络

评估



  • 运行eval.py.


我们把WER(单词错误率)作为度量。单词错误率=编辑距离(Edit distance)÷单词数量

例:5530/23541=0.23

以下是一些评估结果。详细信息可以在results文件夹中找到。

输入: another this step development that is in
期望的结果: is this another step in that development
实际结果: that that another step in that development
单词错误率 : 2

输入: time we're remember going a long to for this
期望的结果: we're going to remember this for a long time
实际结果: we're going to remember this for a long time
单词错误率: 0

输入: retail a at look concepts for ahead up-and-coming click spinoff
期望的结果: for a look at up-and-coming spinoff retail concepts click ahead
实际结果: the this retail at this concepts click click click ahead
单词错误率: 7

输入: comfort daughter his is -year-old
期望的结果: comfort is his -year-old daughter
实际结果: his is his -year-old daughter
单词错误率: 1

输入: solar are tumbling prices everywhere
期望的结果: everywhere solar prices are tumbling
实际结果: solar solar prices are about
单词错误率: 2
欢迎关注ATYUN官方公众号
商务合作及内容投稿请联系邮箱:bd@atyun.com
评论 登录
热门职位
Maluuba
20000~40000/月
Cisco
25000~30000/月 深圳市
PilotAILabs
30000~60000/年 深圳市
写评论取消
回复取消