neubig / travatar

This is a repository for the Travatar forest-to-string translation decoder
GNU Lesser General Public License v3.0
28 stars 11 forks source link

Unescaped left brace in regex is illegal here in regex #42

Open delihiros opened 5 years ago

delihiros commented 5 years ago

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

https://github.com/neubig/travatar/blob/ccaedf000d6f2de16f54a06592b669b8dbce32c6/script/train/symmetrize.pl#L159

delihiros commented 5 years ago

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

ZJaume commented 5 years ago

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

luigifaticoso commented 4 years ago

no solution?

philip30 commented 4 years ago

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.