Exemplo n.º 1
0
    /// <summary>
    /// Given a collection of detected objects, create the tags, put them in the cache,
    /// and then return a list of keyword => TagID key-value pairs
    /// </summary>
    /// <param name="objects"></param>
    /// <returns></returns>
    private async Task <IDictionary <string, int> > CreateNewTags(IList <ImageDetectResult> objects)
    {
        var allLabels = objects.Select(x => x.Tag).Distinct().ToList();
        var tags      = await _metdataService.CreateTagsFromStrings(allLabels);

        return(tags.ToDictionary(x => x.Keyword, y => y.TagId, StringComparer.OrdinalIgnoreCase));
    }