Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit d507270

Browse files
Merge pull request #10 from Azure-Samples/pafarley-updates
add snippet tags
2 parents 4f73178 + bd9c2e0 commit d507270

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

documentation-samples/csharp/image-moderation-quickstart-dotnet.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
// <snippet_using>
12
using Microsoft.Azure.CognitiveServices.ContentModerator;
23
using Microsoft.Azure.CognitiveServices.ContentModerator.Models;
34
using Newtonsoft.Json;
45
using System;
56
using System.Collections.Generic;
67
using System.IO;
78
using System.Threading;
8-
9+
// </snippet_using>
910

1011
namespace ImageModeration
1112
{
1213
class Program
1314
{
1415
static void Main(string[] args)
1516
{
17+
// <snippet_main>
1618
// Create an object to store the image moderation results.
1719
List<EvaluationData> evaluationData = new List<EvaluationData>();
1820

@@ -43,14 +45,18 @@ static void Main(string[] args)
4345
outputWriter.Flush();
4446
outputWriter.Close();
4547
}
48+
// </snippet_main>
4649
}
4750

51+
// <snippet_fields>
4852
//The name of the file that contains the image URLs to evaluate.
4953
private static string ImageUrlFile = "ImageFiles.txt";
5054

5155
///The name of the file to contain the output from the evaluation.
5256
private static string OutputFile = "ModerationOutput.json";
57+
// </snippet_fields>
5358

59+
// <snippet_evaluate>
5460
// Evaluates an image using the Image Moderation APIs.
5561
private static EvaluationData EvaluateImage(
5662
ContentModeratorClient client, string imageUrl)
@@ -78,8 +84,10 @@ private static EvaluationData EvaluateImage(
7884

7985
return imageData;
8086
}
87+
// </snippet_evaluate>
8188
}
8289

90+
// <snippet_client>
8391
// Wraps the creation and configuration of a Content Moderator client.
8492
public static class Clients
8593
{
@@ -103,7 +111,9 @@ public static ContentModeratorClient NewClient()
103111
return client;
104112
}
105113
}
114+
// </snippet_client>
106115

116+
// <snippet_dataclass>
107117
// Contains the image moderation results for an image,
108118
// including text and face detection results.
109119
public class EvaluationData
@@ -120,4 +130,5 @@ public class EvaluationData
120130
// The face detection results;
121131
public FoundFaces FaceDetection;
122132
}
133+
// </snippet_dataclass>
123134
}

documentation-samples/csharp/text-moderation-quickstart-dotnet.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// <snippet_using>
12
using Microsoft.Azure.CognitiveServices.ContentModerator;
23
using Microsoft.CognitiveServices.ContentModerator;
34
using Microsoft.CognitiveServices.ContentModerator.Models;
@@ -6,20 +7,23 @@
67
using System.Collections.Generic;
78
using System.IO;
89
using System.Threading;
10+
// </snippet_using>
911

1012
namespace TextModeration
1113
{
1214
class Program
1315
{
14-
16+
// <snippet_fields>
1517
// The name of the file that contains the text to evaluate.
1618
private static string TextFile = "TextFile.txt";
1719

1820
// The name of the file to contain the output from the evaluation.
1921
private static string OutputFile = "TextModerationOutput.txt";
22+
// </snippet_fields>
2023

2124
static void Main(string[] args)
2225
{
26+
// <snippet_main>
2327
// Load the input text.
2428
string text = File.ReadAllText(TextFile);
2529
Console.WriteLine("Screening {0}", TextFile);
@@ -46,11 +50,12 @@ static void Main(string[] args)
4650
outputWriter.Flush();
4751
outputWriter.Close();
4852
}
49-
53+
// </snippet_main>
5054
}
5155

5256
}
5357

58+
// <snippet_client>
5459
// Wraps the creation and configuration of a Content Moderator client.
5560
public static class Clients
5661
{
@@ -74,4 +79,5 @@ public static ContentModeratorClient NewClient()
7479
return client;
7580
}
7681
}
82+
// </snippet_client>
7783
}

0 commit comments

Comments
 (0)