예제 #1
0
def run():
	def show(s):
		print
		print s
		for i, x in enumerate(l.read(s)):
			print "%d. " % i, x

	w = build_words()

	l = Lect("ltq")
	l.name = u"Latejami"
	l.english_name = u"Latejami"
	l.append_p_o_s(u"V", ("argument-structure",), ())
	l.append_p_o_s(u"N", ("argument-structure",), ())
	l.append_p_o_s(u"A", ("argument-structure",), ())
	l.append_p_o_s(u"D", ("argument-structure",), ())
	l.append_p_o_s(u"C", ("argument-structure",), ())

	l.lexicon = build_lexicon(w, l.properties)
	l.grammar = build_grammar(w)
	l.properties["capitalization"] = 2 #Only lexical
	print repr(l.grammar)
	print l.lexicon
	l.save("data/ltq.lct", True)


	show(u"kokwacala kokwabegi")
	print l.lexicon._check(l)
예제 #2
0
def prepare():
	w = build_words()

	l = Lect("tko")
	l.name = u"toki pona"
	l.english_name = "Toki Pona"
	l.append_p_o_s ("v", ("arguments", ), ())
	l.append_p_o_s ("n", (), ())
	l.append_p_o_s ("mod", (), ())
	l.append_p_o_s ("prep", (), ())
	l.append_p_o_s ("sep", (), ())
	l.append_p_o_s ("conj", (), ())
	l.append_p_o_s ("interj", (), ())
	l.append_p_o_s ("aux", (), ())
	l.append_p_o_s ("cont", (), ())
	l.lexicon = build_lexicon(w, l.properties)
	l.grammar = build_grammar(w)
	l.properties["capitalization"] = 0
	return l