python - 使用“\t”进行文件解析和标记化
问题描述
我目前正在使用以下 git repo - https://github.com/threelittlemonkeys/rnn-encoder-decoder-pytorch
我在设置输入文件时遇到问题。根据github,我们需要以下格式的文件:
source_sequence \t target_sequence
source_sequence \t target_sequence
查看代码,它正在解析每一行并将其拆分为“\t”分隔符。但是,当我运行 prepare.py 时,我收到以下错误“没有足够的值来解包(预期 2,得到 1)”
这似乎在执行 line.split("\t") 时发生。我的每一行输入都是一个序列,后跟 \t,然后是另一个序列。谁能告诉我发生了什么?
解决方案
推荐阅读
- python - 从熊猫数据框中的列中减去一个常数
- azure - 尝试使用新的 AZ 模块通过 PowerShell 连接到 Azure
- file - 存储和导出用户在移动应用程序中附加的文件的正确方法
- azure - 将 Azure Ad 身份验证的 API 公开给第三方应用程序的所有方法是什么
- r - 将带有原始数据的两行绑定到 R 中的数据框
- python - 遍历坐标并将它们插入到 Folium 地图中
- splunk - 搜索多行正则表达式
- javascript - 使用 Ajax 的 Put 方法(不触发脚本)
- rest - 在 Python Turtle 中,你如何从一个屏幕转到一个新屏幕,然后清除它然后转到一个新屏幕?
- php - Websockets:从php服务器向客户端发送消息