YY input and double quotes as tokens

If a token is a double quote, what does ACE expect in YY-input? This?

(1, 0, 1, <0:1>, 1, "\"" "\"", 0, "fe", "fe" 1.0) 

If so, does anyone know how do I write that literally into a file if I assemble the string step by step and the double quotes come from variables which have the value '"'? No matter what I do, the file ends up either with zero backslashes or with two of them…

Nevermind; I think it wants "\\"", as is proper (and writeable).

Hmm. When I call ACE directly on:

(1, 0, 1, <0:1>, 1, "\\"" "\\"", 0, "fe", "fe" 1.0) (2, 1, 2, <1:5>, 1, "algo" "algo", 0, "pi0cs00", "pi0cs00" 0.8544207317073171) (3, 2, 3, <6:13>, 1, "puntual" "puntual", 0, "aq0cs00", "aq0cs00" 1.0) (4, 3, 4, <13:14>, 1, "\\"" "\\"", 0, "fe", "fe" 1.0) (5, 4, 5, <14:15>, 1, "." ".", 0, "fp", "fp" 1.0)

I get an error:

expected ',', but input is \\"", 0, "fe", "

But if I use the exact same string as part of the item file that I process with pydelphin ACE wrapper, I get:

77/177NOTE: lexemes do not span position 0 `"'!

The second behavior is better although I still don’t know how to parse the quote; in the lexicon, it appears as:

quotes_pt := pt_-_quots_le & 
   [ STEM < "\"" > ].

ACE wants to see it with a single backslash, as you originally supposed. It requires an additional layer of escaping when it’s in the tsdb profile, but pydelphin is (presumably) unescaping it before passing it to ACE. I can’t guess why the lexical entry you showed isn’t being instantiated though.

The \ character needs to be escaped in [incr tsdb()] profiles, so any \ in a YY token becomes \\. PyDelphin handles the escaping/unescaping for you so you don’t need to escape things manually. But if you are evaluating these strings somewhere that does escapes (e.g., bash shell or Python), you may need to escape both the \ AND the ", so you might have \\\", which evaluates to \".

I’m also not sure why the lexical entry isn’t working. Sometimes this is because it’s the wrong quote (e.g., a “smart” quote like instead of "), but the error message you pasted looks like the normal, straight kind.

1 Like