public BigramHiddenMarkovModel(Corpus corpus) {
		this.vocabSize = corpus.getVocabularySize();
		this.numSentences = corpus.getNumSentences();
		this.tagBigrams = new HashMap<String, Map<String,Integer>>();
		this.tagToToken = new HashMap<String, Map<String,Integer>>();
		this.probabilityMatrix = new ArrayList<double[]>();
		
		for(Article a : corpus) {
			for(Sentence s : a) {
				String currToken = "";
				String prevToken = "";
				String currTag = "";
				String prevTag = "";
				
				for(Token token : s) {
					currToken = token.getText();
					currTag = token.getTag();
					
					if (prevToken.equals("")) {
						// only once at beginning of sentence
						prevTag = BEGINNING_OF_SENTENCE;
						if (tagBigrams.get(prevTag) == null) {
							tagBigrams.put(prevTag, new HashMap<String, Integer>());
						}	
					}
					
					if (!tagBigrams.containsKey(currTag)) {
						tagBigrams.put(currTag, new HashMap<String, Integer>());
					}
					Map<String, Integer> tagMap = tagBigrams.get(prevTag);
					if (tagMap.containsKey(currTag)) {
						tagMap.put(currTag, tagMap.get(currTag) + 1);
					} else {
						tagMap.put(currTag, 1);
					}
						
					if (!tagToToken.containsKey(currTag)) {
						tagToToken.put(currTag, new HashMap<String, Integer>());
					}
					Map<String, Integer> tokenMap = tagToToken.get(currTag);
					if (tokenMap.containsKey(currToken)) {
						tokenMap.put(currToken, tokenMap.get(currToken) + 1);
					} else {
						tokenMap.put(currToken, 1);
					}				
					
					prevToken = currToken;
					prevTag = currTag;
				}
			}
		}

	}