Class AnnotatedString (0.1.1)

AnnotatedString(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Describes string annotation from both semantic and formatting perspectives. Example:

User Query:

top countries by population in Africa

0 4 14 17 28 31 37

Table Data:

  • "country" - dimension
  • "population" - metric
  • "Africa" - value in the "continent" column

text_formatted = "top countries by population in Africa"

html_formatted = "top <b>countries</b> by <b>population</b> in <i>Africa</i>"

::

markups = [ {DIMENSION, 4, 12}, // 'countries' {METRIC, 17, 26}, // 'population' {FILTER, 31, 36} // 'Africa' ]

Note that html formattings for 'DIMENSION' and 'METRIC' are the same, while semantic markups are different.

Attributes

NameDescription
text_formatted str
Text version of the string.
html_formatted str
HTML version of the string annotation.
markups Sequence[.annotated_string.AnnotatedString.SemanticMarkup]
Semantic version of the string annotation.

Classes

SemanticMarkup

SemanticMarkup(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Semantic markup denotes a substring (by index and length) with markup information.

SemanticMarkupType

SemanticMarkupType(value)

Semantic markup types.