Beispiel #1
0
    //上から三つを抽出
    private static EntityAnnotation[] GetTop3(responseBody annotations)
    {
        var retAnnotations = new List <EntityAnnotation>();

        for (int i = 0; i < 3; i++)
        {
            retAnnotations.Add(annotations.responses[0].labelAnnotations[i]);
        }

        return(retAnnotations.ToArray());
    }
Beispiel #2
0
    // 除外するやつ
    public static EntityAnnotation[] RemoveAttributeData(responseBody originData, string[] blackList)
    {
        var retAnnotations = new List <EntityAnnotation>();

        // 画像ごと
        foreach (var item1 in originData.responses)
        {
            // 属性ごと
            foreach (var item2 in item1.labelAnnotations)
            {
                // ブラックリストと一致してたら追加しない
                if (!CheckRemove(item1.labelAnnotations.ToArray(), blackList))
                {
                    retAnnotations.Add(item2);
                }
            }
        }

        return(retAnnotations.ToArray());
    }
Beispiel #3
0
    //一致判定を取る
    public static bool CheckDifference(responseBody originData, responseBody fromData)
    {
        var buffOrigin = GetTop3(originData);
        var buffFrom   = GetSameAnnotations(buffOrigin, fromData);

        buffOrigin = ConvertToRatio(buffOrigin);
        buffFrom   = ConvertToRatio(buffFrom);

        var checkResult = TakeDifferenceSum(buffOrigin, buffFrom);

        //判定式
        var limit = 10;

        if (checkResult < limit)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Beispiel #4
0
    //同じ要素を取る
    private static EntityAnnotation[] GetSameAnnotations(EntityAnnotation[] originData, responseBody fromData)
    {
        var retAnnotations = new List <EntityAnnotation>();

        for (int i = 0; i < 3; i++)
        {
            foreach (var item in fromData.responses[0].labelAnnotations)
            {
                if (item.description == originData[i].description)
                {
                    retAnnotations.Add(item);
                }
            }

            //例外処理を取らないといけない
            //if (retAnnotations[i] == null)
            //{
            //    return
            //}
        }

        return(retAnnotations.ToArray());
    }