/
PiiEntityCollection.cs
74 lines (65 loc) · 2.25 KB
/
PiiEntityCollection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
namespace Azure.AI.TextAnalytics
{
/// <summary>
/// Collection of <see cref="PiiEntity"/> objects in a document,
/// and warnings encountered while processing the document.
/// </summary>
[DebuggerTypeProxy(typeof(PiiEntityCollectionDebugView))]
public class PiiEntityCollection : ReadOnlyCollection<PiiEntity>
{
internal PiiEntityCollection(IList<PiiEntity> entities, string redactedText, IList<TextAnalyticsWarning> warnings)
: base(entities)
{
RedactedText = redactedText;
Warnings = new ReadOnlyCollection<TextAnalyticsWarning>(warnings);
}
/// <summary>
/// Gets the text of the input document with all of the Personally Identifiable Information
/// redacted out.
/// </summary>
public string RedactedText { get; }
/// <summary>
/// Warnings encountered while processing the document.
/// </summary>
public IReadOnlyCollection<TextAnalyticsWarning> Warnings { get; }
/// <summary>
/// Debugger Proxy class for <see cref="PiiEntityCollection"/>.
/// </summary>
internal class PiiEntityCollectionDebugView
{
private PiiEntityCollection BaseCollection { get; }
public PiiEntityCollectionDebugView(PiiEntityCollection collection)
{
BaseCollection = collection;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public List<PiiEntity> Items
{
get
{
return BaseCollection.ToList();
}
}
public IReadOnlyCollection<TextAnalyticsWarning> Warnings
{
get
{
return BaseCollection.Warnings;
}
}
public string RedactedText
{
get
{
return BaseCollection.RedactedText;
}
}
}
}
}