CheckForProfanity input: string[] Documents, enum DocumentFormat output: TaxonomySubTrees[] CheckForProfanityResult
Takes as an input a list of Documents and their DocumentFormat : text or URL. Profanity is then extracted from the document content and returned as an array of TaxonomySubTree for each document. TaxonomySubTree stores the parent category (Profanity) and one or more child entities.
See Extract Taxonomy Entries from Text for more information about TaxonomySubTrees.
Sample code in C#:
PingarAPIRequest request = new PingarAPIRequest();
request.AppID = "your app id";
request.AppKey = "your app key";
request.TextAnalysis = new TextAnalysisRequest();
request.TextAnalysis.Documents = new string[] { "document text" };
request.TextAnalysis.DocumentsFormat = DocumentFormat.Text;
request.Language = Language.EN;
PingarAPIServiceSoapClient pingarAPI = new PingarAPIServiceSoapClient();
PingarAPIResponse response = pingarAPI.CheckForProfanity(request);
int count = 0;
if (response.Error == null)
{
foreach (TaxonomySubTrees document in
response.TextAnalysis.CheckForProfanityResult)
{
Console.WriteLine("Taxonomy Hierarchy For Document " + count);
if (document.subtrees.Length > 0)
{
foreach (TaxonomySubTree subtree in document.subtrees)
{
Console.WriteLine(subtree.Parent.Title);
foreach (MappedConcept child in subtree.Children)
{
Console.WriteLine(" " + child.Title + ");
}
}
}
else
{
Console.WriteLine("No profanity found.");
}
count++;
}
}