public sealed class AnnotatedString : IMessage<AnnotatedString>, IEquatable<AnnotatedString>, IDeepCloneable<AnnotatedString>, IBufferMessage, IMessage
Reference documentation and code samples for the Data QnA v1alpha API class AnnotatedString.
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>"
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eAnnotatedString\u003c/code\u003e class in the Data QnA v1alpha API describes string annotations from both semantic and formatting perspectives, useful for understanding the meaning and presentation of text.\u003c/p\u003e\n"],["\u003cp\u003eThis class provides properties like \u003ccode\u003eHtmlFormatted\u003c/code\u003e and \u003ccode\u003eTextFormatted\u003c/code\u003e to represent the string in HTML and plain text formats, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMarkups\u003c/code\u003e property, which is of type \u003ccode\u003eRepeatedField<AnnotatedString.Types.SemanticMarkup>\u003c/code\u003e, is used to store the semantic markups, indicating the meaning of different parts of the string.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAnnotatedString\u003c/code\u003e class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, providing functionality for message handling, equality comparison, deep cloning, and buffer operations.\u003c/p\u003e\n"]]],[],null,["# Data QnA v1alpha API - Class AnnotatedString (2.0.0-alpha02)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0-alpha02 (latest)](/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AnnotatedString)\n- [2.0.0-alpha01](/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/2.0.0-alpha01/Google.Cloud.DataQnA.V1Alpha.AnnotatedString)\n- [1.0.0-alpha03](/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/1.0.0-alpha03/Google.Cloud.DataQnA.V1Alpha.AnnotatedString) \n\n public sealed class AnnotatedString : IMessage\u003cAnnotatedString\u003e, IEquatable\u003cAnnotatedString\u003e, IDeepCloneable\u003cAnnotatedString\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Data QnA v1alpha API class AnnotatedString.\n\nDescribes string annotation from both semantic and formatting perspectives.\nExample:\n\nUser Query:\n\ntop countries by population in Africa\n\n0 4 14 17 28 31 37\n\nTable Data:\n\n- \"country\" - dimension\n- \"population\" - metric\n- \"Africa\" - value in the \"continent\" column\n\ntext_formatted = `\"top countries by population in Africa\"`\n\nhtml_formatted =\n`\"top \u003cb\u003ecountries\u003c/b\u003e by \u003cb\u003epopulation\u003c/b\u003e in \u003ci\u003eAfrica\u003c/i\u003e\"` \n\n markups = [\n {DIMENSION, 4, 12}, // 'countries'\n {METRIC, 17, 26}, // 'population'\n {FILTER, 31, 36} // 'Africa'\n ]\n\nNote that html formattings for 'DIMENSION' and 'METRIC' are the same, while\nsemantic markups are different. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AnnotatedString \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[AnnotatedString](/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AnnotatedString), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[AnnotatedString](/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AnnotatedString), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[AnnotatedString](/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha.AnnotatedString), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.DataQnA.V1Alpha](/dotnet/docs/reference/Google.Cloud.DataQnA.V1Alpha/latest/Google.Cloud.DataQnA.V1Alpha)\n\nAssembly\n--------\n\nGoogle.Cloud.DataQnA.V1Alpha.dll\n\nConstructors\n------------\n\n### AnnotatedString()\n\n public AnnotatedString()\n\n### AnnotatedString(AnnotatedString)\n\n public AnnotatedString(AnnotatedString other)\n\nProperties\n----------\n\n### HtmlFormatted\n\n public string HtmlFormatted { get; set; }\n\nHTML version of the string annotation.\n\n### Markups\n\n public RepeatedField\u003cAnnotatedString.Types.SemanticMarkup\u003e Markups { get; }\n\nSemantic version of the string annotation.\n\n### TextFormatted\n\n public string TextFormatted { get; set; }\n\nText version of the string."]]