protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { if (cognitiveIndexable.Faces == null || cognitiveIndexable.Faces.Length == 0) { return(null); } List <int> returnValue = cognitiveIndexable.Faces?.Select(x => (int)x.FaceAttributes.Glasses).ToList(); return(returnValue); }
protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { if (cognitiveIndexable.Text == null) { return(null); } var json = new JavaScriptSerializer().Serialize(cognitiveIndexable.Text); return(json); }
protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { MediaItem mediaItem = new MediaItem(cognitiveIndexable.Item); if (string.IsNullOrEmpty(mediaItem.InnerItem["Height"]) || string.IsNullOrEmpty(mediaItem.InnerItem["Width"])) { return(null); } int height; int width; if (!int.TryParse(mediaItem.InnerItem["Height"], out height) || !int.TryParse(mediaItem.InnerItem["Width"], out width)) { return(null); } if (height >= 2272 && width >= 1704) { return((int)ImageSize.Size4Mp); } if (height >= 1600 && width >= 1200) { return((int)ImageSize.Size2Mp); } if (height >= 1024 && width >= 768) { return((int)ImageSize.Size1024X768); } if (height >= 800 && width >= 600) { return((int)ImageSize.Size800X600); } if (height >= 640 && width >= 480) { return((int)ImageSize.Size640X480); } if (height >= 400 && width >= 300) { return((int)ImageSize.Size400X300); } return(null); }
protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { var regions = cognitiveIndexable.Text?.Regions; if (regions == null) { return(null); } var words = ( from r in regions where r.Lines != null from l in r.Lines where l.Words != null from w in l.Words where !string.IsNullOrEmpty(w.Text.Trim()) select w.Text.Trim() ); var tags = cognitiveIndexable.Visions?.Description?.Tags.Select(t => t.Trim()).ToList(); if (tags != null && tags.Any()) { words = words.Concat(tags); } words = words.Concat(new [] { cognitiveIndexable.Item.DisplayName }); List <string> charList = new List <string>() { ":", ";", "~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "+", "=", "_", "-", "|", "\\", "{", "}", "[", "]", "\"", "'", "?", "/", ">", ".", "<", "," }; var results = words.Where(w => !charList.Contains(w)).Distinct().ToArray(); return((results.Any()) ? results.Distinct() : null); }
protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { if (cognitiveIndexable.Faces == null || cognitiveIndexable.Faces.Length == 0) { return(null); } if (cognitiveIndexable.Faces.Any(x => x.FaceAttributes.Gender.Equals("male")) && cognitiveIndexable.Faces.Any(x => x.FaceAttributes.Gender.Equals("female"))) { return(2); } if (cognitiveIndexable.Faces.Any(x => x.FaceAttributes.Gender.Equals("male"))) { return(3); } if (cognitiveIndexable.Faces.Any(x => x.FaceAttributes.Gender.Equals("female"))) { return(4); } return(1); }
protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { return((cognitiveIndexable.Emotions != null && cognitiveIndexable.Emotions.Length > 0) ? (object)cognitiveIndexable.Emotions?.Average(x => x.Scores.Sadness) : null); }
protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { return((cognitiveIndexable.Visions != null && cognitiveIndexable.Visions.Adult != null) ? (object)cognitiveIndexable.Visions.Adult.AdultScore : null); }
protected override object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { return(cognitiveIndexable?.Faces?.Select(x => x.FaceAttributes.Age).OrderByDescending(a => a).FirstOrDefault() ?? 100d); }
protected virtual object GetFieldValue(CognitiveIndexableImageItem cognitiveIndexable) { return(null); }