<commit_before>package week5;

import java.util.BitSet;

import week3.BooleanModel;
import week3.Document;

/**
 * Implements the Boolean Model using the vector space model
 * @author harryscells
 *
 */
public class VectorSpaceModel extends BooleanModel{

	VectorSpaceModel() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	public void addDocument(Document document) {
		documentmap.put(documentmap.size(), document);
	}
	
	public void addTerm(String term) {
		index.put(term, new BitSet());
	}
	
	public float calculateCosineSimilarity(Document d, Query q) {
		return 0;
	}
	
	public float calculateIDF(Term t) {
		return 0;
	}

}<commit_msg>make a start on some of the calculations<commit_after>package week5;

import java.util.BitSet;
import java.util.HashMap;

import week3.BooleanModel;
import week3.Document;

/**
 * Implements the Boolean Model using the vector space model
 * @author harryscells
 *
 */
public class VectorSpaceModel extends BooleanModel{

	private HashMap<Term, BitSet> index = new HashMap<Term, BitSet>();
	
	VectorSpaceModel() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	public void addDocument(Document document) {
		documentmap.put(documentmap.size(), document);
	}
	
	/**
	 * Adds a term with it's frequency to the index
	 * @param term 		The actual term string
	 * @param frequency	The total frequency in all documents
	 */
	public void addTerm(String term, int frequency) {
		Term t = new Term(term, frequency);
		index.put(t, new BitSet());
	}
	
	public double calculateCosineSimilarity(Document d, Query q) {
		return 0;
	}
	
	public double calculateIDF(Term t) {
		return 0;
	}
	
	public double precalculateTFIDF(double tf, double df, int num_docs) {
		return ((Math.log(tf) + 1) * Math.log(index.size()/num_docs)) / Math.sqrt(1/* lol what actually goes here? */);
	}

}
{'fraction_non_alphanumeric': 0.10572207084468666, 'fraction_numerical': 0.006539509536784741, 'mean_word_length': 4.1, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3605602', 'n_tokens_mistral': 611, 'n_tokens_neox': 559, 'n_words': 178}