pcyin / tranX

A general-purpose neural semantic parser for mapping natural language queries into machine executable code
Apache License 2.0
460 stars 111 forks source link

Fix string escape python3 #37

Open rogeriochaves opened 3 years ago

rogeriochaves commented 3 years ago

This patch fixes this errors when running Django dataset with python3:

  File "/Users/rchaves/Projects/tranX/server/app.py", line 43, in parse
    hypotheses = parser.parse(utterance, debug=True)
  File "/Users/rchaves/Projects/tranX/components/standalone_parser.py", line 57, in parse
    self.example_processor.post_process_hypothesis(hyp, utterance_meta)
  File "/Users/rchaves/Projects/tranX/datasets/django/example_processor.py", line 24, in post_process_hypothesis
    replace_string_ast_nodes(hyp_ast, slot2str_map)
  File "/Users/rchaves/Projects/tranX/datasets/django/dataset.py", line 42, in replace_string_ast_nodes
    str_literal_decoded = key.decode('string_escape')
AttributeError: 'str' object has no attribute 'decode'