def run(self, data): results = [] pos_parsed = {} try: for corpus in data: temp_bubble = SPLAT(corpus.contents) pos_tags = temp_bubble.pos() pos_counts = temp_bubble.pos_counts() for k, v in pos_tags: if v in pos_parsed.keys(): if k not in pos_parsed[v]: pos_parsed[v].append(k) else: pos_parsed[v] = [] pos_parsed[v].append(k) results.append({ 'corpus_id': corpus.id, 'pos_tags': pos_parsed, 'pos_counts': pos_counts }) results = json.dumps(results) print(results) return results except TypeError as e: print(e) raise TransactionException('Failed to run SplatPOSFrequencies.')
def run(self, data): results = [] first = {} second = {} third = {} try: for corpus in data: temp_corpus = " ".join(re.split(r'\s|\n', corpus.contents)) temp_bubble = SPLAT(temp_corpus.rstrip("\n")) pronouns = temp_bubble.raw_pronouns() print(pronouns) sents = temp_bubble.sents() for p, v in pronouns.items(): if v[1] == "1st-Person": first[p] = v elif v[1] == "2nd-Person": second[p] = v elif v[1] == "3rd-Person": third[p] = v results.append({ 'corpus_id': corpus.id, 'first-person': first, 'second-person': second, 'third-person': third, 'sentences': sents }) results = json.dumps(results) print(results) return results except TypeError as e: print(e) raise TransactionException("Failed to run SplatPronouns.")
def test_syllabic_r(self): expected_history = 3 output_history = SPLAT("history").syllables() self.assertEqual(output_history, expected_history) expected_hungary = 3 output_hungary = SPLAT("hungary").syllables() self.assertEqual(output_hungary, expected_hungary) expected_preference = 3 output_preference = SPLAT("preference").syllables() self.assertEqual(output_preference, expected_preference)
def test_syllabic_ng(self): expected_going = 2 output_going = SPLAT("going").syllables() self.assertEqual(output_going, expected_going) expected_listening = 3 output_listening = SPLAT("listening").syllables() self.assertEqual(output_listening, expected_listening) expected_ringing = 2 output_ringing = SPLAT("ringing").syllables() self.assertEqual(output_ringing, expected_ringing)
def test_suffixes(self): expected_added = 2 output_added = SPLAT("added").syllables() self.assertEqual(output_added, expected_added) expected_apples = 2 output_apples = SPLAT("apples").syllables() self.assertEqual(output_apples, expected_apples) expected_foxes = 2 output_foxes = SPLAT("foxes").syllables() self.assertEqual(output_foxes, expected_foxes) expected_auntie = 2 output_auntie = SPLAT("auntie").syllables() self.assertEqual(output_auntie, expected_auntie)
def test_syllabic_m(self): expected_heroism = 4 output_heroism = SPLAT("heroism").syllables() self.assertEqual(output_heroism, expected_heroism) expected_feudalism = 4 output_feudalism = SPLAT("feudalism").syllables() self.assertEqual(output_feudalism, expected_feudalism) expected_blossom = 2 output_blossom = SPLAT("blossom").syllables() self.assertEqual(output_blossom, expected_blossom) expected_rhythm = 2 output_rhythm = SPLAT("rhythm").syllables() self.assertEqual(output_rhythm, expected_rhythm)
def test_special_cases(self): expected_australian = 3 output_australian = SPLAT("australian").syllables() self.assertEqual(output_australian, expected_australian) expected_literal = 3 output_literal = SPLAT("literal").syllables() self.assertEqual(output_literal, expected_literal) expected_forebodings = 3 output_forebodings = SPLAT("forebodings").syllables() self.assertEqual(output_forebodings, expected_forebodings) expected_pterodactyl = 4 output_pterodactyl = SPLAT("pterodactyl").syllables() #self.assertEqual(output_pterodactyl, expected_pterodactyl) self.assertLessEqual(abs(expected_pterodactyl - output_pterodactyl), 1)
def test_proper_names(self): expected_benjamin = 3 output_benjamin = SPLAT("benjamin").syllables() self.assertEqual(output_benjamin, expected_benjamin) expected_emily = 3 output_emily = SPLAT("emily").syllables() self.assertEqual(output_emily, expected_emily) expected_cissi = 2 output_cissi = SPLAT("cissi").syllables() self.assertEqual(output_cissi, expected_cissi) expected_cecilia = 3 output_cecilia = SPLAT("cecilia").syllables() self.assertEqual(output_cecilia, expected_cecilia) expected_ares = 2 output_ares = SPLAT("ares").syllables() #self.assertEqual(output_ares, expected_ares) self.assertLessEqual(abs(expected_ares - output_ares), 1)
def test_bad_input(self): try: dummy_splat = SPLAT([]) except ValueError as e: self.assertEqual(e.args[0], "WARNING: SPLAT must be of type str or file.") except TypeError as e: self.assertEqual( e.args[0], "argument should be string, bytes or integer, not list")
def run(self, data): results = [] syllables_parsed = {} try: for corpus in data: # temp_bubble = SPLAT(corpus.contents) split_string = re.split(r'\s|\n', corpus.contents) temp_corpus = list(filter("{SL}".__ne__, split_string)) temp_corpus = list(filter("{sl}".__ne__, temp_corpus)) temp_corpus_contents = " ".join(temp_corpus) temp_bubble = SPLAT(temp_corpus_contents.rstrip('\n')) temp_tokens = temp_bubble.tokens() temp_tokens = ' '.join(temp_tokens).strip("\n").split(' ') print(temp_tokens) for tok in temp_tokens: temp_tok = tok.strip("\n") temp_syll_count = cUtil.num_syllables([temp_tok]) if temp_syll_count == 0: temp_syll_count = 1 if str(temp_syll_count) in syllables_parsed.keys(): if tok not in syllables_parsed[str(temp_syll_count)]: syllables_parsed[str(temp_syll_count)].append( temp_tok) else: syllables_parsed[str(temp_syll_count)] = [] syllables_parsed[str(temp_syll_count)].append(temp_tok) print("Creating results...") results.append({ 'corpus_id': corpus.id, 'syllables': syllables_parsed }) results = json.dumps(results) print(results) return results except TypeError as e: print(e) raise TransactionException('Failed to run SplatSyllables.')
def run(self, data): results = [] try: for corpus in data: temp_bubble = SPLAT(corpus.contents) # Gather Unigram Frequencies temp_unigrams = temp_bubble.unigrams() unigrams = dict() for item in temp_unigrams: unigrams[item[0]] = unigrams.get(item[0], 0) + 1 # Gather Bigram Frequencies temp_bigrams = temp_bubble.bigrams() bigrams = dict() for item in temp_bigrams: parsed_item = ' '.join(item) bigrams[parsed_item] = bigrams.get(parsed_item, 0) + 1 # Gather Trigram Frequencies temp_trigrams = temp_bubble.trigrams() trigrams = dict() for item in temp_trigrams: parsed_item = ' '.join(item) trigrams[parsed_item] = trigrams.get(parsed_item, 0) + 1 results.append({ 'corpus_id': corpus.id, 'unigrams': unigrams, 'bigrams': bigrams, 'trigrams': trigrams }) results = json.dumps(results) # print(results) return results except TypeError: raise TransactionException('Corpus contents does not exist.')
def run(self, data): results = [] try: for corpus in data: split_string = corpus.contents.split(" ") temp_corpus = list(filter("{SL}".__ne__, split_string)) temp_corpus = list(filter("{sl}".__ne__, temp_corpus)) temp_corpus_contents = " ".join(temp_corpus) # print(corpus.contents) temp_bubble = SPLAT(temp_corpus_contents) temp_trees = TreeStringParser().get_parse_trees( temp_bubble.sents()) # print(temp_bubble.splat()) # cdensity = temp_bubble.content_density() cdensity = cUtil.calc_content_density(temp_trees) print(cdensity) # print(temp_bubble.treestrings()) # idensity = temp_bubble.idea_density() idensity = cUtil.calc_idea_density(temp_trees)[0] # print(idensity) flesch_score = temp_bubble.flesch_readability() # print(flesch_score) kincaid_score = temp_bubble.kincaid_grade_level() # print(kincaid_score) types = len(temp_bubble.types()) tokens = len(temp_bubble.tokens()) type_token_ratio = float(float(types) / float(tokens)) results.append({ 'corpus_id': corpus.id, 'content_density': cdensity, 'idea_density': idensity, 'flesch_score': flesch_score, 'kincaid_score': kincaid_score, 'types': types, 'tokens': tokens, 'type_token_ratio': type_token_ratio }) results = json.dumps(results) # print(results) return results except TypeError as e: print(e) raise TransactionException('Corpus contents does not exist.')
def test_syllabic_n(self): expected_cotton = 2 output_cotton = SPLAT("cotton").syllables() self.assertEqual(output_cotton, expected_cotton) expected_button = 2 output_button = SPLAT("button").syllables() self.assertEqual(output_button, expected_button) expected_risen = 2 output_risen = SPLAT("risen").syllables() self.assertEqual(output_risen, expected_risen) expected_prison = 2 output_prison = SPLAT("prison").syllables() self.assertEqual(output_prison, expected_prison) expected_sadden = 2 output_sadden = SPLAT("sadden").syllables() self.assertEqual(output_sadden, expected_sadden) expected_listen = 2 output_listen = SPLAT("listen").syllables() self.assertEqual(output_listen, expected_listen) expected_even = 2 output_even = SPLAT("even").syllables() self.assertEqual(output_even, expected_even)
def test_special_cases(self): expected_australian = 3 output_australian = SPLAT("australian").syllables() self.assertEqual(output_australian, expected_australian) expected_literal = 3 output_literal = SPLAT("literal").syllables() self.assertEqual(output_literal, expected_literal) expected_forebodings = 3 output_forebodings = SPLAT("forebodings").syllables() self.assertEqual(output_forebodings, expected_forebodings) expected_pterodactyl = 4 output_pterodactyl = SPLAT("pterodactyl").syllables() self.assertLessEqual(abs(expected_pterodactyl - output_pterodactyl), 1) expected_wh = 1 output_wh = SPLAT("wh").syllables() self.assertEqual(output_wh, expected_wh) expected_am = 1 output_am = SPLAT("am").syllables() self.assertEqual(output_am, expected_am) expected_s_hyphen = 1 output_s_hyphen = SPLAT("s-").syllables() self.assertEqual(output_s_hyphen, expected_s_hyphen)
def test_syllabic_l(self): expected_mantle = 2 output_mantle = SPLAT("mantle").syllables() self.assertEqual(output_mantle, expected_mantle) expected_bottle = 2 output_bottle = SPLAT("bottle").syllables() self.assertEqual(output_bottle, expected_bottle) expected_saddle = 2 output_saddle = SPLAT("saddle").syllables() self.assertEqual(output_saddle, expected_saddle) expected_poodle = 2 output_poodle = SPLAT("poodle").syllables() self.assertEqual(output_poodle, expected_poodle) expected_pistol = 2 output_pistol = SPLAT("pistol").syllables() self.assertEqual(output_pistol, expected_pistol) expected_tunnel = 2 output_tunnel = SPLAT("tunnel").syllables() self.assertEqual(output_tunnel, expected_tunnel)
def run(self, data): results = [] try: for corpus in data: temp_bubble = SPLAT(corpus.contents) print(corpus.contents) print(temp_bubble.sents()) raw_disfluencies = Util.count_disfluencies(temp_bubble.sents()) print(raw_disfluencies) sentences = {} average_disfluencies = 0 um_count, uh_count, ah_count, er_count, hm_count, sl_count, rep_count, brk_count = ( 0, ) * 8 # Sort the data so it looks better in JSON for i in raw_disfluencies[0]: temp_dis = { "UM": raw_disfluencies[0][i][0], "UH": raw_disfluencies[0][i][1], "AH": raw_disfluencies[0][i][2], "ER": raw_disfluencies[0][i][3], "HM": raw_disfluencies[0][i][4], "SILENT PAUSE": raw_disfluencies[0][i][5], "REPETITION": raw_disfluencies[0][i][6], "BREAK": raw_disfluencies[0][i][7] } sentences[i] = temp_dis for (k, v) in temp_dis.items(): # Gather total disfluencies for each disfluency type average_disfluencies += v if k == "UM": um_count += v elif k == "UH": uh_count += v elif k == "AH": ah_count += v elif k == "ER": er_count += v elif k == "HM": hm_count += v elif k == "SILENT PAUSE": sl_count += v elif k == "REPETITION": rep_count += v elif k == "BREAK": brk_count += v temp_total = average_disfluencies # Calculate the average disfluencies per sentence in the whole text average_disfluencies = float(average_disfluencies / len(raw_disfluencies[0])) total_disfluencies = { "UM": um_count, "UH": uh_count, "AH": ah_count, "ER": er_count, "HM": hm_count, "SILENT PAUSE": sl_count, "REPETITION": rep_count, "BREAK": brk_count, "TOTAL": temp_total } results.append({ 'corpus_id': corpus.id, 'sentences': sentences, 'average_disfluencies_per_sentence': average_disfluencies, 'total_disfluencies': total_disfluencies }) results = json.dumps(results) print(results) return results except TypeError: raise TransactionException('Corpus contents does not exist.')
class TestBasics(unittest.TestCase): whitman_splat = SPLAT("tests/whitman_test.txt") frankenstein_splat = SPLAT("tests/frankenstein_test.txt") flesch_splat = SPLAT("tests/flesch_kincaid_test.txt") def test_bad_input(self): try: dummy_splat = SPLAT([]) except ValueError as e: self.assertEqual(e.args[0], "WARNING: SPLAT must be of type str or file.") except TypeError as e: self.assertEqual( e.args[0], "argument should be string, bytes or integer, not list") def test_sents(self): expected = [ 'I celebrate myself, and sing myself, And what I assume you shall assume, For every atom belonging to me as good belongs to you.' ] output = self.whitman_splat.sents() unexpected = self.frankenstein_splat.sents() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_sentcount(self): expected = 2 output = self.frankenstein_splat.sentcount() unexpected = self.whitman_splat.sentcount() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_utts(self): expected = [ 'I celebrate myself, and sing myself,', 'And what I assume you shall assume,', 'For every atom belonging to me as good belongs to you.' ] output = self.whitman_splat.utts() unexpected = self.frankenstein_splat.utts() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_uttcount(self): expected = 3 output = self.frankenstein_splat.uttcount() unexpected = self.flesch_splat.uttcount() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_tokens(self): expected = [ 'i', 'celebrate', 'myself', 'and', 'sing', 'myself', 'and', 'what', 'i', 'assume', 'you', 'shall', 'assume', 'for', 'every', 'atom', 'belonging', 'to', 'me', 'as', 'good', 'belongs', 'to', 'you' ] output = self.whitman_splat.tokens() unexpected = self.frankenstein_splat.tokens() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_rawtokens(self): expected = [ 'I', 'celebrate', 'myself,', 'and', 'sing', 'myself,', 'And', 'what', 'I', 'assume', 'you', 'shall', 'assume,', 'For', 'every', 'atom', 'belonging', 'to', 'me', 'as', 'good', 'belongs', 'to', 'you.' ] output = self.whitman_splat.rawtokens() unexpected = self.whitman_splat.tokens() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_types(self): expected = [('and', 2), ('as', 1), ('assume', 2), ('atom', 1), ('belonging', 1), ('belongs', 1), ('celebrate', 1), ('every', 1), ('for', 1), ('good', 1), ('i', 2), ('me', 1), ('myself', 2), ('shall', 1), ('sing', 1), ('to', 2), ('what', 1), ('you', 2)] output = self.whitman_splat.types() unexpected = self.frankenstein_splat.types() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_rawtypes(self): expected = [('And', 1), ('For', 1), ('I', 2), ('and', 1), ('as', 1), ('assume', 1), ('assume,', 1), ('atom', 1), ('belonging', 1), ('belongs', 1), ('celebrate', 1), ('every', 1), ('good', 1), ('me', 1), ('myself,', 2), ('shall', 1), ('sing', 1), ('to', 2), ('what', 1), ('you', 1), ('you.', 1)] output = self.whitman_splat.rawtypes() unexpected = self.whitman_splat.types() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_type_token_ratio(self): expected = 0.8163 output = self.frankenstein_splat.type_token_ratio() unexpected = self.whitman_splat.type_token_ratio() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_syllables(self): expected = 25 output = self.flesch_splat.syllables() self.assertLessEqual(abs(expected - output), 1) def test_wordcount(self): expected = 49 output = self.frankenstein_splat.wordcount() unexpected = self.whitman_splat.wordcount() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_unique_wordcount(self): expected = 18 output = self.whitman_splat.unique_wordcount() unexpected = self.frankenstein_splat.unique_wordcount() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_content_words(self): expected = [ 'rejoice', 'hear', 'disaster', 'accompanied', 'commencement', 'enterprise', 'regarded', 'evil', 'forebodings', 'arrived', 'yesterday', 'first', 'task', 'assure', 'dear', 'sister', 'welfare', 'increasing', 'confidence', 'success', 'undertaking' ] output = self.frankenstein_splat.content_words() unexpected = self.whitman_splat.content_words() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_function_words(self): expected = [ 'you', 'will', 'to', 'that', 'no', 'has', 'the', 'of', 'an', 'which', 'you', 'have', 'with', 'such', 'i', 'here', 'and', 'my', 'is', 'to', 'my', 'of', 'my', 'and', 'in', 'the', 'of', 'my' ] output = self.frankenstein_splat.function_words() unexpected = self.whitman_splat.function_words() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_content_function_ratio(self): expected = 0.75 output = self.frankenstein_splat.content_function_ratio() unexpected = self.whitman_splat.content_function_ratio() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_unique_content_words(self): expected = [ 'assume', 'atom', 'belonging', 'belongs', 'celebrate', 'every', 'good', 'shall', 'sing' ] output = self.whitman_splat.unique_content_words() unexpected = self.frankenstein_splat.unique_content_words() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_unique_function_words(self): expected = [ 'and', 'as', 'for', 'i', 'me', 'myself', 'to', 'what', 'you' ] output = self.whitman_splat.unique_function_words() unexpected = self.frankenstein_splat.unique_function_words() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected)
#!/usr/bin/env python3 ##### PYTHON IMPORTS ################################################################################################### import unittest, sys ##### SPLAT IMPORTS #################################################################################################### from splat.SPLAT import SPLAT whitman_splat = SPLAT("tests/whitman_test.txt") frankenstein_splat = SPLAT("tests/frankenstein_test.txt") flesch_splat = SPLAT("tests/flesch_kincaid_test.txt") roark_splat = SPLAT("tests/roark_sample.txt") class TestLogistics(unittest.TestCase): def test_bad_input(self): try: dummy_splat = SPLAT([]) except ValueError as e: self.assertEqual(e.args[0], "WARNING: SPLAT must be of type str or file.") except TypeError as e: self.assertEqual( e.args[0], "argument should be string, bytes or integer, not list") class TestLexicalFeatures(unittest.TestCase): global whitman_splat, frankenstein_splat def test_tokens(self):
class TestComplexity(unittest.TestCase): whitman_splat = SPLAT("tests/whitman_test.txt") frankenstein_splat = SPLAT("tests/frankenstein_test.txt") flesch_splat = SPLAT("tests/flesch_kincaid_test.txt") roark_splat = SPLAT("tests/roark_sample.txt") def test_mean_idea_density(self): expected_whitman = 0.5137 output_whitman = self.whitman_splat.idea_density() self.assertAlmostEqual(output_whitman, expected_whitman, 4) expected_frankenstein = 0.5623 output_frankenstein = self.frankenstein_splat.idea_density() self.assertAlmostEqual(output_frankenstein, expected_frankenstein, 4) expected_roark = 0.2500 output_roark = self.roark_splat.idea_density() self.assertAlmostEqual(output_roark, expected_roark, 4) expected_flesch = 0.3846 output_flesch = self.flesch_splat.idea_density() self.assertAlmostEqual(output_flesch, expected_flesch, 4) def test_max_idea_density(self): expected_whitman = 0.6364 output_whitman = self.whitman_splat.max_idea_density() self.assertAlmostEqual(output_whitman, expected_whitman, 4) expected_frankenstein = 0.7500 output_frankenstein = self.frankenstein_splat.max_idea_density() self.assertAlmostEqual(output_frankenstein, expected_frankenstein, 4) expected_roark = 0.2500 output_roark = self.roark_splat.max_idea_density() self.assertAlmostEqual(output_roark, expected_roark, 4) expected_flesch = 0.3846 output_flesch = self.flesch_splat.max_idea_density() self.assertAlmostEqual(output_flesch, expected_flesch, 4) def test_min_idea_density(self): expected_whitman = 0.3333 output_whitman = self.whitman_splat.min_idea_density() self.assertAlmostEqual(output_whitman, expected_whitman, 4) expected_frankenstein = 0.3913 output_frankenstein = self.frankenstein_splat.min_idea_density() self.assertAlmostEqual(output_frankenstein, expected_frankenstein, 4) expected_roark = 0.2500 output_roark = self.roark_splat.min_idea_density() self.assertAlmostEqual(output_roark, expected_roark, 4) expected_flesch = 0.3846 output_flesch = self.flesch_splat.min_idea_density() self.assertAlmostEqual(output_flesch, expected_flesch, 4) def test_mean_content_density(self): expected_whitman = 1.0778 output_whitman = self.whitman_splat.content_density() self.assertAlmostEqual(output_whitman, expected_whitman, 4) expected_frankenstein = 1.6970 output_frankenstein = self.frankenstein_splat.content_density() self.assertAlmostEqual(output_frankenstein, expected_frankenstein, 4) expected_roark = 1.0000 output_roark = self.roark_splat.content_density() self.assertAlmostEqual(output_roark, expected_roark, 4) expected_flesch = 1.6000 output_flesch = self.flesch_splat.content_density() self.assertAlmostEqual(output_flesch, expected_flesch, 4) def test_max_content_density(self): expected_whitman = 2.0000 output_whitman = self.whitman_splat.max_content_density() self.assertAlmostEqual(output_whitman, expected_whitman, 4) expected_frankenstein = 3.0000 output_frankenstein = self.frankenstein_splat.max_content_density() self.assertAlmostEqual(output_frankenstein, expected_frankenstein, 4) expected_roark = 1.0000 output_roark = self.roark_splat.max_content_density() self.assertAlmostEqual(output_roark, expected_roark, 4) expected_flesch = 1.6000 output_flesch = self.flesch_splat.max_content_density() self.assertAlmostEqual(output_flesch, expected_flesch, 4) def test_min_content_density(self): expected_whitman = 0.4000 output_whitman = self.whitman_splat.min_content_density() self.assertAlmostEqual(output_whitman, expected_whitman, 4) expected_frankenstein = 1.0000 output_frankenstein = self.frankenstein_splat.min_content_density() self.assertAlmostEqual(output_frankenstein, expected_frankenstein, 4) expected_roark = 1.0000 output_roark = self.roark_splat.min_content_density() self.assertAlmostEqual(output_roark, expected_roark, 4) expected_flesch = 1.6000 output_flesch = self.flesch_splat.min_content_density() self.assertAlmostEqual(output_flesch, expected_flesch, 4) def test_tree_based_yngve(self): expected = 1.1250 output = self.roark_splat.tree_based_yngve_score() unexpected = self.whitman_splat.tree_based_yngve_score() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_tree_based_frazier(self): expected = 0.9375 output = self.roark_splat.tree_based_frazier_score() unexpected = self.whitman_splat.tree_based_frazier_score() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected) def test_flesch_readability(self): expected = 37.5 output = self.flesch_splat.flesch_readability() self.assertAlmostEqual(output, expected, 1) def test_flesch_kincaid(self): expected = 11.3 output = self.flesch_splat.kincaid_grade_level() unexpected = self.whitman_splat.kincaid_grade_level() self.assertEqual(output, expected) self.assertNotEqual(output, unexpected)