SentimentSkill.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. //
  4. // Code generated by Microsoft (R) AutoRest Code Generator.
  5. // Changes may cause incorrect behavior and will be lost if the code is
  6. // regenerated.
  7. package com.azure.search.documents.indexes.models;

  8. import com.azure.core.annotation.Fluent;
  9. import com.azure.core.util.logging.ClientLogger;
  10. import com.fasterxml.jackson.annotation.JsonCreator;
  11. import com.fasterxml.jackson.annotation.JsonIgnore;
  12. import com.fasterxml.jackson.annotation.JsonProperty;
  13. import com.fasterxml.jackson.annotation.JsonTypeId;
  14. import com.fasterxml.jackson.annotation.JsonTypeInfo;
  15. import com.fasterxml.jackson.annotation.JsonTypeName;
  16. import java.util.List;

  17. /** Text analytics positive-negative sentiment analysis, scored as a floating point value in a range of zero to 1. */
  18. @JsonTypeInfo(
  19.         use = JsonTypeInfo.Id.NAME,
  20.         include = JsonTypeInfo.As.EXISTING_PROPERTY,
  21.         property = "@odata.type",
  22.         visible = true)
  23. @JsonTypeName("#Microsoft.Skills.Text.SentimentSkill")
  24. @Fluent
  25. public final class SentimentSkill extends SearchIndexerSkill {

  26.     @JsonIgnore private final ClientLogger logger = new ClientLogger(SentimentSkill.class);

  27.     /*
  28.      * Identifies the concrete type of the skill.
  29.      */
  30.     @JsonTypeId
  31.     @JsonProperty(value = "@odata.type", required = true)
  32.     private SentimentSkillVersion version;

  33.     /*
  34.      * A value indicating which language code to use. Default is en.
  35.      */
  36.     @JsonProperty(value = "defaultLanguageCode")
  37.     private SentimentSkillLanguage defaultLanguageCode;

  38.     /*
  39.      * If set to true, the skill output will include information from Text
  40.      * Analytics for opinion mining, namely targets (nouns or verbs) and their
  41.      * associated assessment (adjective) in the text. Default is false.
  42.      */
  43.     @JsonProperty(value = "includeOpinionMining")
  44.     private Boolean includeOpinionMining;

  45.     /*
  46.      * The version of the model to use when calling the Text Analytics service.
  47.      * It will default to the latest available when not specified. We recommend
  48.      * you do not specify this value unless absolutely necessary.
  49.      */
  50.     @JsonProperty(value = "modelVersion")
  51.     private String modelVersion;

  52.     /**
  53.      * Creates an instance of SentimentSkill class.
  54.      *
  55.      * @param inputs the inputs value to set.
  56.      * @param outputs the outputs value to set.
  57.      */
  58.     @JsonCreator
  59.     public SentimentSkill(
  60.             @JsonProperty(value = "inputs", required = true) List<InputFieldMappingEntry> inputs,
  61.             @JsonProperty(value = "outputs", required = true) List<OutputFieldMappingEntry> outputs) {
  62.         this(inputs, outputs, SentimentSkillVersion.V1);
  63.     }

  64.     /**
  65.      * Creates an instance of SentimentSkill class.
  66.      *
  67.      * @param inputs the inputs value to set.
  68.      * @param outputs the outputs value to set.
  69.      * @param version the SentimentSkillVersion value to set.
  70.      */
  71.     public SentimentSkill(
  72.             List<InputFieldMappingEntry> inputs, List<OutputFieldMappingEntry> outputs, SentimentSkillVersion version) {
  73.         super(inputs, outputs);
  74.         this.version = version;
  75.     }

  76.     /**
  77.      * Gets the version of the {@link SentimentSkill}.
  78.      *
  79.      * @return The version of the {@link SentimentSkill}.
  80.      */
  81.     public SentimentSkillVersion getSkillVersion() {
  82.         return this.version;
  83.     }

  84.     /**
  85.      * Get the defaultLanguageCode property: A value indicating which language code to use. Default is en.
  86.      *
  87.      * @return the defaultLanguageCode value.
  88.      */
  89.     public SentimentSkillLanguage getDefaultLanguageCode() {
  90.         return this.defaultLanguageCode;
  91.     }

  92.     /**
  93.      * Set the defaultLanguageCode property: A value indicating which language code to use. Default is en.
  94.      *
  95.      * @param defaultLanguageCode the defaultLanguageCode value to set.
  96.      * @return the SentimentSkill object itself.
  97.      */
  98.     public SentimentSkill setDefaultLanguageCode(SentimentSkillLanguage defaultLanguageCode) {
  99.         this.defaultLanguageCode = defaultLanguageCode;
  100.         return this;
  101.     }

  102.     /**
  103.      * Get the includeOpinionMining property: If set to true, the skill output will include information from Text
  104.      * Analytics for opinion mining, namely targets (nouns or verbs) and their associated assessment (adjective) in the
  105.      * text. Default is false.
  106.      *
  107.      * @return the includeOpinionMining value.
  108.      */
  109.     public Boolean isIncludeOpinionMining() {
  110.         return this.includeOpinionMining;
  111.     }

  112.     /**
  113.      * Set the includeOpinionMining property: If set to true, the skill output will include information from Text
  114.      * Analytics for opinion mining, namely targets (nouns or verbs) and their associated assessment (adjective) in the
  115.      * text. Default is false.
  116.      *
  117.      * @param includeOpinionMining the includeOpinionMining value to set.
  118.      * @return the SentimentSkill object itself.
  119.      * @throws IllegalArgumentException If {@code includeOpinionMining} is supplied when {@link #getSkillVersion()} is
  120.      *     {@link SentimentSkillVersion#V1}.
  121.      */
  122.     public SentimentSkill setIncludeOpinionMining(Boolean includeOpinionMining) {
  123.         if (includeOpinionMining != null && version == SentimentSkillVersion.V1) {
  124.             throw logger.logExceptionAsError(
  125.                     new IllegalArgumentException("SentimentSkill using V1 doesn't support 'includeOpinionMining'."));
  126.         }
  127.         this.includeOpinionMining = includeOpinionMining;
  128.         return this;
  129.     }

  130.     /**
  131.      * Get the modelVersion property: The version of the model to use when calling the Text Analytics service. It will
  132.      * default to the latest available when not specified. We recommend you do not specify this value unless absolutely
  133.      * necessary.
  134.      *
  135.      * @return the modelVersion value.
  136.      */
  137.     public String getModelVersion() {
  138.         return this.modelVersion;
  139.     }

  140.     /**
  141.      * Set the modelVersion property: The version of the model to use when calling the Text Analytics service. It will
  142.      * default to the latest available when not specified. We recommend you do not specify this value unless absolutely
  143.      * necessary.
  144.      *
  145.      * @param modelVersion the modelVersion value to set.
  146.      * @return the SentimentSkill object itself.
  147.      * @throws IllegalArgumentException If {@code modelVersion} is supplied when {@link #getSkillVersion()} is {@link
  148.      *     SentimentSkillVersion#V1}.
  149.      */
  150.     public SentimentSkill setModelVersion(String modelVersion) {
  151.         if (modelVersion != null && version == SentimentSkillVersion.V1) {
  152.             throw logger.logExceptionAsError(
  153.                     new IllegalArgumentException("SentimentSkill using V1 doesn't support 'modelVersion'."));
  154.         }
  155.         this.modelVersion = modelVersion;
  156.         return this;
  157.     }
  158. }