def pos(input): payload = { 's': input, 'x': 'n', 'c': 'utf-8', 't': LTPOption.POS } try: r = requests.post(ServiceURL, data=payload) except Exception as e: print e result = LTML(r.content) pids = result.count_paragraph() pos_result = [] for pid in xrange(pids): for sid in xrange(result.count_sentence(pid)): print "|".join( [word.encode('utf8') for word in result.get_words_by_pos(pid, sid)]) pos_result = pos_result + [word.encode('utf8') for word in result.get_words_by_pos(pid, sid)] return pos_result