package com.grayben.riskExtractor.htmlScorer;

import java.io.File;
import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;

public class HtmlScorer {
	
	NodeTraversor nt;
	NodeVisitor nv;

	public static void main(String[] args) throws IOException {
		System.out.println("Starting parse");
		File input = null;
		Document doc = null;
		int numDocuments = 100;
		
		// 
					doc = Jsoup.connect("http://google.com/").get();
					Elements elements = doc.select("*");
					String toHtml = elements.text();
					System.out.print(toHtml);
					
					NodeVisitor flattener = new ScoringAndFlatteningNodeVisitor();
					NodeTraversor nt = new NodeTraversor(flattener);
					nt.traverse(doc);
		
		final long startTime = System.currentTimeMillis();
		for(int i = 1; i <= numDocuments; i++){
			input = new File("/Volumes/MBS Data/EDGAR-Form10K/filings/" + i + ".txt");
			doc = Jsoup.parse(input, "ASCII");
			elements = doc.select("*");
			String html = elements.text();
			System.out.print(html);
			
			
		}
		final long endTime = System.currentTimeMillis();
		final long dT = endTime - startTime;
		final long secondsElapsed = dT/1000;
		System.out.println("Finished parsing: " 
				+ numDocuments + " in " + secondsElapsed + " seconds.");
		
		
	}

}

@@ -390,1000 +390,71 @@
 %7B%0A%09%09
-System.out.println(%22Starting parse%22);%0A%09%09File input = null;%0A%09%09Document doc = null;%0A%09%09int numDocuments = 100;%0A%09%09%0A%09%09// %0A%09%09%09%09%09doc = Jsoup.connect(%22http://google.com/%22).get();%0A%09%09%09%09%09Elements elements = doc.select(%22*%22);%0A%09%09%09%09%09String toHtml = elements.text();%0A%09%09%09%09%09System.out.print(toHtml);%0A%09%09%09%09%09%0A%09%09%09%09%09NodeVisitor flattener = new ScoringAndFlatteningNodeVisitor();%0A%09%09%09%09%09NodeTraversor nt = new NodeTraversor(flattener);%0A%09%09%09%09%09nt.traverse(doc);%0A%09%09%0A%09%09final long startTime = System.currentTimeMillis();%0A%09%09for(int i = 1; i %3C= numDocuments; i++)%7B%0A%09%09%09input = new File(%22/Volumes/MBS Data/EDGAR-Form10K/filings/%22 + i + %22.txt%22);%0A%09%09%09doc = Jsoup.parse(input, %22ASCII%22);%0A%09%09%09elements = doc.select(%22*%22);%0A%09%09%09String html = elements.text();%0A%09%09%09System.out.print(html);%0A%09%09%09%0A%09%09%09%0A%09%09%7D%0A%09%09final long endTime = System.currentTimeMillis();%0A%09%09final long dT = endTime - startTime;%0A%09%09final long secondsElapsed = dT/1000;%0A%09%09System.out.println(%22Finished parsing: %22 %0A%09%09%09%09+ numDocuments + %22 in %22 + secondsElapsed + %22 seconds.%22);%0A%09%09%0A%09%09%0A%09%7D%0A
+Document doc = Jsoup.connect(%22http://google.com/%22).get();%0A%09%7D%0A%09%0A%09
 %0A%7D%0A

Remove crap from htmlScorer