Class: ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/moderation_api/models/content_submit_response.rb,
sig/moderation_api/models/content_submit_response.rbs

Defined Under Namespace

Classes: Signals

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(match:, probability:, span:, entity_type: nil, reasons: nil, signals: nil) ⇒ Object

Some parameter documentations has been truncated, see ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match for more details.

Parameters:

  • match (String)
  • probability (Float)
  • span (Array<Integer>)
  • entity_type (String) (defaults to: nil)

    Sub-type of the entity match — e.g. the NER key (email, phone, name, …) for PII

  • reasons (Array<String>) (defaults to: nil)

    Stable codes explaining why a URL was flagged (URL Risk only).

  • signals (ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals) (defaults to: nil)

    Observable properties of a URL (URL Risk only). Absent for allow/block list matc



825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
# File 'lib/moderation_api/models/content_submit_response.rb', line 825

class Match < ModerationAPI::Internal::Type::BaseModel
  # @!attribute match
  #
  #   @return [String]
  required :match, String

  # @!attribute probability
  #
  #   @return [Float]
  required :probability, Float

  # @!attribute span
  #
  #   @return [Array<Integer>]
  required :span, ModerationAPI::Internal::Type::ArrayOf[Integer]

  # @!attribute entity_type
  #   Sub-type of the entity match — e.g. the NER key (email, phone, name, …) for PII
  #   matches. Absent for URL Risk and wordlist matches where the type is already
  #   encoded in the parent label.
  #
  #   @return [String, nil]
  optional :entity_type, String

  # @!attribute reasons
  #   Stable codes explaining why a URL was flagged (URL Risk only).
  #
  #   @return [Array<String>, nil]
  optional :reasons, ModerationAPI::Internal::Type::ArrayOf[String]

  # @!attribute signals
  #   Observable properties of a URL (URL Risk only). Absent for allow/block list
  #   matches.
  #
  #   @return [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals, nil]
  optional :signals,
           -> { ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals }

  # @!method initialize(match:, probability:, span:, entity_type: nil, reasons: nil, signals: nil)
  #   Some parameter documentations has been truncated, see
  #   {ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match}
  #   for more details.
  #
  #   @param match [String]
  #
  #   @param probability [Float]
  #
  #   @param span [Array<Integer>]
  #
  #   @param entity_type [String] Sub-type of the entity match — e.g. the NER key (email, phone, name, …) for PII
  #
  #   @param reasons [Array<String>] Stable codes explaining why a URL was flagged (URL Risk only).
  #
  #   @param signals [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals] Observable properties of a URL (URL Risk only). Absent for allow/block list matc

  # @see ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match#signals
  class Signals < ModerationAPI::Internal::Type::BaseModel
    # @!attribute bot_protection
    #
    #   @return [Boolean, nil]
    required :bot_protection, ModerationAPI::Internal::Type::Boolean, nil?: true

    # @!attribute brand_impersonation
    #
    #   @return [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation, nil]
    required :brand_impersonation,
             -> { ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation },
             nil?: true

    # @!attribute domain_age_days
    #
    #   @return [Integer, nil]
    required :domain_age_days, Integer, nil?: true

    # @!attribute final_url
    #
    #   @return [String, nil]
    required :final_url, String, nil?: true

    # @!attribute has_email_setup
    #
    #   @return [Boolean, nil]
    required :has_email_setup, ModerationAPI::Internal::Type::Boolean, nil?: true

    # @!attribute has_suspicious_characters
    #
    #   @return [Boolean]
    required :has_suspicious_characters, ModerationAPI::Internal::Type::Boolean

    # @!attribute is_link_shortener
    #
    #   @return [Boolean]
    required :is_link_shortener, ModerationAPI::Internal::Type::Boolean

    # @!attribute is_reported
    #
    #   @return [Boolean]
    required :is_reported, ModerationAPI::Internal::Type::Boolean

    # @!attribute redirect_count
    #
    #   @return [Integer, nil]
    required :redirect_count, Integer, nil?: true

    # @!method initialize(bot_protection:, brand_impersonation:, domain_age_days:, final_url:, has_email_setup:, has_suspicious_characters:, is_link_shortener:, is_reported:, redirect_count:)
    #   Observable properties of a URL (URL Risk only). Absent for allow/block list
    #   matches.
    #
    #   @param bot_protection [Boolean, nil]
    #   @param brand_impersonation [ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation, nil]
    #   @param domain_age_days [Integer, nil]
    #   @param final_url [String, nil]
    #   @param has_email_setup [Boolean, nil]
    #   @param has_suspicious_characters [Boolean]
    #   @param is_link_shortener [Boolean]
    #   @param is_reported [Boolean]
    #   @param redirect_count [Integer, nil]

    # @see ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals#brand_impersonation
    class BrandImpersonation < ModerationAPI::Internal::Type::BaseModel
      # @!attribute brand
      #
      #   @return [String]
      required :brand, String

      # @!attribute method_
      #
      #   @return [Symbol, ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation::Method]
      required :method_,
               enum: -> { ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation::Method },
               api_name: :method

      # @!method initialize(brand:, method_:)
      #   @param brand [String]
      #   @param method_ [Symbol, ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation::Method]

      # @see ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals::BrandImpersonation#method_
      module Method
        extend ModerationAPI::Internal::Type::Enum

        REGISTERED_DOMAIN_TOKEN = :registered_domain_token
        SUBDOMAIN_TOKEN = :subdomain_token

        # @!method self.values
        #   @return [Array<Symbol>]
      end
    end
  end
end

Instance Attribute Details

#entity_typeString?

Sub-type of the entity match — e.g. the NER key (email, phone, name, …) for PII matches. Absent for URL Risk and wordlist matches where the type is already encoded in the parent label.

Parameters:

  • (String)

Returns:

  • (String, nil)


847
# File 'lib/moderation_api/models/content_submit_response.rb', line 847

optional :entity_type, String

#matchString

Parameters:

  • value (String)

Returns:

  • (String)


829
# File 'lib/moderation_api/models/content_submit_response.rb', line 829

required :match, String

#probabilityFloat

Parameters:

  • value (Float)

Returns:

  • (Float)


834
# File 'lib/moderation_api/models/content_submit_response.rb', line 834

required :probability, Float

#reasonsArray<String>?

Stable codes explaining why a URL was flagged (URL Risk only).

Parameters:

  • (::Array[String])

Returns:

  • (Array<String>, nil)


853
# File 'lib/moderation_api/models/content_submit_response.rb', line 853

optional :reasons, ModerationAPI::Internal::Type::ArrayOf[String]

#signalsModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals?

Observable properties of a URL (URL Risk only). Absent for allow/block list matches.



860
861
# File 'lib/moderation_api/models/content_submit_response.rb', line 860

optional :signals,
-> { ModerationAPI::Models::ContentSubmitResponse::Policy::EntityMatcherOutput::Match::Signals }

#spanArray<Integer>

Parameters:

  • value (::Array[Integer])

Returns:

  • (Array<Integer>)


839
# File 'lib/moderation_api/models/content_submit_response.rb', line 839

required :span, ModerationAPI::Internal::Type::ArrayOf[Integer]

Instance Method Details

#to_hash{

Returns:

  • ({)


674
# File 'sig/moderation_api/models/content_submit_response.rbs', line 674

def to_hash: -> {