### Question:
FNLPCorpus { public void readCWS(String path, String suffix, String charset) throws IOException { List<File> files = MyFiles.getAllFiles(path, suffix); Iterator<File> it = files.iterator(); while(it.hasNext()){ BufferedReader bfr =null; File file = it.next(); try { FileInputStream in = new FileInputStream(file); bfr = new BufferedReader(new UnicodeReader(in,charset)); } catch (FileNotFoundException e) { e.printStackTrace(); } FNLPDoc doc = new FNLPDoc(); doc.name = file.getName(); String line = null; while ((line = bfr.readLine()) != null) { line = line.trim(); if (line.matches("^$")) continue; FNLPSent sent = new FNLPSent(); sent.parseSegedLine(line); doc.add(sent); } add(doc); } } FNLPCorpus(); LinkedList<FNLPDoc> getDocumenList(); void add(FNLPDoc doc); void write(String path); void writeOne(String path); void count(String path,boolean b); void read(String path,String suffix); static void main(String[] args); void readPOS(String path, String suffix, String charset); void readCWS(String path, String suffix, String charset); void readOurCorpus(String path, String suffix, String charset); int getDocumenNum(); int getSentenceNum(); FNLPDoc getDoc(int idx); TreeSet<String> getAllPOS(); TreeSet<String> getAllRelations(); public LinkedList<FNLPDoc> docs; }### Answer:
@Test public void testReadCWS() throws IOException { FNLPCorpus corpus = new FNLPCorpus(); corpus.readCWS("../example-data/seg-bad-case.txt",".txt","UTF8"); corpus.writeOne("../tmp/seg.dat"); System.out.println("Done!"); }