TALP-UPC / FreeLing

FreeLing project source code
Other
252 stars 96 forks source link

Semgraph Malformed JSON Output #113

Closed rmarrugat closed 3 years ago

rmarrugat commented 3 years ago

🐛 Bug Reports

🌍 Environment

:memo: Bug Description

Given a FreeLing instance initialized with Mode=Server, Output Level=Semgraph and Output=JSON, at the time of generating the JSON Semgraph, a comma (',') is added for each paragraph of the document. In case the paragraph does not contain any sentence, no paragraph JSON object is added to the semgraph report, which implies that the aformentioned added comma malforms the JSON semgraph report.

Example:

Given a document with 3 paragraphs where the 2nd one has no sentences, this would be the resulting output:

{ "paragraphs" : [
   { "sentences" : [
      { "id":"1"}
     ]
    }
,
,
   { "sentences" : [
      { "id":"2"}
     ]
   }
]}

The comma (',') situated between the two sentences malforms the JSON.

💥 Reproducing

lluisp commented 3 years ago

Fixed in latest gitihub master branch