标注的Trigger的位置是否与句子中的位置相同
来源:互联网 发布:券商研究报告网站 知乎 编辑:程序博客网 时间:2024/06/11 16:41
package AboutProtein;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import java.util.ArrayList;import java.util.List;public class LocRight{public static void main(String args[]){try{File file = new File("F:\\generate jar\\2013_BioEvent");File[] files = file.listFiles();for(int fileId = 0; fileId < files.length; fileId++){String fileName = files[fileId].getName();FileReader frAll = new FileReader(files[fileId]);BufferedReader brAll = new BufferedReader(frAll);FileWriter fw = new FileWriter("F:\\generate jar\\2013BioEvent\\" + fileName);BufferedWriter bw = new BufferedWriter(fw);List<Protein> proAll = new ArrayList<Protein>();List<Protein> proPart = new ArrayList<Protein>();List<Trigger> triList = new ArrayList<Trigger>();//List<Trigger> problem = new ArrayList<Trigger>();List<String> event = new ArrayList<String>();String[] sent = new String[1000];List<String> sentList = new ArrayList<String>();if(fileName.equals("PMC-1134658-00-TIAB.txt")){System.out.println(fileName);}String str;while((str = brAll.readLine()) != null){if(str.length() == 0){for(int tId = 0; tId < triList.size(); tId++){Trigger tr = triList.get(tId);int start = tr.triggerStart;int end = tr.triggerEnd;String name = tr.triggerName;if(start == end){String word = sentList.get(start);if(!word.equals(name)){System.out.println(fileName);System.out.println(name + " " + word);}}else if(start < end){StringBuffer sb = new StringBuffer();for(int j = start; j <= end; j++){if(j == end){sb.append(sentList.get(j));}else{sb.append(sentList.get(j) + " ");}}String word = sb.toString();if(!word.equals(name)){System.out.println(fileName);System.out.println(name + " " + word);}}else {System.out.println("have a problem");}}proAll.clear();proPart.clear();triList.clear();sentList.clear();}else if(str.startsWith("#")){String[] proStr = str.split(" ");StringBuffer proB = new StringBuffer(); for(int prosId = 4; prosId < proStr.length; prosId++){if(prosId == proStr.length - 1){proB.append(proStr[prosId]);}else{proB.append(proStr[prosId] + " ");}}String proName = proB.toString();Protein prot = new Protein();prot.proId = proStr[1];prot.proStart = Integer.parseInt(proStr[2]);prot.proEnd = Integer.parseInt(proStr[3]);prot.proName = proName;proAll.add(prot);}else if(str.startsWith("$")){ String[] proStr = str.split(" ");StringBuffer proB = new StringBuffer(); for(int prosId = 4; prosId < proStr.length; prosId++){if(prosId == proStr.length - 1){proB.append(proStr[prosId]);}else{proB.append(proStr[prosId] + " ");}}String proName = proB.toString();Protein prot = new Protein();prot.proId = proStr[1];prot.proStart = Integer.parseInt(proStr[2]);prot.proEnd = Integer.parseInt(proStr[3]);prot.proName = proName;proPart.add(prot);}else if(str.startsWith("@")){String[] trit = str.split(" ");StringBuffer triB = new StringBuffer(); for(int prosId = 5; prosId < trit.length; prosId++){if(prosId == trit.length - 1){triB.append(trit[prosId]);}else{triB.append(trit[prosId] + " ");}}String triName = triB.toString();Trigger trig = new Trigger();trig.triggerId = trit[1];trig.triggerType = trit[2];trig.triggerStart = Integer.parseInt(trit[3]);trig.triggerEnd = Integer.parseInt(trit[4]);trig.triggerName = triName;triList.add(trig);}else if(str.startsWith("%")){event.add(str);}else{sent = str.split(" ");for(int j = 0; j < sent.length; j++){sentList.add(sent[j]);}}}brAll.close();frAll.close();}}catch(IOException io){io.printStackTrace();}}}
0 0
- 标注的Trigger的位置是否与句子中的位置相同
- 位置与地图(二)地图的使用以及标注地图
- echo的时候如何让原句子中的空格位置不断开为两个句子
- 查找两个字符串中的相同的字符位置
- 运用字符串中位置的调换,比较一个旋转与另一个字符串是否相同。上篇博客的拓展。
- 简单LinuxC程序关于倒置句子中的单词位置(指针的使用)
- 如何让两个switch的位置相同
- tensorflow不同位置使用相同的name_scope
- 寻找数组中相同值的位置
- 分享一个bat脚本,比较文件输出是否相同,并输出第一个不同的位置
- 将句子中的单词位置反转
- Canvas的饼图百分比标注位置计算技巧
- 18.5 位置与地图:创建标注视图
- 如何获得 Qt窗口部件在主窗口中的位置--确定鼠标是否在某一控件上与在控件上的位置
- 如何获得 Qt窗口部件在主窗口中的位置--确定鼠标是否在某一控件上与在控件上的位置
- 如何获得 Qt窗口部件在主窗口中的位置--确定鼠标是否在某一控件上与在控件上的位置
- 找到 list中具有相同属性对象中的 第一个的 位置
- HEVC 当前帧与参考帧的同一位置的PU划分相同概率
- uwsgi 热启动
- 如何实现一个搜索引擎(1):构建索引 How to Implement a Search Engine Part 1: Create Index
- 设计模式-中介者模式
- iOS开发中,怎么打包为ipa格式的软件包以及怎么安装到手机终端上
- css3-对齐、分类、导航栏
- 标注的Trigger的位置是否与句子中的位置相同
- nginx深入研究
- 极路由修改为openwrt源并安装transmission挂pt
- Canvas的drawTextOnPath参数含义
- 高斯消元发
- C#中几种常见的字符串方法
- JS之页面自动跳转
- android 自定义View在弹出的软键盘之上,以及测量软键盘高度和监听软键盘状态
- objective-c -- nil / Nil / NULL / NSNull