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

Syntax errors while running script to extract data #8

Open
divija96 opened this issue Sep 7, 2022 · 4 comments
Open

Syntax errors while running script to extract data #8

divija96 opened this issue Sep 7, 2022 · 4 comments

Comments

@divija96
Copy link

divija96 commented Sep 7, 2022

Hi,
I get the following error while running the first script to extract the data:

[dnagaraj@tir crfsrl]$ bash scripts/conll05.sh PTB=/projects/tir1/corpora/treebank_3 SRL=data
PTB: /projects/tir1/corpora/treebank_3
SRL: data
Extracting evaluation files
Converting data/conll05/train.prop to conllu format
File "scripts/prop2conllu.py", line 30
rels[start-1] = '|'.join((rels[start-1], f'{prd}:B-{label}'))
^
SyntaxError: invalid syntax
Converting data/conll05/dev.prop to conllu format
File "scripts/prop2conllu.py", line 30
rels[start-1] = '|'.join((rels[start-1], f'{prd}:B-{label}'))
^
SyntaxError: invalid syntax
Converting data/conll05/test.prop to conllu format
File "scripts/prop2conllu.py", line 30
rels[start-1] = '|'.join((rels[start-1], f'{prd}:B-{label}'))
^

Please could you let me know why this is the case and what should I do to resolve this error.
Thanks in advance :)

@yzhangcs
Copy link
Owner

yzhangcs commented Sep 8, 2022

@divija96
Hi, could you check your python version? I encountered this error under py27.
Please make sure that your environment is python>=3.6.

@divija96
Copy link
Author

divija96 commented Sep 9, 2022

Hi,
Thanks for getting back :)
I changed the python version to 3.6.
Still getting an error in the same line:
0%|▏ | 49/59100 [00:01<31:21, 31.39it/s]
Traceback (most recent call last):
File "scripts/prop2conllu.py", line 80, in
process(args.prop, args.file)
File "scripts/prop2conllu.py", line 65, in process
sentences.append(prop2conllu(lines[start:i]))
File "scripts/prop2conllu.py", line 54, in prop2conllu
roles = build_roles(spans, len(words))
File "scripts/prop2conllu.py", line 30, in build_roles
rels[start-1] = '|'.join((rels[start-1], f'{prd}:B{label}'))
TypeError: unsupported operand type(s) for -: 'tuple' and 'int'

@yzhangcs
Copy link
Owner

Could you provide me some examples in the processed prop file. I speculate there might be some errors.

@divija96
Copy link
Author

Here's an example from train.prop:

-                       *               *               *        (AM-LOC*      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
revitalize            (V*)           (A0*               *               *      
-                    (A1*)              *)              *               *      
take                    *             (V*)              *               *      
-                       *            (A1*               *               *      
-                       *               *)              *               *      
-                       *        (AM-LOC*               *               *      
-                       *               *               *               *      
-                       *               *)              *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *               *)     
-                       *               *               *               *      
-                       *               *            (A1*            (A1*      
-                       *               *               *               *      
-                       *               *               *               *      
-                       *               *               *)              *      
-                       *               *               *               *      
play                    *               *             (V*)              *      
-                       *               *            (A0*               *      
-                       *               *               *               *      
-                       *               *               *)              *      
-                       *               *               *               *)     
-                       *               *               *               *      
-                       *               *               *        (AM-MNR*)     
attribute               *               *               *             (V*)     
-                       *               *               *            (A2*      
-                       *               *               *               *      
-                       *               *               *               *)     
-                       *               *               *               *      

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

2 participants