示例#1
0
long_number_graph = Graph()
word = Graph()
print("Found------------------------------------------------------------");

long_number_graph = long_number_graph.graph_from_file("longnumber")
word = word.graph_from_file("word");

found = long_number_graph.get_graph_list_from_graph(long_number_graph)

my_machine.graphs.append(letter);	# Start the word when we see a letter?
my_machine.graphs.append(space);
my_machine.graphs.append(punctuation);
my_machine.graphs.append(number);

found = my_machine.new_parse(root_object)	# Use the machine to parse our array of letters
my_machine.prune_results(found);
print("Found------------------------------------------------------------");

cur_obj = found;
while cur_obj != None:
	#print(cur_obj);
	if len(cur_obj.nexts) > 0:
		cur_obj = cur_obj.nexts[0];
	else:
		cur_obj = None;

space.reset();
punctuation.reset();
word.reset();
number.reset();
示例#2
0
word = Graph()
print("Found------------------------------------------------------------")

long_number_graph = long_number_graph.graph_from_file("longnumber")
word = word.graph_from_file("word")

found = long_number_graph.get_graph_list_from_graph(long_number_graph)

my_machine.graphs.append(letter)
# Start the word when we see a letter?
my_machine.graphs.append(space)
my_machine.graphs.append(punctuation)
my_machine.graphs.append(number)

# Use the machine to parse our array of letters
found = my_machine.new_parse(root_object)
my_machine.prune_results(found)
print("Found------------------------------------------------------------")

cur_obj = found
while cur_obj != None:
    # print(cur_obj);
    if len(cur_obj.nexts) > 0:
        cur_obj = cur_obj.nexts[0]
    else:
        cur_obj = None

space.reset()
punctuation.reset()
word.reset()
number.reset()