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 | |
---|---|
Name | Description |
text_formatted |
str
Text version of the string. |
html_formatted |
str
HTML version of the string annotation. |
markups |
MutableSequence[google.cloud.dataqna_v1alpha.types.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.
Values: MARKUP_TYPE_UNSPECIFIED (0): No markup type was specified. METRIC (1): Markup for a substring denoting a metric. DIMENSION (2): Markup for a substring denoting a dimension. FILTER (3): Markup for a substring denoting a filter. UNUSED (4): Markup for an unused substring. BLOCKED (5): Markup for a substring containing blocked phrases. ROW (6): Markup for a substring that contains terms for row.