Class JSONgenerator
- java.lang.Object
-
- edu.upf.taln.dri.lib.model.util.serializer.JSONgenerator
-
public class JSONgenerator extends Object
This class is useful to generate JSON representations / serializations of the core data stuctures that characterize a scientific document.
-
-
Constructor Summary
Constructors Constructor Description JSONgenerator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getDocumentJSON(Document doc, boolean includeTokens, boolean includeBabelnetSynsets)
Get the JSON serialization of the information contained in the documentstatic String
getSentenceJSON(Document doc, Integer sentenceId, boolean includeTokens, boolean includeBabelnetSynsets)
Return the JSON serialization of a sentence of the document (JSON object), identified by its id.
The sentence JSON object is compliant to the structure modeled by theSentenceJSON
class.static String
getSentencesJSON(Document doc, SentenceSelectorENUM sentenceSel, boolean includeTokens, boolean includeBabelnetSynsets)
Return the JSON serialization of a set of sentences of the document.
A list of sentence JSON object is returned; the order of the elements of this list reflects the order of occurrence of each sentence in the document.
Each sentence JSON object is compliant with the class the structure modeled by theSentenceJSON
class.
-
-
-
Method Detail
-
getSentencesJSON
public static String getSentencesJSON(Document doc, SentenceSelectorENUM sentenceSel, boolean includeTokens, boolean includeBabelnetSynsets)
Return the JSON serialization of a set of sentences of the document.
A list of sentence JSON object is returned; the order of the elements of this list reflects the order of occurrence of each sentence in the document.
Each sentence JSON object is compliant with the class the structure modeled by theSentenceJSON
class.- Parameters:
doc
-sentenceSel
-includeTokens
- true to include the list of tokens of each sentence, each one with lemma and POSincludeBabelnetSynsets
- true to include the list of Babelnet sysets spotted inside each sentence- Returns:
-
getSentenceJSON
public static String getSentenceJSON(Document doc, Integer sentenceId, boolean includeTokens, boolean includeBabelnetSynsets)
Return the JSON serialization of a sentence of the document (JSON object), identified by its id.
The sentence JSON object is compliant to the structure modeled by theSentenceJSON
class.- Parameters:
doc
-sentenceId
-includeTokens
- true to include the list of tokens of each sentence, each one with lemma and POSincludeBabelnetSynsets
- true to include the list of Babelnet sysets spotted inside each sentence- Returns:
-
getDocumentJSON
public static String getDocumentJSON(Document doc, boolean includeTokens, boolean includeBabelnetSynsets)
Get the JSON serialization of the information contained in the document- Parameters:
doc
-includeTokens
- true to include the list of tokens of each sentence, each one with lemma and POSincludeBabelnetSynsets
- true to include the list of Babelnet sysets spotted inside each sentence- Returns:
-
-