@@ -0,0 +1,1183 @@
+import java.io.*;%0Aimport java.util.regex.*;%0A%0Aimport org.jsoup.*;%0Aimport org.jsoup.nodes.*;%0Aimport org.jsoup.select.Elements;%0A%0Apublic class MedQAParser %7B%0A%09public static void parser(String inFileName, String outFileName, String savePath) throws IOException %7B%0A%09%09%0A%09%09// create output file%0A%09%09File saveDir = new File(savePath);%0A%09%09if (!saveDir.exists()) %7B%0A%09%09%09saveDir.mkdir();%0A%09%09%7D%0A%09%09String filename = savePath + File.separator + outFileName;%0A%09%09FileOutputStream fos = new FileOutputStream(filename);%0A%09%09%0A%09%09// parse the html file using jsoup%0A%09%09File file = new File(inFileName);%0A%09%09Document doc = Jsoup.parse(file, %22UTF-8%22, %22http://www.120ask.com/%22);%0A%09%09Elements quenames = doc.select(%22a.q-quename%22);%0A%09%09Pattern p = Pattern.compile(%22%5C%5Cs*%7C%5Ct%7C%5Cr%7C%5Cn%22);%0A%09%09for (Element quename : quenames) %7B%0A%09%09      String question = quename.attr(%22title%22);%0A%09%09      Matcher m = p.matcher(question);%0A%09%09      question = m.replaceAll(%22%22);%0A%09%09      question += %22%5Cn%22;%0A%09%09      fos.write(question.getBytes());%0A%09%09%7D%0A%09%09%0A%09%09if (fos != null) %7B%0A%09%09%09fos.close();%0A%09%09%7D%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09try %7B%0A%09%09%09parser(%22./med-qa.txt%22, %22med-qa-clean.txt%22, %22./%22);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09// TODO: handle exception%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create MedQAParser.java