Supported Formats
Sources: Wikipedia and IANA
This page details all the supported Datasaur formats, provides examples for each format and clarifies expected file structure where appropriate. Note: Through file transformers we can customize the output format.
TXT
TXT file is a simple file format that contains unformatted text and can be easily opened and edited using a basic text editor. It is commonly used for storing and exchanging data, code, and other textual information.
TSV
A TSV (tab-separated values) file is a simple text format for storing data in a tabular structure. A TSV file encodes a number of records that may contain multiple fields.
Each record is represented as a single line.
Each field
value is represented as text.
Fields in a record are separated from
one other by the tab character .
Note that because is a special character for this format, fields that contain tabs are not allowed in this encoding.
The header (first) line of this encoding contains the name of
each field, separated by tabs.
Example
IOB (specialized .tsv)
IOB (inside, outside, beginning) is a common labeling format for labeling tokens in computational linguistics (ex: named-entity recognition). IOB is also a .tsv, but conforms to the following rules:
The B- prefix before a tag indicates that the tag is the beginning of a chunk.
The I- prefix before a tag indicates that the tag is inside a chunk.
The B- tag is used only when a tag is followed by a tag of the same type without O tokens between them.
The O tag indicates that a token does not belong to a chunk.
Example
CSV
A CSV (comma-separated values) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format.
A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line will have the same number of fields.
Example
💡 As for now, a row-based project using CSV format does not support answers containing ;
. We treat it as multiple answers. For example, the answer is She brings some flowers: rose; sunflower; and daisy.
It will be interpreted as three answers that containShe brings some flowers: rose
,sunflower
, and daisy
.
XLS and XLSX
XLS and XLSX is a well-known format for Microsoft Excel documents that was introduced by Microsoft XLS is an older format that was used in older versions of Excel, while XLSX is a newer format that is the default in more recent versions of Excel. Both formats allow users to input, organize, and analyze data in rows and columns. They also support features such as formulas, charts, and graphs. XLSX is a more efficient format that offers better data recovery and larger file size limits.
Example
JSON
JSON (JavaScript Object Notation), or JSON Simplified, is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types (or any other serializable value).
A JSON file may contain the following data structures:
An object is an unordered set of name/value pairs.
An object begins with {left brace and ends with }right brace. Each name is followed by :colon and the name/value pairs are separated by ,comma.
An array is an ordered collection of values.
An array begins with [left bracket and ends with ]right bracket. Values are separated by ,comma.
A value can be a
string
in double quotes, or anumber
, ortrue or false or null
, or anobject
or anarray
. These structures can be nested.A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.
A number is like a C or Java number, except that the octal and hexadecimal formats are not used.
Whitespace can be inserted between any pair of tokens. Excepting a few encoding details, that completely describes the language.
In the example below, here are the objects recognized at Datasaur.
text: the sentence.
entities: array of label applied
text: the token
type: the label applied.
start_idx: the character position in the labeled token.
The character position uses zero-based index.
end_idx: the last character position + 1 (because end_index does not include the last character).
The character position uses zero-based index.
JSON (Simplified) export format limitation:
Can't export arrow label
Can't export label multi sentence
Example
JSON_TABULAR
JSON_TABULAR is a derivative of the JSON format that is used to represent table data format (in the form of an array of objects). You can choose this format if you are working on row-based labeling.
Example
JSONL (JSON Lines)
Per version 6.43.0, Datasaur now supports JSONL natively 🎉
JSONL (JSON Lines) - https://jsonlines.org/ - is a text file format suitable for storing data that can be processed one record at a time. Datasaur supports a subset of valid JSONL files, namely:
the file must end in the
.jsonl
extensioneach record in a file must be in the same structure / format. If the first record / line is an array, all the following lines must also be an array. If the first record is an object, all the following lines must also be a JSON object.
The JSONL file format is supported for row-based project.
Here are some sample JSONL structure that Datasaur supports:
For JSONL with objects, you can have nested values, for example:
Datasaur will render all values after stringify-ing them.
Note that Datasaur relies on the first record / line to check the header length. Any items not in the first line will not be parsed.
Here is an example of how it may affect your workflow:
Let’s take the sample data above, and alter it a bit such that if someone has not completed
a session, there is no completed data stored
This file will be parsed just fine, but you will be missing the completed
column - because there is no completed
key in the first line.
As such, we highly recommend making your data consistent between each line, to ensure the best compatibility with our parser.
TSV_NON_IOB
TSV_NON_IOB is a derivative of the TSV format that represents data that does not follow the IOB format - for example, B-GEO
is just GEO
. If your project is token-based (with or without arrows), you can choose this format for export.
A TSV_NON_IOB file contains the following data structure (this explanation is based on our example below):
#FORMAT: the file header.
#Text: the sentence representation.
1-1: the sentence-token.
The first
1
indicates the sentence number.The second
1
indicates the token number.
0-3: the character index.
TITLE[1]: the label applied.
[1]
indicates uniquely identify annotation across lines.
Column 5: indicates layer 2.
author[2-1]: the label on the arrow.
2
indicates the arrow’s token origin.1
indicates the arrow’s token destination.
Column 7: indicates layer 4.
Column 8: indicates layer 5.
Note: column 5, 7, and 8 will be filled if you label the token in the mentioned layers.
_\_💡_We built this format to be compatible with [_WebAnno](https://webanno.github.io/webanno/releases/3.4.5/docs/user-guide.html#sect_webannotsv)_._
Example (token-based)
Example (token-based with arrows)
CoNLL-U
Universal Dependencies use a revised version of the CoNLL-X format called CoNLL-U. Sentences consist of one or more word lines, and word lines contain the following fields:
sent_id: Sentence id.
text: Sentence.
ID: Word index, integer starting at 1 for each new sentence; may be a range for multiword tokens; may be a decimal number for empty nodes (decimal numbers can be lower than 1 but must be greater than 0).
FORM: Word form or punctuation symbol.
LEMMA: Lemma or stem of word form.
UPOS: Universal part-of-speech tag.
XPOS: Language-specific part-of-speech tag; underscore if not available.
FEATS: List of morphological features from the universal feature inventory or from a defined language-specific extension; underscore if not available.
HEAD: Head of the current word, which is either a value of ID or zero (0).
DEPREL: Universal dependency relation to the HEAD (root iff HEAD = 0) or a defined language-specific subtype of one.
DEPS: Enhanced dependency graph in the form of a list of head-deprel pairs.
MISC: Any other annotation.
Example
CoNLL_2003
CoNLL_2003 is usually used for POS tagging and named entity recognition labeling. All data files contain one word per line with empty lines representing sentence boundaries. At the end of each line there is a tag which states whether the current word is inside a named entity or not. The tag also encodes the type of named entity. Each line contains four fields:
The word
Part of-speech tag
Chunk tag
Named entity tag
Note: Importing or exporting files with conll_2003 format can be done if you checked the following task settings.
Tokens and token spans should have at most one label.
Allow arrows to be drawn between labels. Checking this setting will activate layer feature.
You could do POS tagging on Layer 0 and NER tagging on Layer 1. If you export the file with conll_2003, the result will be as shown as sample file below.
JSON_ADVANCED
JSON_ADVANCED is a proprietary Datasaur format designed in collaboration with our users to capture all possible data. This format is commonly used for partial token labeling projects. You can also use it when exporting token-based with arrow projects, such as coreference and dependency.
A JSON_ADVANCED file may contain the following data structures:
Sentences field
id: the sentence position.
content: the text of the sentence.
tokens: the tokens form of the sentence.
labels
l: the label applied.
layer: the layer position of the labels. This field is reserved for a project where a labeling of multiple tag set at once. For now you can disregard this field and this field is always set to 0.
id: the unique identifier of a label.
If the id has 9 segments, this indicates span label. For example,
INNM0ViFwo8LluMTaTIK9:0:0:14:0:0:18:6:0
and here's the explanation<label set item id>:<layer>:<sidS>:<s>:<charS>:<sidE>:<e>:<charE>:<index>
.If the id has 21 segments, this indicates arrow label. For example,
tfc1FkbbEk9fOLx6haR1s:0:INNM0ViFwo8LluMTaTIK9:0:0:14:0:0:18:6:0:Oq_VuB0s_N7D8ZY0rgYsg:0:0:0:0:0:2:5:0:0
and here's the explanation<label set item id>:<arrow layer>:<….. origin id>:<….destination id>:<arrow index>.
hashCode: Datasaur's code to represent label information __
Span label. For example,
SPAN:gpe:0:0:0:4:0:0:0:4:3:0:undefined:undefined.
Below is the explanation:type:label set item id:layer or label set index:start cell line:cell index:start token index: start char index: end cell line: end cell index: end token index: end char index: counter.
Arrow label. For example,
ARROW:dyC-o1HBnn49dcqDSphmJ:1:0:0:0:0:0:0:10:6:0:SPAN:geo:0:0:0:0:0:0:0:0:4:0:undefined:undefined:SPAN:geo:0:0:0:10:0:0:0:10:6:0:undefined:undefined
. Below is the explanation:type:label set item id:layer or label set index:start cell line:cell index:start token index: start char index: end cell line: end cell index: end token index: end char index: counter:<span label: origin>:<span label: destination>.
documentId: the id of document.
sidS, sidE: the sentence starting and ending position of a label in 0-based index. In Datasaur, it is possible that a label spans across sentences.
s: the token starting position of a label in the starting sentence in 0-based index.
e: the token ending position of a label in the ending sentence in 0-based index.
charS: the character starting position of a label in the starting token in 0-based index.
charE: the character ending position of a label in the ending token in 0-based index.
metadata: additional information for a cell
labelerInfo: the information about the labeler.
id: the unique identifier of a labeler (each labeler has different id).
email: email that labeler used when signing in.
displayName: the display name of the email.
labelSets: contains all the label items that you used for the project.
index: the position of the label set in UI
labelItems: an array of labelItems for a label set
id: id of the labelSetItem
labelName: the displayed name of the label set item
parentId: id of the parent label set item
color: the color of the label set item
labels: an array of labels for the document
labelText: label content for row-based project. It will be null for other project beside the row-based project.
id: identifier from the applied label.
documentId : identifier for document where the label is applied.
startCellLine: starting line sentence position
startCellIndex: starting line column position
startTokenIndex: starting token index position
startCharIndex: starting character index position (relative to tokenIndex, start from 0 again when tokenIndex incremented)
endCellLine: ending line sentence position
endCellIndex: ending line column position
endTokenIndex: ending token index position
endCharIndex: ending character index position
layer: the layer where the token is positioned
counter: labels with the same name to be placed multiple times in the same position, start from 0
type: the type of labels -> SPAN, ARROW, BOUNDING_BOX
createdAt:
Labeler: the time labels applied
Reviewer: the time labels got accepted
updatedAt: last update timestamp on the label
Review related fields
acceptedByUserId: the user id of a reviewer who accepts the label. It will be null if there's no user who accept it manually.
rejectedByUserId: the user id of a reviewer who rejects the label. It will be null if there's no user who rejects it manually
labeledByUserId: the user id of a reviewer
labeledBy:
CONFLICT if it has not been resolved
REVIEWER if it has been resolved
AUTO if it has been resolved by meeting the consensus
Arrow label type specific fields
originId: origin id of an arrow label
originNumber: auto increment ID for origin
destinationId: origin id of an arrow label
destinationNumber: auto increment ID for destination
Bounding box label type specific fields
pageIndex: index of the page if the document contain multiple pages
nodeCount: total number of the bounding box points
x0: x coordinate of top left position of the bounding box
y0: y coordinate of top left position of the bounding box
x1: x coordinate of top right position of the bounding box
y1: y coordinate of top right position of the bounding box
x2: x coordinate of bottom right position of the bounding box
y2: y coordinate of bottom right position of the bounding box
x3: x coordinate of bottom left position of the bounding box
y3: y coordinate of bottom left position of the bounding box
pages: an array of page information for OCR project type
pageIndex: index of the page if the document contain multiple pages
pageHeight: original page height in pixel
pageWidth: original page width in pixel
comments
id: the id of the comment
parentId: the id of the parent comment - this will be filed if the comment thread has replies.
hashCode: Datasaur's code to represent comment's information, including the value being commented
message: the content of the comment
type: the type of comment, can be
SPAN_LABEL
,SPAN_TEXT
,ARROW_LABEL
, andCELL_LABEL
userId: the id of user who create the comment
createdAt: the time when the user create the comment
Example (token-based with arrow)
Example (token-based with character-based labeling)
Example (token-based with bounding-box labeling)
Datasaur Schema Format
Datasaur Schema is a customized JSON format that is designed to fit all available project types in Datasaur app. This format can be used for mixed project