Permalink
Browse files

text_to_4lang uses the new wrapper function to get the machines for a…

…ll words of a

sentence
updated LICENSE to contain all our names
	modified:   LICENSE
	modified:   src/text_to_4lang.py
  • Loading branch information...
Gabor Recski
Gabor Recski committed Mar 18, 2015
1 parent 5a310ef commit c7d6411d166d29a13a6cdb0967821c1770c8d696
Showing with 9 additions and 7 deletions.
  1. +1 −1 LICENSE
  2. +8 −6 src/text_to_4lang.py
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Gábor Recski
Copyright (c) 2015 Gabor Recski, David Nemeskey, Attila Zseder

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -26,14 +26,16 @@ def process(self, stream):
logging.info("loading machine wrapper...")
logging.getLogger().setLevel(__MACHINE_LOGLEVEL__)
machine_cfg_file = os.path.join(self.cfg_dir, 'machine.cfg')
machine_wrapper = MachineWrapper(machine_cfg_file)
wrapper = MachineWrapper(machine_cfg_file)
logging.info("processing sentences...")
for i, sen in enumerate(parsed_sens):
machine = machine_wrapper.get_dep_definition(
"sen_{0}".format(i), sen['deps'])
graph = MachineGraph.create_from_machines([machine])
f = open('graphs/sens/sen_{0}.dot'.format(i), 'w')
f.write(graph.to_dot().encode('utf-8'))
with open('test/sens/sen_{0}.dep'.format(i), 'w') as f:
f.write("\n".join(sen['deps']))
words_to_machines = wrapper.get_machines_from_deps(sen['deps'])
graph = MachineGraph.create_from_machines(
words_to_machines.values())
with open('test/sens/graphs/sen_{0}.dot'.format(i), 'w') as f:
f.write(graph.to_dot().encode('utf-8'))
logging.info("done, processed {0} sentences".format(i+1))

if __name__ == "__main__":

0 comments on commit c7d6411

Please sign in to comment.