@@ -50,8 +50,9 @@ def parse_parser_results(text):
50
50
av = re .split ("=| " , s )
51
51
# make [ignore,ignore,a,b,c,d] into [[a,b],[c,d]]
52
52
# and save as attr-value dict, convert numbers into ints
53
- tmp ['words' ][av [1 ]] = dict (zip (* [av [2 :][x ::2 ] for x in (0 , 1 )]))
54
- # the results of this can't be serialized into JSON?
53
+ tmp ['words' ].append ((av [1 ], dict (zip (* [av [2 :][x ::2 ] for x in (0 , 1 )])))
54
+ # tried to convert digits to ints instead of strings, but
55
+ # it seems the results of this can't be serialized into JSON?
55
56
# av = zip(*[av[2:][x::2] for x in (0, 1)])
56
57
# tmp['words'][av[1]] = dict(map(lambda x: (x[0], x[1].isdigit() and int(x[1]) or x[1]), av))
57
58
state = 3
@@ -191,11 +192,11 @@ def parse_imperative(self, text):
191
192
if not used_pronoun :
192
193
return self .parse (text )
193
194
194
- text = used_pronoun + " " + text .lstrip ()
195
+ new_text = used_pronoun + " " + text .lstrip ()
195
196
first_word = ""
196
- if len (text .split ()) > 1 :
197
- first_word = text .split ()[1 ]
198
- result = self ._parse (text )
197
+ if len (text .split ()) > 0 :
198
+ first_word = text .split ()[0 ]
199
+ result = self ._parse (new_text )
199
200
if result [0 ].has_key ('text' ):
200
201
result [0 ]['text' ] = text
201
202
result [0 ]['tuples' ] = filter (lambda x : not (x [1 ] == used_pronoun or x [2 ]
0 commit comments