Sentiment Annotation

Sentiment analysis marks subjective information such as sentiments or attitudes expressed in text. The sentiments/attitudes are defined by a user-defined set definition.

Specification

Annotation Category:
 

Span Annotation

Declaration:

<sentiment-annotation set="..."> (note: ``set`` is optional for this annotation type)

Version History:
 

since v1.3

Element:

<sentiment>

API Class:

Sentiment

Layer Element:

sentiments

Span Role Elements:
 

Headspan, Source, Target

Required Attributes:
 
Optional Attributes:
 
  • xml:id – The ID of the element; this has to be a unique in the entire document or collection of documents (corpus). All identifiers in FoLiA are of the XML NCName datatype, which roughly means it is a unique string that has to start with a letter (not a number or symbol), may contain numers, but may never contain colons or spaces. FoLiA does not define any naming convention for IDs.
  • set – The set of the element, ideally a URI linking to a set definition (see Set Definitions (Vocabulary)) or otherwise a uniquely identifying string. The set must be referred to also in the Annotation Declarations for this annotation type.
  • class – The class of the annotation, i.e. the annotation tag in the vocabulary defined by set.
  • processor – This refers to the ID of a processor in the Provenance Data. The processor in turn defines exactly who or what was the annotator of the annotation.
  • annotator – This is an older alternative to the processor attribute, without support for full provenance. The annotator attribute simply refers to the name o ID of the system or human annotator that made the annotation.
  • annotatortype – This is an older alternative to the processor attribute, without support for full provenance. It is used together with annotator and specific the type of the annotator, either manual for human annotators or auto for automated systems.
  • confidence – A floating point value between zero and one; expresses the confidence the annotator places in his annotation.
  • datetime – The date and time when this annotation was recorded, the format is YYYY-MM-DDThh:mm:ss (note the literal T in the middle to separate date from time), as per the XSD Datetime data type.
  • n – A number in a sequence, corresponding to a number in the original document, for example chapter numbers, section numbers, list item numbers. This this not have to be an actual number but other sequence identifiers are also possible (think alphanumeric characters or roman numerals).
  • textclass – Refers to the text class this annotation is based on. This is an advanced attribute, if not specified, it defaults to current. See Text class attribute (advanced).
  • src – Points to a file or full URL of a sound or video file. This attribute is inheritable.
  • begintime – A timestamp in HH:MM:SS.MMM format, indicating the begin time of the speech. If a sound clip is specified (src); the timestamp refers to a location in the soundclip.
  • endtime – A timestamp in HH:MM:SS.MMM format, indicating the end time of the speech. If a sound clip is specified (src); the timestamp refers to a location in the soundclip.
  • speaker – A string identifying the speaker. This attribute is inheritable. Multiple speakers are not allowed, simply do not specify a speaker on a certain level if you are unable to link the speech to a specific (single) speaker.
Accepted Data:

<comment> (Comment Annotation), <desc> (Description Annotation), <metric> (Metric Annotation), <relation> (Relation Annotation)

Valid Context:

<sentiments> (Sentiment Annotation)

Feature subsets (extra attributes):
 
  • polarity
  • strength

Explanation

Note

Please first ensure you are familiar with the general principles of Span Annotation to make sense of this annotation type.

Sentiment analysis marks subjective information such as sentiments or attitudes expressed in text. The <sentiment> span annotation element is used to this end. It is embedded in a <sentiments> layer.

The <sentiment> element takes the following span roles:

  • <hd> – (required) – The head of the sentiment; expresses the actual sentiment, it covers word spans such as ``happy’‘, ``very satisfied’‘, ``highly dissappointed’‘.
  • <source> – (optional) – The source/holder of the sentiment, assuming it is explicitly expressed in the text.
  • <target> – (optional) – The target/recipient of the sentiment, assuming it is explicitly expressed in the text.

The following feature subsets are predefined (see Features), whether they are actually used depends on the set, their values (classes) are set-dependent as well:

  • polarity – Expresses the whether the sentiment is positive, neutral or negative.
  • strength – Expresses the strength or intensity of the sentiment.

Besides these predefined features, FoLiA’s feature mechanism can be used to associate other custom properties with any sentiment.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="utf-8"?>
<FoLiA xmlns="http://ilk.uvt.nl/folia" version="2.0" xml:id="example">
  <metadata>
      <annotations>
          <token-annotation set="https://raw.githubusercontent.com/LanguageMachines/uctodata/master/setdefinitions/tokconfig-eng.foliaset.ttl">
			 <annotator processor="p1" />
		  </token-annotation>
          <text-annotation>
			 <annotator processor="p1" />
          </text-annotation>
          <sentence-annotation>
			 <annotator processor="p1" />
          </sentence-annotation>
          <sentiment-annotation set="sentiments"> <!-- an ad-hoc set -->
			 <annotator processor="p1" />
		  </sentiment-annotation>
      </annotations>
      <provenance>
         <processor xml:id="p1" name="proycon" type="manual" />
      </provenance>
  </metadata>
  <text xml:id="example.text">
    <s xml:id="s1">
     <w xml:id="s1.w1"><t>He</t></w>
     <w xml:id="s1.w2"><t>is</t></w>
     <w xml:id="s1.w3"><t>happy</t></w>
     <w xml:id="s1.w4"><t>to</t></w>
     <w xml:id="s1.w5"><t>see</t></w>
     <w xml:id="s1.w6"><t>him</t></w>
     <w xml:id="s1.w7"><t>.</t></w>
     <sentiments>
      <sentiment class="emotion.joy" polarity="positive" strength="moderate">
        <source>
          <wref id="s1.w1" t="he" />
        </source>
        <target>
          <wref id="s1.w6" t="him" />
        </target>
        <hd>
          <wref id="s1.w3" t="happy" />
        </hd>
      </sentiment>
     </sentiments>
    </s>
  </text>
</FoLiA>