| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | |
| | | 6 | | namespace Azure.AI.TextAnalytics |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// The result of the extract key phrases operation on a document. |
| | | 10 | | /// </summary> |
| | | 11 | | public class ExtractKeyPhrasesResult : TextAnalyticsResult |
| | | 12 | | { |
| | | 13 | | private readonly KeyPhraseCollection _keyPhrases; |
| | | 14 | | |
| | | 15 | | internal ExtractKeyPhrasesResult(string id, TextDocumentStatistics statistics, KeyPhraseCollection keyPhrases) |
| | 52 | 16 | | : base(id, statistics) |
| | | 17 | | { |
| | 52 | 18 | | _keyPhrases = keyPhrases; |
| | 52 | 19 | | } |
| | | 20 | | |
| | 8 | 21 | | internal ExtractKeyPhrasesResult(string id, TextAnalyticsError error) : base(id, error) { } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets the collection of key phrases identified in the document. |
| | | 25 | | /// </summary> |
| | | 26 | | public KeyPhraseCollection KeyPhrases |
| | | 27 | | { |
| | | 28 | | get |
| | | 29 | | { |
| | 48 | 30 | | if (HasError) |
| | | 31 | | { |
| | | 32 | | #pragma warning disable CA1065 // Do not raise exceptions in unexpected locations |
| | 4 | 33 | | throw new InvalidOperationException($"Cannot access result for document {Id}, due to error {Error.Er |
| | | 34 | | #pragma warning restore CA1065 // Do not raise exceptions in unexpected locations |
| | | 35 | | } |
| | 44 | 36 | | return _keyPhrases; |
| | | 37 | | } |
| | | 38 | | } |
| | | 39 | | } |
| | | 40 | | } |