Exemplo n.º 1
0
        public void SensitiveRecognition()
        {
            //对象键
            try {
                string key = photoKey;

                SensitiveContentRecognitionRequest request = new SensitiveContentRecognitionRequest(bucket, key, "p**n,terrorist,politics");

                SensitiveContentRecognitionResult result = QCloudServer.Instance().cosXml.SensitiveContentRecognition(request);

                // Console.WriteLine(result.GetResultInfo());
                Assert.IsNotEmpty((result.GetResultInfo()));

                Assert.True(result.httpCode == 200);
                Assert.NotNull(result.recognitionResult);
                Assert.NotNull(result.recognitionResult.PoliticsInfo);
                Assert.Zero(result.recognitionResult.PoliticsInfo.Code);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Score);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Count);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Msg);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Label);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.HitFlag);
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                Console.WriteLine("CosClientException: " + clientEx.Message);
                Assert.Fail();
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
                Assert.Fail();
            }
        }
Exemplo n.º 2
0
        public void SensitiveRecognition()
        {
            //对象键
            //对象键
            string key = photoKey;

            SensitiveContentRecognitionRequest request = new SensitiveContentRecognitionRequest(bucket, key, "politics");

            SensitiveContentRecognitionResult result = QCloudServer.Instance().cosXml.SensitiveContentRecognition(request);

            // Console.WriteLine(result.GetResultInfo());
            Assert.IsNotEmpty((result.GetResultInfo()));

            Assert.True(result.httpCode == 200);
            Assert.NotNull(result.recognitionResult);
            Assert.NotNull(result.recognitionResult.PoliticsInfo);
            Assert.Zero(result.recognitionResult.PoliticsInfo.Code);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Score);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Count);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Msg);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Label);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.HitFlag);
        }