Class: Google::Cloud::DataQnA::V1alpha::AnnotatedString

Inherits:
Object
  • Object
show all
Extended by:
Protobuf::MessageExts::ClassMethods
Includes:
Protobuf::MessageExts
Defined in:
proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb

Overview

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.

Defined Under Namespace

Modules: SemanticMarkupType Classes: SemanticMarkup

Instance Attribute Summary collapse

Instance Attribute Details

#html_formatted::String

Returns HTML version of the string annotation.

Returns:

  • (::String)

    HTML version of the string annotation.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb', line 63

class AnnotatedString
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Semantic markup denotes a substring (by index and length) with markup
  # information.
  # @!attribute [rw] type
  #   @return [::Google::Cloud::DataQnA::V1alpha::AnnotatedString::SemanticMarkupType]
  #     The semantic type of the markup substring.
  # @!attribute [rw] start_char_index
  #   @return [::Integer]
  #     Unicode character index of the query.
  # @!attribute [rw] length
  #   @return [::Integer]
  #     The length (number of unicode characters) of the markup substring.
  class SemanticMarkup
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Semantic markup types.
  module SemanticMarkupType
    # No markup type was specified.
    MARKUP_TYPE_UNSPECIFIED = 0

    # Markup for a substring denoting a metric.
    METRIC = 1

    # Markup for a substring denoting a dimension.
    DIMENSION = 2

    # Markup for a substring denoting a filter.
    FILTER = 3

    # Markup for an unused substring.
    UNUSED = 4

    # Markup for a substring containing blocked phrases.
    BLOCKED = 5

    # Markup for a substring that contains terms for row.
    ROW = 6
  end
end

#markups::Array<::Google::Cloud::DataQnA::V1alpha::AnnotatedString::SemanticMarkup>

Returns Semantic version of the string annotation.

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb', line 63

class AnnotatedString
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Semantic markup denotes a substring (by index and length) with markup
  # information.
  # @!attribute [rw] type
  #   @return [::Google::Cloud::DataQnA::V1alpha::AnnotatedString::SemanticMarkupType]
  #     The semantic type of the markup substring.
  # @!attribute [rw] start_char_index
  #   @return [::Integer]
  #     Unicode character index of the query.
  # @!attribute [rw] length
  #   @return [::Integer]
  #     The length (number of unicode characters) of the markup substring.
  class SemanticMarkup
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Semantic markup types.
  module SemanticMarkupType
    # No markup type was specified.
    MARKUP_TYPE_UNSPECIFIED = 0

    # Markup for a substring denoting a metric.
    METRIC = 1

    # Markup for a substring denoting a dimension.
    DIMENSION = 2

    # Markup for a substring denoting a filter.
    FILTER = 3

    # Markup for an unused substring.
    UNUSED = 4

    # Markup for a substring containing blocked phrases.
    BLOCKED = 5

    # Markup for a substring that contains terms for row.
    ROW = 6
  end
end

#text_formatted::String

Returns Text version of the string.

Returns:

  • (::String)

    Text version of the string.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb', line 63

class AnnotatedString
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Semantic markup denotes a substring (by index and length) with markup
  # information.
  # @!attribute [rw] type
  #   @return [::Google::Cloud::DataQnA::V1alpha::AnnotatedString::SemanticMarkupType]
  #     The semantic type of the markup substring.
  # @!attribute [rw] start_char_index
  #   @return [::Integer]
  #     Unicode character index of the query.
  # @!attribute [rw] length
  #   @return [::Integer]
  #     The length (number of unicode characters) of the markup substring.
  class SemanticMarkup
    include ::Google::Protobuf::MessageExts
    extend ::Google::Protobuf::MessageExts::ClassMethods
  end

  # Semantic markup types.
  module SemanticMarkupType
    # No markup type was specified.
    MARKUP_TYPE_UNSPECIFIED = 0

    # Markup for a substring denoting a metric.
    METRIC = 1

    # Markup for a substring denoting a dimension.
    DIMENSION = 2

    # Markup for a substring denoting a filter.
    FILTER = 3

    # Markup for an unused substring.
    UNUSED = 4

    # Markup for a substring containing blocked phrases.
    BLOCKED = 5

    # Markup for a substring that contains terms for row.
    ROW = 6
  end
end