// Path: src/crawler/Constants.java
// public interface Constants {
// 	
// 	
// 	//ENTER YOUR KEYS HERE
// 	public static final String YAHOO_API_KEY = "";
// 	public static final String ALCHEMY_API_KEY = "";
// 	
// 	
// 	
// 	public static final String[] STOP_WORDS = {"day", "rt", "new","youtube","happy", "time", "best", "birthday", "good", "love", "yeah"};
// 	
// 	
// 	
// 	public static final String TERM_EXTRACTOR_INPUT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/T_nico-rosberg_content_ouput.txt";
// 	public static final String SEARCH_TWEETS_BY_LOCATION_USERS_OUTPUT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/T_nico-rosberg_users_ouput.txt";
// 	
// 	public static final String TERM_EXTRACTOR_OUTPUT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/TE-nico-rosberg_output.txt";
// 	
// 	// network crawl
// 	public static final String NETWORK_CONTENT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter.txt";
// 	public static final String NETWORK_TERM_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter_term.txt";
// 	
// 
// 	
// 	
// 	
// 	public static final String FORMAL_CONTEXT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter.cxt";
// 	
// 	
// 	// similarity
// 	public static final String SIMILARITY_NETWORK_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter_sim.csv";
// 	
// 	
// 	public static final String IDENTIFIER = "#\\*#"; //"#\\*#"
// 	public static final String NEW_IDENTIFIER = "#~#";
// 	
// 
// }


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.channels.FileChannel;
import crawler.Constants;
package utils;





public class ClearLineBreaks {
	
	public static void clearLineBreaks(String file) throws IOException {
		File temp = File.createTempFile("clearlinebreaks", Long.toString(System.nanoTime()));
		File orig = new File(file);
		
		// read input file line by line
		BufferedReader reader = new BufferedReader(new FileReader(orig));
				
		FileOutputStream fout = new FileOutputStream(temp);
		PrintStream ps = new PrintStream(fout);
		 
		 
		String line = null;

		line = reader.readLine();
		while (line != null) {
			
			ps.println(line.replace("\n", "").replace("\r", ""));
			line = reader.readLine();
		}
	
		 
		

		 ps.close();
		 fout.close();
		 
		 
		// Copy the contents from temp to original file  
		  FileChannel src = new FileInputStream(temp).getChannel();
		  FileChannel dest = new FileOutputStream(orig).getChannel();
		  dest.transferFrom(src, 0, src.size());

		 
	}
	
	public static void fixLineBreaks(String file) throws IOException {
		File temp = File.createTempFile("fixlinebreaks", Long.toString(System.nanoTime()));
		File orig = new File(file);
		
		// read input file line by line
		BufferedReader reader = new BufferedReader(new FileReader(orig));
				
		FileOutputStream fout = new FileOutputStream(temp);
		PrintStream ps = new PrintStream(fout);
		 
		 
		String line = null;

		line = reader.readLine();
		while (line != null) {
// Path: src/crawler/Constants.java
// public interface Constants {
// 	
// 	
// 	//ENTER YOUR KEYS HERE
// 	public static final String YAHOO_API_KEY = "";
// 	public static final String ALCHEMY_API_KEY = "";
// 	
// 	
// 	
// 	public static final String[] STOP_WORDS = {"day", "rt", "new","youtube","happy", "time", "best", "birthday", "good", "love", "yeah"};
// 	
// 	
// 	
// 	public static final String TERM_EXTRACTOR_INPUT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/T_nico-rosberg_content_ouput.txt";
// 	public static final String SEARCH_TWEETS_BY_LOCATION_USERS_OUTPUT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/T_nico-rosberg_users_ouput.txt";
// 	
// 	public static final String TERM_EXTRACTOR_OUTPUT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/TE-nico-rosberg_output.txt";
// 	
// 	// network crawl
// 	public static final String NETWORK_CONTENT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter.txt";
// 	public static final String NETWORK_TERM_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter_term.txt";
// 	
// 
// 	
// 	
// 	
// 	public static final String FORMAL_CONTEXT_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter.cxt";
// 	
// 	
// 	// similarity
// 	public static final String SIMILARITY_NETWORK_FILE = "/Users/cassiomelo/Dropbox/code/twittertest/data/twitter_sim.csv";
// 	
// 	
// 	public static final String IDENTIFIER = "#\\*#"; //"#\\*#"
// 	public static final String NEW_IDENTIFIER = "#~#";
// 	
// 
// }


// Path: src/utils/ClearLineBreaks.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.channels.FileChannel;
import crawler.Constants;

package utils;





public class ClearLineBreaks {
	
	public static void clearLineBreaks(String file) throws IOException {
		File temp = File.createTempFile("clearlinebreaks", Long.toString(System.nanoTime()));
		File orig = new File(file);
		
		// read input file line by line
		BufferedReader reader = new BufferedReader(new FileReader(orig));
				
		FileOutputStream fout = new FileOutputStream(temp);
		PrintStream ps = new PrintStream(fout);
		 
		 
		String line = null;

		line = reader.readLine();
		while (line != null) {
			
			ps.println(line.replace("\n", "").replace("\r", ""));
			line = reader.readLine();
		}
	
		 
		

		 ps.close();
		 fout.close();
		 
		 
		// Copy the contents from temp to original file  
		  FileChannel src = new FileInputStream(temp).getChannel();
		  FileChannel dest = new FileOutputStream(orig).getChannel();
		  dest.transferFrom(src, 0, src.size());

		 
	}
	
	public static void fixLineBreaks(String file) throws IOException {
		File temp = File.createTempFile("fixlinebreaks", Long.toString(System.nanoTime()));
		File orig = new File(file);
		
		// read input file line by line
		BufferedReader reader = new BufferedReader(new FileReader(orig));
				
		FileOutputStream fout = new FileOutputStream(temp);
		PrintStream ps = new PrintStream(fout);
		 
		 
		String line = null;

		line = reader.readLine();
		while (line != null) {
			String [] lineArray = line.split(Constants.IDENTIFIER); 