public void recordCorpusData (Corpus c, Learner l){
		if (!isRecording) return;
		this.c=c;
		Vocabulary v = c.getVocabulary();
		Set<Map.Entry<String, Integer>> entrySet = v.getWordIndicesEntrySet();
		Set<Map.Entry<Integer, Word>> wordSet = v.getWordEntrySet();
		StringBuilder s = new StringBuilder(v.getNumOfWords()*30);
		corpusFile = new File(mainPath, "corpus_"+name+".js");
		s.append(String.format("corpus_%1$s = \n{\n\tname:\"%1$s\",\n", name));
		s.append(String.format("\ttokenCount: %1$s,\n", c.tokenCount));
		s.append(String.format("\ttypeCount: %1$s,\n", v.getNumOfWords()));
		s.append(String.format("\tcommonTypes: %1$s,\n", (v.getNumOfWords()-v.countWordsBelowThreshold(l.RARE_WORD_THRESHOLD))));
		s.append(String.format("\tclusterCount: %1$s,\n", l.NUMBER_OF_CLUSTERS));
		//TODO add proper number formatters
		s.append(String.format("\tidentityEps: %1$s,\n", l.IDENTITY_EPSILON));
		s.append(String.format("\titerationCount: %1$s,\n", iterationCounter));
		s.append("\ttypeToId: \n\t{\n\t");
		for (Map.Entry<String, Integer> e: entrySet){
			if (v.getWord(e.getValue()).frequency >= l.RARE_WORD_THRESHOLD){ //TODO see if necessary
				s.append(String.format("\t\t\"%1$s\": %2$s,\n", e.getKey(), e.getValue()));
			}
		}
		s.append("},\n");
		s.append("\tidToType: {");
		for (Map.Entry<Integer, Word> e: wordSet){ //No rare word check here, to keep vector status
			if (e.getValue().frequency >= l.RARE_WORD_THRESHOLD){
				s.append(String.format("\t\t%1$s: \"%2$s\",\n",e.getKey(), e.getValue().name));	
			}
		}
		s.append("}");
		s.append("\n};");
		try {
			corpusFile.createNewFile();
			BufferedWriter out = new BufferedWriter(new FileWriter(corpusFile));
			out.append(s);
			out.close();
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}
public void recordCorpusData (Corpus c, Learner l){
		if (!isRecording) return;
		this.c=c;
		Vocabulary v = c.getVocabulary();
		Set<Map.Entry<String, Integer>> entrySet = v.getWordIndicesEntrySet();
		Set<Map.Entry<Integer, Word>> wordSet = v.getWordEntrySet();
		StringBuilder s = new StringBuilder(v.getNumOfWords()*30);
		corpusFile = new File(mainPath, "corpus_"+name+".js");
		s.append(String.format("corpus_%1$s = \n{\n\tname:\"%1$s\",\n", name));
		s.append(String.format("\ttokenCount: %1$s,\n", c.tokenCount));
		s.append(String.format("\ttypeCount: %1$s,\n", v.getNumOfWords()));
		s.append(String.format("\tcommonTypes: %1$s,\n", (v.getNumOfWords()-v.countWordsBelowThreshold(l.RARE_WORD_THRESHOLD))));
		s.append(String.format("\tclusterCount: %1$s,\n", l.NUMBER_OF_CLUSTERS));
	
		s.append(String.format("\tidentityEps: %1$s,\n", l.IDENTITY_EPSILON));
		s.append(String.format("\titerationCount: %1$s,\n", iterationCounter));
		s.append("\ttypeToId: \n\t{\n\t");
		for (Map.Entry<String, Integer> e: entrySet){
			if (v.getWord(e.getValue()).frequency >= l.RARE_WORD_THRESHOLD){
				s.append(String.format("\t\t\"%1$s\": %2$s,\n", e.getKey(), e.getValue()));
			}
		}
		s.append("},\n");
		s.append("\tidToType: {");
		for (Map.Entry<Integer, Word> e: wordSet){
			if (e.getValue().frequency >= l.RARE_WORD_THRESHOLD){
				s.append(String.format("\t\t%1$s: \"%2$s\",\n",e.getKey(), e.getValue().name));	
			}
		}
		s.append("}");
		s.append("\n};");
		try {
			corpusFile.createNewFile();
			BufferedWriter out = new BufferedWriter(new FileWriter(corpusFile));
			out.append(s);
			out.close();
		} catch (IOException e1) {
		
			e1.printStackTrace();
		}
	}
public void recordcorpusdata (corpus c, learner l){ if (!isrecording) return; this.c=c; vocabulary v = c.getvocabulary(); set<map.entry<string, integer>> entryset = v.getwordindicesentryset(); set<map.entry<integer, word>> wordset = v.getwordentryset(); stringbuilder s = new stringbuilder(v.getnumofwords()*30); corpusfile = new file(mainpath, "corpus_"+name+".js"); s.append(string.format("corpus_%1$s = \n{\n\tname:\"%1$s\",\n", name)); s.append(string.format("\ttokencount: %1$s,\n", c.tokencount)); s.append(string.format("\ttypecount: %1$s,\n", v.getnumofwords())); s.append(string.format("\tcommontypes: %1$s,\n", (v.getnumofwords()-v.countwordsbelowthreshold(l.rare_word_threshold)))); s.append(string.format("\tclustercount: %1$s,\n", l.number_of_clusters)); s.append(string.format("\tidentityeps: %1$s,\n", l.identity_epsilon)); s.append(string.format("\titerationcount: %1$s,\n", iterationcounter)); s.append("\ttypetoid: \n\t{\n\t"); for (map.entry<string, integer> e: entryset){ if (v.getword(e.getvalue()).frequency >= l.rare_word_threshold){ s.append(string.format("\t\t\"%1$s\": %2$s,\n", e.getkey(), e.getvalue())); } } s.append("},\n"); s.append("\tidtotype: {"); for (map.entry<integer, word> e: wordset){ if (e.getvalue().frequency >= l.rare_word_threshold){ s.append(string.format("\t\t%1$s: \"%2$s\",\n",e.getkey(), e.getvalue().name)); } } s.append("}"); s.append("\n};"); try { corpusfile.createnewfile(); bufferedwriter out = new bufferedwriter(new filewriter(corpusfile)); out.append(s); out.close(); } catch (ioexception e1) { e1.printstacktrace(); } }