Skip to content

Commit 8413fa1

Browse files
committed
Remove a double escaping of the patterns. It is unclear why that was needed, but it didn't work. The + and & would show up on the server side with an extra \ and the server would not properly handle them
1 parent e7a073b commit 8413fa1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/edu/stanford/nlp/pipeline/demo/corenlp-brat.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,10 +1220,12 @@ $(document).ready(function() {
12201220
// Remove existing annotation
12211221
$('#tokensregex').remove();
12221222
// Make ajax call
1223+
// Previously this would escape the + and & in pattern before the
1224+
// call to encodeURIComponent, but the server doesn't double
1225+
// unescape the incoming patterns, so that was not working
12231226
$.ajax({
12241227
type: 'POST',
1225-
url: serverAddress + '/tokensregex?pattern=' + encodeURIComponent(
1226-
pattern.replace("&", "\\&").replace('+', '\\+')) +
1228+
url: serverAddress + '/tokensregex?pattern=' + encodeURIComponent(pattern) +
12271229
'&properties=' + encodeURIComponent(
12281230
'{"annotators": "' + annotators() + '", "date": "' + date() + '"}') +
12291231
'&pipelineLanguage=' + encodeURIComponent($('#language').val()),
@@ -1263,8 +1265,7 @@ $(document).ready(function() {
12631265
// Make ajax call
12641266
$.ajax({
12651267
type: 'POST',
1266-
url: serverAddress + '/semgrex?pattern=' + encodeURIComponent(
1267-
pattern.replace("&", "\\&").replace('+', '\\+')) +
1268+
url: serverAddress + '/semgrex?pattern=' + encodeURIComponent(pattern) +
12681269
'&properties=' + encodeURIComponent(
12691270
'{"annotators": "' + requiredAnnotators.join(',') + '", "date": "' + date() + '"}') +
12701271
'&pipelineLanguage=' + encodeURIComponent($('#language').val()),
@@ -1303,8 +1304,7 @@ $(document).ready(function() {
13031304
// Make ajax call
13041305
$.ajax({
13051306
type: 'POST',
1306-
url: serverAddress + '/tregex?pattern=' + encodeURIComponent(
1307-
pattern.replace("&", "\\&").replace('+', '\\+')) +
1307+
url: serverAddress + '/tregex?pattern=' + encodeURIComponent(pattern) +
13081308
'&properties=' + encodeURIComponent(
13091309
'{"annotators": "' + requiredAnnotators.join(',') + '", "date": "' + date() + '"}') +
13101310
'&pipelineLanguage=' + encodeURIComponent($('#language').val()),

0 commit comments

Comments
 (0)