study
할일 밀림...
오늘 할일
1. 스터디 : 2~3시간?
2. SNA 논문 줄이기 : 1시간
3. Test 준비 : 1시간
4. Pattern Recognition 스터디 준비 : 1시간?
5. SNA Seminar : 2 시간?
package kr.ac.snu.bike.etrianalyzer;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import kr.ac.snu.bike.snsdatabase.SNSDatabaseConnector;
public class MakeTextFile {
public static final String KIMJUHA = "kimjuha_bikeiptv";
public static final String LEEKANGY = "leekangy_bikeiptv";
public static final String JAKE = "jakeoh81_bikeiptv";
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SNSDatabaseConnector sdc = new SNSDatabaseConnector();
Connection conn = sdc.getConnection();
String databaseName = LEEKANGY;
sdc.useDatabase(databaseName);
Statement stmt = null;
ResultSet rs = null;
File file = new File(databaseName+".txt");
BufferedWriter writer = null;
try{
stmt = conn.createStatement();
rs = stmt.executeQuery("select tweetid, tweettext from tweet");
writer = new BufferedWriter(new FileWriter(file));
while(rs.next()){
//http로 시작하는 문단제거
// RT 아이디 지움.
// #단락 지움.
// @단락 지움.
String withOutSpecialCharacter = rs.getString(2).replace("
","").replace("
", "");
String[] specialPhrase = withOutSpecialCharacter.split("\\ ");
for(int i=0;i System.out.println(specialPhrase[i]); } String str = rs.getString(1)+ "\t"+ withOutSpecialCharacter; System.out.println(str); //writer.write(str+" "); } if(writer !=null){ writer.close(); } }catch(Exception e){ e.printStackTrace(); } if(rs!=null){ try { rs.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(stmt !=null){ try { stmt.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } sdc.closeConnection(); } }
1. 전처리 모듈.
2. ma 부분 없애고 업데이트.