def calc_trigrams(brown_tags): ngrams, corpus_size, sentence_count = n_gramer.make_ngrams_for_corpus(brown_tags, 3, START_SYMBOL, STOP_SYMBOL) n_gramer.calculate_ngram_probabilities(ngrams, corpus_size, sentence_count) # use only trigrams q_values = ngrams[2] return q_values
def calc_trigrams(brown_tags): ngrams, corpus_size, sentence_count = n_gramer.make_ngrams_for_corpus( brown_tags, 3, START_SYMBOL, STOP_SYMBOL) n_gramer.calculate_ngram_probabilities(ngrams, corpus_size, sentence_count) # use only trigrams q_values = ngrams[2] return q_values
def calc_probabilities(training_corpus): # Calculate the probabilies using our external module grams, corpus_size, sentence_count = ngramer.make_ngrams_for_corpus(training_corpus, 3, START_SYMBOL, STOP_SYMBOL) ngramer.calculate_ngram_probabilities(grams, corpus_size, sentence_count) # Transfer back to HW output needed unigram_p = grams[0] bigram_p = grams[1] trigram_p = grams[2] return unigram_p, bigram_p, trigram_p
def calc_probabilities(training_corpus): # Calculate the probabilies using our external module grams, corpus_size, sentence_count = ngramer.make_ngrams_for_corpus( training_corpus, 3, START_SYMBOL, STOP_SYMBOL) ngramer.calculate_ngram_probabilities(grams, corpus_size, sentence_count) # Transfer back to HW output needed unigram_p = grams[0] bigram_p = grams[1] trigram_p = grams[2] return unigram_p, bigram_p, trigram_p
def calc_probabilities(training_corpus): # Calculate the probabilies using our external module grams, corpus_size, sentence_count = ngramer.make_ngrams_for_corpus( training_corpus, 3, START_SYMBOL, STOP_SYMBOL) ngramer.calculate_ngram_probabilities(grams, corpus_size, sentence_count) # Transfer back to HW output needed unigram_p = grams[0] bigram_p = grams[1] trigram_p = grams[2] # TODO: Comment out when submit if ALLOW_TESTS: a_tests.test_grams(unigram_p, bigram_p, trigram_p) return unigram_p, bigram_p, trigram_p