Skip Menu |

This queue is for tickets about the NLP-Service CPAN distribution.

Report information
The Basics
Id: 75128
Status: new
Priority: 0/
Queue: NLP-Service

People
Owner: Nobody in particular
Requestors: tani [...] tanihosokawa.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.02
Fixed in: (no value)



Subject: faulty escaping of output when apostrophes are found (includes patch)
Parsing apostrophes results in broken output. For example: parse: I can't parse this. result: [ { relation => 'nominal subject', from => 'parse-4', to => 'I-1' }, { relation => 'auxiliary', from => 'parse-4', to => 'ca-2' }, { relation => 'negation modifier', from => 'parse-4', to => 'n't-3' }, { relation => 'direct object', from => 'parse-4', to => 'this-5' }, ] The string "to => 'n't-3'" isn't valid Perl. Trivial fix follows: --- StanfordParser.pm 2012-02-17 21:45:16.000000000 -0800 +++ StanfordParser.pm.fixed 2012-02-18 20:30:17.000000000 -0800 @@ -63,8 +63,8 @@ for (TypedDependency td : collxn) { buf.append("{ relation => '"). append(td.reln().getLongName()).append("', from => '"). - append(td.gov()).append("', to => '"). - append(td.dep()).append("' },\n"); + append(td.gov().toString().replace("'","\\'")).append("', to => '"). + append(td.dep().toString().replace("'","\\'")).append("' },\n"); } buf.append("]\n"); return buf.toString();