Anonymous avatar Anonymous committed dea8522


Comments (0)

Files changed (1)

                 av = zip(*[av[2:][x::2] for x in (0, 1)]) 
                 # save as attr-value dict, convert numbers into ints
                 tmp['words'][av[1]] = dict(map(lambda x: (x[0], x[1].isdigit() and int(x[1]) or x[1]), av))
+                # the results of this can't be serialized into JSON?
+                # tmp['words'][av[1]] = dict(map(lambda x: (x[0], x[1].isdigit() and int(x[1]) or x[1]), av))
             state = 3
         elif state == 3:
             # skip over parse tree
                 split_entry = re.split("\(|, ", line[:-1]) 
                 if len(split_entry) == 3:
                     rel, left, right = map(lambda x: remove_id(x), split_entry)
-                    tmp['tuples'].append((rel,left,right))
+                    tmp['tuples'].append(tuple([rel,left,right]))
                     print "\n", rel, left, right
             elif "Coreference links" in line:
                 state = 5
         print "Starting the Stanford Core NLP parser."
         # show progress bar while loading the models
-        widgets = ['Loading Models: ', Fraction(), ' ', Bar(marker=RotatingMarker()), ' ', ETA()]
+        self.state = "State of the parser"
+        widgets = ['Loading Models: ', Fraction(), ' ',
+                Bar(marker=RotatingMarker()), ' ', self.state ]
         pbar = ProgressBar(widgets=widgets, maxval=5, force_update=True).start()
         self._server.expect("done.", timeout=20) # Load pos tagger model (~5sec)
         self._server.expect("done.", timeout=200) # Load NER-all classifier (~33sec)
         self._server.expect("done.", timeout=600) # Load NER-muc classifier (~60sec)
+        self.state = "Loading CoNLL classifier"
+        widgets = ['Loading Models: ', Fraction(), ' ',
         self._server.expect("done.", timeout=600) # Load CoNLL classifier (~50sec)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.