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

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

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



681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
# File 'lib/moderation_api/models/content_submit_response.rb', line 681

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.

Returns:

  • (String, nil)


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

optional :entity_type, String

#matchString

Returns:

  • (String)


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

required :match, String

#probabilityFloat

Returns:

  • (Float)


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

required :probability, Float

#reasonsArray<String>?

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

Returns:

  • (Array<String>, nil)


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

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.



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

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

#spanArray<Integer>

Returns:

  • (Array<Integer>)


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

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