percyliang / sempre

Semantic Parser with Execution
Other
829 stars 300 forks source link

Using files for input #174

Closed Jorgen-P closed 6 years ago

Jorgen-P commented 6 years ago

I can only get the parser to take interactive input. When I point stdin to a file the run script takes it as options. Output redirects ok. How can I get it to read from a file in the same way as it reads in the interactive prompt?

ppasupat commented 6 years ago

What command line options did you use to run the script? Are you redirecting with something like < infile.txt?

Jorgen-P commented 6 years ago

Command line: ./run @mode=simple -Grammar.inPaths data/tutorial.grammar < data/simple_text.txt Where simple_text.txt contains a single line with "3 plus 4". When running interactive with the same options (except the redirect) it works. With redirect it gives the message: main()Invalid command: '3 plus 4'

ppasupat commented 6 years ago

Found it. The text file is read before the interactive prompt is started.

During the batch mode (before the interactive prompt starts; could last a long time if training and test data are supplied), stdin is used to debug the run using the commands in fig/src/main/java/fig/exec/MonitorThread.java

One possible way to supply input from a file is to create an example file.

Jorgen-P commented 6 years ago

Thank you, that works.