run from_rasp.py throw TypeError

10 views
Skip to first unread message

Qihang Gu

unread,
Jan 9, 2020, 5:12:17 PM1/9/20
to mwetoolkit
I want to convert the grammatical relations in rasp format to CoNLL format by using from_rasp.py.

RASP command line: echo “^ The weather is great today” | ./rasp.sh


The example of rasp I used is like this:

(|ncsubj| |be+s:4_VBZ| |weather:3_NN1| _)

(|ncmod| _ |be+s:4_VBZ| |today:6_RT|)

(|xcomp| _ |be+s:4_VBZ| |great:5_JJ|)

(|ncmod| _ |weather:3_NN1| |^:1_&FO|)

(|det| |weather:3_NN1| |the:2_AT|)


And I saved it to a file "test.rasp" and run the command: ./from_rasp.py ../test.rasp

I got the following error:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE corpus SYSTEM "dtd/mwetoolkit-corpus.dtd">

<!-- MWETOOLKIT: filetype="XML" -->

<corpus >

test.rasp:1: WARNING: Ignoring bad token ``

Traceback (most recent call last):

  File "./from_rasp.py", line 149, in <module>

    filetype.parse(args, RaspHandler(morphg_file, morphg_folder), parser=parser)

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/__init__.py", line 74, in parse

    for entity in iter_parse(input_fileobjs, filetype_hint=filetype_hint, parser=parser):

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/__init__.py", line 97, in iter_parse

    yield from parser.iter_parse(input_file)

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/_common.py", line 623, in iter_parse

    yield from self._iter_parse_file()

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/_common.py", line 669, in _iter_parse_file

    yield from iter_wrapped_file_parser(self, self._iter_parse_rawline())

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/_common.py", line 711, in iter_wrapped_file_parser

    yield from parser_iterable

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/_common.py", line 688, in _iter_parse_rawline

    yield from self._iter_parse_line(line, ctxinfo)

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/ft_rasp.py", line 118, in _iter_parse_line

    self._parse_sent( line, ctxinfo )

  File "/Users/Downloads/mwetoolkit3/bin/mwetk/filetype/ft_rasp.py", line 168, in _parse_sent

    (prelemma, index, pos) = self._parse_word(wordtoken, ctxinfo)

TypeError: 'NoneType' object is not iterable

Moreover, environment variable MWETOOLKIT_DEBUG_PDB not found. Quitting.


I do not know how to solve it, can anyone help me with it?

Thanks!

Carlos Ramisch

unread,
Feb 4, 2020, 1:31:19 PM2/4/20
to Qihang Gu, mwetoolkit
Hello,
Sorry for the late reply.
I could not reproduce the problem here.
I just tested with the latest version of Rasp and it worked.
Your example does not have the first line with the whole sentence, is that on purpose?
Maybe if you send me your output of rasp in a file I can test it here.
Best
Carlo


--
You received this message because you are subscribed to the Google Groups "mwetoolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mwetoolkit+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mwetoolkit/f2992e34-1051-41fd-8a9c-70f5fb6388e3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages