# # e n g l i s h . p y # TITLE = "*title" END = -1 noun1 = {TITLE: "Noun", 1: [("book",END), ("table",END),("top",END),("cover",END)] } article = {TITLE: "Article", 1: [("the",END), ("a",END)] } adjective = {TITLE: "Adjective", 1: [("big",END), ("small",END), ("red",END)] } preposition = {TITLE: "Preposition", 1: [("on",END), ("of",END), ("in",END),("with",END)] } relPronoun = {TITLE: "Relative Pronoun", 1: [("that",END), ("which",END)] } verb = { TITLE: "Verb", 1: [("is",END)] } noun2 = {TITLE: "Noun2", 1: [(article, 2)], 2: [(adjective, 2), (noun1, END)] } prepPhrase = {TITLE: "Prepositional Phrase", 1: [(preposition, 2)], 2: [(noun2, END)] } noun3 = {TITLE: "Noun-3", 1: [(noun2, END), (noun2, 2)], 2: [(prepPhrase, END), (prepPhrase, 2)] } prepPhrase[2] = [ (noun3, END)] if __name__ == "__main__" : import rtn, string, sys s = string.join(sys.argv[1:]) for t in rtn.match3(noun3,s) : rtn.display(t)