def gen_cf_diff(diff): #raise NotImplementedError #intlin = Language("jbo")#....... temp = {} for w, d in diff: st = jbo.init_sentence(d, "np") #if len(st) > 1: #TODO:Drop comments # raise NotImplementedError temp[w] = lang_to_case_frame(st[-1]) if PRINT_TO_CONSOLE: print(5*" ", w, "<=>", temp[w]) return temp
def text_to_interlingua(text, first, source_lang): """ Translates the given text written on the source language into interlingua. """ v = source_lang.init_sentence(text, first) for e in v: e.numerate(0) if PRINT_TO_CONSOLE: print() print("ways to understand", len(v)) # print(v) # #tree = v[0] #begin_time = datetime.now() cfs = [] for x in v: cfs += [lang_to_case_frame(x)] return cfs
def test_lang_to_case_frame(self): st = self.ilang.init_sentence("melbi nanla", "np") cf = lang_to_case_frame(st[-1]) print(cf) tcf = \ { concept['noun-phrase']: { concept['noun']: { concept['meaning']: 'nanla', concept['noun-type']: noun_type['common'], concept['form']: None, concept['order-number']: None, concept['real-number']: None, concept['tags']: None }, concept['epithet']: { concept['adjective']: { concept['meaning']: 'melbi', concept['order-number']: None } }, concept['difinity']: difinity['difinite'], #######UNDIFINITE!!!! concept['quantity']: None, concept['quantity-number']: None, concept['persone']: persone['third'] } } self.assertDictEqual(cf, tcf) # AdjToken = Token(TERMINAL_ADJECTIVE) # NounToken = Token(TERMINAL_NOUN) # AdjPhrase = FlowerLingUnit(NONTERMINAL_EPITHET, 0, 0) # NounPhrase = FlowerLingUnit(NONTERMINAL_NOUN_PHRASE, 0, 0) # # AdjPhrase.blocks = [AdjToken] # NounPhrase.left = [AdjPhrase] # NounPhrase.blocks = [NounToken]