Running ACE with pydelphin wrapper with -R option

This works for me:

ace -g ~/delphin/SRG/grammar/srg/ace/srg.dat -R -y --yy-rules

This does not:

delphin process --options="-R -y --yy-rules" -g ~/delphin/SRG/grammar/srg/ace/srg.dat --full-forest --select i-tokens ~/delphin/SRG/treebanks/dev/all/tbdb10
ProcessingTraceback (most recent call last):
  File "/home/olga/anaconda3/bin/delphin", line 8, in <module>
    sys.exit(main())
  File "/home/olga/anaconda3/lib/python3.7/site-packages/delphin/main.py", line 42, in main
    args.func(args)
  File "/home/olga/anaconda3/lib/python3.7/site-packages/delphin/cli/process.py", line 46, in call_process
    gzip=args.gzip)
  File "/home/olga/anaconda3/lib/python3.7/site-packages/delphin/commands.py", line 662, in process
    with processor(grammar, cmdargs=options, **kwargs) as cpu:
  File "/home/olga/anaconda3/lib/python3.7/site-packages/delphin/ace.py", line 90, in __init__
    _ace_argparser.parse_args(self.cmdargs)
  File "/home/olga/anaconda3/lib/python3.7/argparse.py", line 1758, in parse_args
    self.error(msg % ' '.join(argv))
  File "/home/olga/anaconda3/lib/python3.7/site-packages/delphin/ace.py", line 579, in error
    raise ValueError(message)
ValueError: unrecognized arguments: -R

Is the option unsupported? Would it be hard to add it?

That is correct, it is not supported. PyDelphin doesn’t recognize it because the allowed ACE options are specified and those that change the format of the output are excluded (e.g., -f is out) because PyDelphin has to parse the output. Since -R suppresses all normal output and PyDelphin does not parse the stderr messages, it could only check if the command was successful (exit code 0 vs something else). I haven’t looked closely, but it might be non-trivial to tell it to not consume any stdout when that option is used. The other thing is that PyDelphin adds --tsdb-stdout by default, which apparently causes ACE to ignore the -R option, so that would have to be handled specially.

2 Likes