Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prolog printer #13

Open
kovvalsky opened this issue Jul 17, 2020 · 0 comments
Open

Prolog printer #13

kovvalsky opened this issue Jul 17, 2020 · 0 comments

Comments

@kovvalsky
Copy link

kovvalsky commented Jul 17, 2020

For me the prolog printer is not working while other printers are fine.
When I run the parser programmatically I find that Tree.prolog() inserts numbers instead of tokens in the f-string.

ccg({0},
 rp(s:dcl, 
  ba(s:dcl, 
   t(np, 'This', '{32766.lemma}', '{32766.pos}', '{32766.chunk}', '{32766.entity}'),
   fa((s:dcl\np), 
    t(((s:dcl\np)/(s:adj\np)), 'is', '{32767.lemma}', '{32767.pos}', '{32767.chunk}', '{32767.entity}'),
    t((s:adj\np), 'second', '{32768.lemma}', '{32768.pos}', '{32768.chunk}', '{32768.entity}'))),
  t(period, '.', '{32769.lemma}', '{32769.pos}', '{32769.chunk}', '{32769.entity}'))).

The following shows that other formats work while prolog doesn't.

$ echo "Prolog printer inserts numbers" | python3 -m depccg en "$@" -f deriv --silent 

ID=1, log probability=-0.32995718717575073
  N/N       N     (S[dcl]\NP)/NP     N
 Prolog  printer     inserts      numbers
----------------->
        N
-----------------<un>
       NP
                                 ---------<un>
                                    NP
                 ------------------------->
                         S[dcl]\NP
------------------------------------------<
                  S[dcl]

$ echo "Prolog printer inserts numbers" | python3 -m depccg en "$@" -f prolog --silent 

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/dist-packages/depccg-1.0.7-py3.6-linux-x86_64.egg/depccg/__main__.py", line 259, in <module>
    args.func(args)
  File "/usr/local/lib/python3.6/dist-packages/depccg-1.0.7-py3.6-linux-x86_64.egg/depccg/__main__.py", line 125, in main
    semantic_templates=semantic_templates)
  File "/usr/local/lib/python3.6/dist-packages/depccg-1.0.7-py3.6-linux-x86_64.egg/depccg/printer.py", line 299, in print_
    print(to_prolog_en(nbest_trees, tagged_doc), end='', file=file)
  File "/usr/local/lib/python3.6/dist-packages/depccg-1.0.7-py3.6-linux-x86_64.egg/depccg/printer.py", line 46, in to_prolog_en
    print(t.prolog().format(i, *tokens), file=output)
AttributeError: 'int' object has no attribute 'lemma'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant