Class PredictedTagsUtil
java.lang.Object
com.adobe.acs.commons.reports.internal.PredictedTagsUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPredictedTags(org.apache.sling.api.resource.Resource resource, String relativePropertyPath, Double lowerConfidenceThreshold) For the given resource and relative property path: Validate that the resource is an asset, extract all predicted tags below the relative property path, adapt them to PredictedTags and filter out those whose confidence value is lower than the lowerConfidenceThresholdprotected org.apache.sling.api.resource.ResourcegetPredictedTagsResource(org.apache.sling.api.resource.Resource resource, com.day.cq.dam.api.Asset asset, String relativePropertyPath) com.day.cq.dam.api.AssetresolveToAsset(org.apache.sling.api.resource.Resource resource) Resolve the resource to an asset.protected voidsortByConfidence(List<PredictedTag> tagList) Sort the list of predicted tag sorted by confidenceprotected doublevalidateLowerConfidenceThreshold(Double lowerConfidenceThresholdValue) Validate and return lower confidence threshold.
-
Field Details
-
MINIMUM_LOWER_CONFIDENCE_THRESHOLD_VALUE
public static final double MINIMUM_LOWER_CONFIDENCE_THRESHOLD_VALUE- See Also:
-
-
Constructor Details
-
PredictedTagsUtil
public PredictedTagsUtil()
-
-
Method Details
-
getPredictedTags
public List<PredictedTag> getPredictedTags(org.apache.sling.api.resource.Resource resource, String relativePropertyPath, Double lowerConfidenceThreshold) For the given resource and relative property path: Validate that the resource is an asset, extract all predicted tags below the relative property path, adapt them to PredictedTags and filter out those whose confidence value is lower than the lowerConfidenceThreshold- Parameters:
resource- the resourcerelativePropertyPath- the property path of the predicted tags, relative to the resourcelowerConfidenceThreshold- the lower threshold for confidence values- Returns:
- the list of predicted tags, sorted (desc) by confidence
-
sortByConfidence
Sort the list of predicted tag sorted by confidence- Parameters:
tagList-
-
resolveToAsset
public com.day.cq.dam.api.Asset resolveToAsset(org.apache.sling.api.resource.Resource resource) Resolve the resource to an asset. Return null if the resource cannot be resolved to an asset- Parameters:
resource- the resource- Returns:
- the resource as asset. Return null if the resource cannot be resolved to an asset
-
getPredictedTagsResource
protected org.apache.sling.api.resource.Resource getPredictedTagsResource(org.apache.sling.api.resource.Resource resource, com.day.cq.dam.api.Asset asset, String relativePropertyPath) -
validateLowerConfidenceThreshold
Validate and return lower confidence threshold. Value must be a double and not less than 0.0- Parameters:
lowerConfidenceThresholdValue- the input threshold value- Returns:
- the validated lower confidence threshold
-