EntityRecognitionSkill.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.JsonSetter;
  14. import com.fasterxml.jackson.annotation.JsonTypeId;
  15. import com.fasterxml.jackson.annotation.JsonTypeInfo;
  16. import com.fasterxml.jackson.annotation.JsonTypeName;
  17. import java.util.List;

  18. /** Text analytics entity recognition. */
  19. @JsonTypeInfo(
  20.         use = JsonTypeInfo.Id.NAME,
  21.         include = JsonTypeInfo.As.EXISTING_PROPERTY,
  22.         property = "@odata.type",
  23.         visible = true)
  24. @JsonTypeName("#Microsoft.Skills.Text.EntityRecognitionSkill")
  25. @Fluent
  26. public final class EntityRecognitionSkill extends SearchIndexerSkill {

  27.     @JsonIgnore private final ClientLogger logger = new ClientLogger(EntityRecognitionSkill.class);

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

  34.     /*
  35.      * A list of entity categories that should be extracted.
  36.      */
  37.     @JsonProperty(value = "categories")
  38.     private List<EntityCategory> categories;

  39.     /*
  40.      * A value indicating which language code to use. Default is en.
  41.      */
  42.     @JsonProperty(value = "defaultLanguageCode")
  43.     private EntityRecognitionSkillLanguage defaultLanguageCode;

  44.     /*
  45.      * Determines whether or not to include entities which are well known but
  46.      * don't conform to a pre-defined type. If this configuration is not set
  47.      * (default), set to null or set to false, entities which don't conform to
  48.      * one of the pre-defined types will not be surfaced.
  49.      */
  50.     @JsonProperty(value = "includeTypelessEntities")
  51.     private Boolean includeTypelessEntities;

  52.     /*
  53.      * A value between 0 and 1 that be used to only include entities whose
  54.      * confidence score is greater than the value specified. If not set
  55.      * (default), or if explicitly set to null, all entities will be included.
  56.      */
  57.     @JsonProperty(value = "minimumPrecision")
  58.     private Double minimumPrecision;

  59.     /*
  60.      * The version of the model to use when calling the Text Analytics service.
  61.      * It will default to the latest available when not specified. We recommend
  62.      * you do not specify this value unless absolutely necessary.
  63.      */
  64.     @JsonProperty(value = "modelVersion")
  65.     private String modelVersion;

  66.     /**
  67.      * Creates an instance of EntityRecognitionSkill class.
  68.      *
  69.      * @param inputs the inputs value to set.
  70.      * @param outputs the outputs value to set.
  71.      */
  72.     @JsonCreator
  73.     public EntityRecognitionSkill(
  74.             @JsonProperty(value = "inputs", required = true) List<InputFieldMappingEntry> inputs,
  75.             @JsonProperty(value = "outputs", required = true) List<OutputFieldMappingEntry> outputs) {
  76.         this(inputs, outputs, EntityRecognitionSkillVersion.V1);
  77.     }

  78.     /**
  79.      * Creates an instance of EntityRecognitionSkill class.
  80.      *
  81.      * @param inputs the inputs value to set.
  82.      * @param outputs the outputs value to set.
  83.      * @param version the EntityRecognitionSkillVersion value to set.
  84.      */
  85.     public EntityRecognitionSkill(
  86.             List<InputFieldMappingEntry> inputs,
  87.             List<OutputFieldMappingEntry> outputs,
  88.             EntityRecognitionSkillVersion version) {
  89.         super(inputs, outputs);
  90.         this.version = version;
  91.     }

  92.     /**
  93.      * Gets the version of the {@link EntityRecognitionSkill}.
  94.      *
  95.      * @return The version of the {@link EntityRecognitionSkill}.
  96.      */
  97.     public EntityRecognitionSkillVersion getSkillVersion() {
  98.         return this.version;
  99.     }

  100.     /**
  101.      * Get the categories property: A list of entity categories that should be extracted.
  102.      *
  103.      * @return the categories value.
  104.      */
  105.     public List<EntityCategory> getCategories() {
  106.         return this.categories;
  107.     }

  108.     /**
  109.      * Set the categories property: A list of entity categories that should be extracted.
  110.      *
  111.      * @param categories the categories value to set.
  112.      * @return the EntityRecognitionSkill object itself.
  113.      */
  114.     @JsonSetter
  115.     public EntityRecognitionSkill setCategories(List<EntityCategory> categories) {
  116.         this.categories = categories;
  117.         return this;
  118.     }

  119.     /**
  120.      * Get the defaultLanguageCode property: A value indicating which language code to use. Default is en.
  121.      *
  122.      * @return the defaultLanguageCode value.
  123.      */
  124.     public EntityRecognitionSkillLanguage getDefaultLanguageCode() {
  125.         return this.defaultLanguageCode;
  126.     }

  127.     /**
  128.      * Set the defaultLanguageCode property: A value indicating which language code to use. Default is en.
  129.      *
  130.      * @param defaultLanguageCode the defaultLanguageCode value to set.
  131.      * @return the EntityRecognitionSkill object itself.
  132.      */
  133.     public EntityRecognitionSkill setDefaultLanguageCode(EntityRecognitionSkillLanguage defaultLanguageCode) {
  134.         this.defaultLanguageCode = defaultLanguageCode;
  135.         return this;
  136.     }

  137.     /**
  138.      * Get the includeTypelessEntities property: Determines whether or not to include entities which are well known but
  139.      * don't conform to a pre-defined type. If this configuration is not set (default), set to null or set to false,
  140.      * entities which don't conform to one of the pre-defined types will not be surfaced.
  141.      *
  142.      * @return the includeTypelessEntities value.
  143.      */
  144.     public Boolean areTypelessEntitiesIncluded() {
  145.         return this.includeTypelessEntities;
  146.     }

  147.     /**
  148.      * Set the includeTypelessEntities property: Determines whether or not to include entities which are well known but
  149.      * don't conform to a pre-defined type. If this configuration is not set (default), set to null or set to false,
  150.      * entities which don't conform to one of the pre-defined types will not be surfaced.
  151.      *
  152.      * @param includeTypelessEntities the includeTypelessEntities value to set.
  153.      * @return the EntityRecognitionSkill object itself.
  154.      * @throws IllegalArgumentException If {@code includeTypelessEntities} is supplied when {@link #getSkillVersion()}
  155.      *     is {@link EntityRecognitionSkillVersion#V3}.
  156.      */
  157.     public EntityRecognitionSkill setTypelessEntitiesIncluded(Boolean includeTypelessEntities) {
  158.         if (includeTypelessEntities != null && version == EntityRecognitionSkillVersion.V3) {
  159.             throw logger.logExceptionAsError(
  160.                     new IllegalArgumentException(
  161.                             "EntityRecognitionSkill using V3 doesn't support 'includeTypelessEntities'."));
  162.         }
  163.         this.includeTypelessEntities = includeTypelessEntities;
  164.         return this;
  165.     }

  166.     /**
  167.      * Get the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence
  168.      * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will
  169.      * be included.
  170.      *
  171.      * @return the minimumPrecision value.
  172.      */
  173.     public Double getMinimumPrecision() {
  174.         return this.minimumPrecision;
  175.     }

  176.     /**
  177.      * Set the minimumPrecision property: A value between 0 and 1 that be used to only include entities whose confidence
  178.      * score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will
  179.      * be included.
  180.      *
  181.      * @param minimumPrecision the minimumPrecision value to set.
  182.      * @return the EntityRecognitionSkill object itself.
  183.      */
  184.     public EntityRecognitionSkill setMinimumPrecision(Double minimumPrecision) {
  185.         this.minimumPrecision = minimumPrecision;
  186.         return this;
  187.     }

  188.     /**
  189.      * Get the modelVersion property: The version of the model to use when calling the Text Analytics service. It will
  190.      * default to the latest available when not specified. We recommend you do not specify this value unless absolutely
  191.      * necessary.
  192.      *
  193.      * @return the modelVersion value.
  194.      */
  195.     public String getModelVersion() {
  196.         return this.modelVersion;
  197.     }

  198.     /**
  199.      * Set the modelVersion property: The version of the model to use when calling the Text Analytics service. It will
  200.      * default to the latest available when not specified. We recommend you do not specify this value unless absolutely
  201.      * necessary.
  202.      *
  203.      * @param modelVersion the modelVersion value to set.
  204.      * @return the EntityRecognitionSkill object itself.
  205.      * @throws IllegalArgumentException If {@code modelVersion} is supplied when {@link #getSkillVersion()} is {@link
  206.      *     EntityRecognitionSkillVersion#V1}.
  207.      */
  208.     public EntityRecognitionSkill setModelVersion(String modelVersion) {
  209.         if (modelVersion != null && version == EntityRecognitionSkillVersion.V1) {
  210.             throw logger.logExceptionAsError(
  211.                     new IllegalArgumentException("EntityRecognitionSkill using V1 doesn't support 'modelVersion'."));
  212.         }
  213.         this.modelVersion = modelVersion;
  214.         return this;
  215.     }

  216.     /**
  217.      * Set the categories property: A list of entity categories that should be extracted.
  218.      *
  219.      * @param categories the categories value to set.
  220.      * @return the EntityRecognitionSkill object itself.
  221.      */
  222.     public EntityRecognitionSkill setCategories(EntityCategory... categories) {
  223.         this.categories = (categories == null) ? null : java.util.Arrays.asList(categories);
  224.         return this;
  225.     }
  226. }