#!/usr/bin/env python import sys from the_semantic_db_code import * from the_semantic_db_functions import * from the_semantic_db_processor import * C = context_list("read letters play") x = ket("letter: f") + ket("letter: r") + ket("letter: o") + ket("letter: g") y = ket("word: frog") + ket("letter: s") def read_letters(one): def extract_letters(x): if x.startswith("letter: "): return x[8:] if x.startswith("word: "): return x[6:] return "" w = "".join(extract_letters(x.label) for x in one.data) if len(w) == 0: return ket("",0) return ket("word: " + w) print("x:",x) print("result:",read_letters(x)) print("y:",y) print("result:",read_letters(y))