STS-2016-Task1-1
2015-12-31 21:51
302 查看
数据集整理
文件结构
ROOT
- train
STS2012-test#STS.input.MSRpar.txt
......
- gs
STS2012-test#STS.gs.MSRpar.txt
生成
ROOT
input.txt
gs.txt
input.info
格式是文件名,在input.txt的多少行到多少行,0下标开始
——————————————————————————————————————————————————————————
scanner.py
将所有文件合在一起 -- 便于训练
生成dict
文件结构
ROOT
- train
STS2012-test#STS.input.MSRpar.txt
......
- gs
STS2012-test#STS.gs.MSRpar.txt
生成
ROOT
input.txt
gs.txt
input.info
格式是文件名,在input.txt的多少行到多少行,0下标开始
——————————————————————————————————————————————————————————
scanner.py
将所有文件合在一起 -- 便于训练
生成dict
import os ROOT = os.getcwd() TRAIN = ROOT + '/train/' GS = ROOT + '/gs/' train_fw = open('input.txt', 'w') gs_fw = open('gs.txt', 'w') dict_fw = open('input.info', 'w') offSet = 0 dict_list = [] for file in os.listdir(TRAIN): print file train_fp = open(TRAIN + file).readlines() gs_fp = open(GS + file.replace('input', 'gs')).readlines() dict_list.append([file, str(offSet), str(offSet+len(gs_fp))]) offSet += len(gs_fp) for train in train_fp: print >>train_fw, train.strip() for gs in gs_fp: print >>gs_fw, gs.strip() for line in dict_list: print >>dict_fw, '\t'.join(line) dict_fw.close() gs_fw.close() train_fw.close()
相关文章推荐
- UML 小结(3)- UML的结构及各个阶段的应用
- 在Ubuntu下基于QEMU运行XINU OS x86系统
- CentOS7+Tomcat 生产系统部署
- 虚拟机和windows主机中的文件共享
- QT线程2
- 我常用的pom.xml配置文件
- HDU 5071 Chat
- QT线程
- Android的事件分发源码分析,告别事件冲突。
- 解决android api23无Apache HttpClient包问题
- ABP理论学习之异常处理
- Android仿微信语音聊天
- 企业培训的三个关键点
- 怒水一记 GSS
- DICOM:dcm4che开源项目导入Eclipse编译错误问题解决方案
- NSFileManager的使用
- BZOJ 4104 [Thu Summer Camp 2015]解密运算
- MarkDown基本语法
- [DataStructure]多项式加法与乘法--B.链表存储(适用于零元系数多的多项式)
- web.xml中Filter,Listener,Servlet的区别