Skip to content

Commit

Permalink
Remove a double escaping of the patterns. It is unclear why that was …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
AngledLuffa committed Mar 3, 2022
1 parent e7a073b commit 8413fa1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/edu/stanford/nlp/pipeline/demo/corenlp-brat.js
Expand Up @@ -1220,10 +1220,12 @@ $(document).ready(function() {
// Remove existing annotation
$('#tokensregex').remove();
// Make ajax call
// Previously this would escape the + and & in pattern before the
// call to encodeURIComponent, but the server doesn't double
// unescape the incoming patterns, so that was not working
$.ajax({
type: 'POST',
url: serverAddress + '/tokensregex?pattern=' + encodeURIComponent(
pattern.replace("&", "\\&").replace('+', '\\+')) +
url: serverAddress + '/tokensregex?pattern=' + encodeURIComponent(pattern) +
'&properties=' + encodeURIComponent(
'{"annotators": "' + annotators() + '", "date": "' + date() + '"}') +
'&pipelineLanguage=' + encodeURIComponent($('#language').val()),
Expand Down Expand Up @@ -1263,8 +1265,7 @@ $(document).ready(function() {
// Make ajax call
$.ajax({
type: 'POST',
url: serverAddress + '/semgrex?pattern=' + encodeURIComponent(
pattern.replace("&", "\\&").replace('+', '\\+')) +
url: serverAddress + '/semgrex?pattern=' + encodeURIComponent(pattern) +
'&properties=' + encodeURIComponent(
'{"annotators": "' + requiredAnnotators.join(',') + '", "date": "' + date() + '"}') +
'&pipelineLanguage=' + encodeURIComponent($('#language').val()),
Expand Down Expand Up @@ -1303,8 +1304,7 @@ $(document).ready(function() {
// Make ajax call
$.ajax({
type: 'POST',
url: serverAddress + '/tregex?pattern=' + encodeURIComponent(
pattern.replace("&", "\\&").replace('+', '\\+')) +
url: serverAddress + '/tregex?pattern=' + encodeURIComponent(pattern) +
'&properties=' + encodeURIComponent(
'{"annotators": "' + requiredAnnotators.join(',') + '", "date": "' + date() + '"}') +
'&pipelineLanguage=' + encodeURIComponent($('#language').val()),
Expand Down

0 comments on commit 8413fa1

Please sign in to comment.