EventParser { public static Map<EventEnum, Map<String, Integer>> parseEvent(File file){ if(null==file || !file.exists()) return null; System.out.println(file.getName()+"==========================="); LOGGER.debug("开始处理文件：{}", file.getName()); LineProcessor<Map<EventEnum, Map<String, Integer>>> linePorcessor = new EventProcessor(); try { Files.readLines(file, Charsets.UTF_8, linePorcessor); } catch (IOException e) { LOGGER.error("读取文件失败", e); } return linePorcessor.getResult(); }  static Map<EventEnum, Map<String, Integer>> parseEvent(File file);  }
@Test public void parseEvent() throws Exception { String path=FileUtils.corpousPath+"/train/train-arg.txt"; System.out.println(path); File file = new File(path); Assert.assertTrue(null!=file && file.exists()); Map<EventEnum, Map<String, Integer>> map = EventParser.parseEvent(file); Assert.assertTrue(map != null); LOGGER.info(map.toString()); FileUtils.loadMapStringMap(map, new File("train-trigger-counter.txt")); }
@Test public void parseTestCorpusEvent() throws Exception { String path=FileUtils.corpousPath+"/train/test-arg.txt"; System.out.println(path); File file = new File(path); Assert.assertTrue(null!=file && file.exists()); Map<EventEnum, Map<String, Integer>> map = EventParser.parseEvent(file); Assert.assertTrue(map != null); LOGGER.info(map.toString()); FileUtils.loadMapStringMap(map, new File("test-trigger-counter.txt")); }