neubig/travatar

Unescaped left brace in regex is illegal here in regex

delihiros opened this issue · 4 comments

I am seeing the error in script/train/symmetrize.pl while training a model.

Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\({ <-- HERE  ([0-9 ]*)}\)/ at - line 159.

my environment

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

$ perl --version
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi

while($str =~ /\({ ([0-9 ]*)}\)/g) {

as I could not see what the code is doing I just backslashed before { as a workaround but not sure this works as expected...

Same problem here. With Ubuntu 16.04 the syntax check passed, this was a feature deprecated on 5.22 and removed on 5.26 of perl, ub16 has perl 5.22

no solution?

I think the subroutine is trying to parse the A3 GIZA++ lines that looks like this:
NULL ({ 4 5 }) £ ({ 2 3 }) 20 ({ 1 }) means ({ 6 7 8 9 }) a_lot ({ }) to ({ }) a ({ 10 }) poor ({ 11 12 }) person ({ }) . ({ 13 })
it will basically returns something like this?
{0: [4, 5], 1:[2, 3] ... }
I do not have that error in my environment.