crfsrl icon indicating copy to clipboard operation
crfsrl copied to clipboard

Syntax errors while running script to extract data

Open divija96 opened this issue 3 years ago • 4 comments

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 :)

divija96 avatar Sep 07 '22 20:09 divija96

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

yzhangcs avatar Sep 08 '22 09:09 yzhangcs

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'

divija96 avatar Sep 09 '22 17:09 divija96

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

yzhangcs avatar Sep 10 '22 16:09 yzhangcs

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*      
-                       *               *               *               *      
-                       *               *               *               *)     
-                       *               *               *               *      

divija96 avatar Sep 11 '22 00:09 divija96