def test_sentence_to_ipa__without_caching__executes_custom_func(self): input_dict = {} input_word = "x" res = [ sentence_to_ipa(dict=input_dict, sentence=input_word, replace_unknown_with=lambda _: str(i), use_caching=False) for i in range(2) ] self.assertEqual(["0", "1"], res)
def test_sentence_to_ipa__senrds__return_combination_of_values(self): input_dict = { "A-B": "ab", "A": "c", "B": "d", "'A": "e", "B'": "f", "'A-B": "g", "A-B'": "h", "'A-B'": "i" } input_word = "'A-B#'" res = sentence_to_ipa(input_dict, input_word, "_", use_caching=False) self.assertEqual("g#'", res)
def test_sentence_to_ipa__sentence_with_words_not_in_dict_but_one_of_them_is_only_in_capital_letters__return_underlines_and_values_for_letters( self): input_dict = { "A-B": "ab", "A": "c", "B": "d", "'A": "e", "B'": "f", "'A-B": "g", "A-B'": "h", "'A-B'": "i" } input_word = "abc BA" res = sentence_to_ipa(input_dict, input_word, "_", use_caching=False) self.assertEqual("___ dc", res)