|
| 1 | +[](https://www.nuget.org/packages/IBM.WatsonDeveloperCloud.CompareComply.v1/) |
| 2 | + |
| 3 | +### Compare Comply |
| 4 | +IBM Watson™ [Compare and Comply]() analyzes governing documents to provide details about critical aspects of the documents. |
| 5 | + |
| 6 | +### Installation |
| 7 | +#### Nuget |
| 8 | +``` |
| 9 | +
|
| 10 | +PM > Install-Package IBM.WatsonDeveloperCloud.ComnpareComply.v1 |
| 11 | +
|
| 12 | +``` |
| 13 | +#### .csproj |
| 14 | +```xml |
| 15 | + |
| 16 | +<ItemGroup> |
| 17 | + <PackageReference Include="IBM.WatsonDeveloperCloud.CompareComply.v1" Version="2.11.0" /> |
| 18 | +</ItemGroup> |
| 19 | + |
| 20 | +``` |
| 21 | + |
| 22 | +### Usage |
| 23 | +About |
| 24 | +IBM Watson™ Compare and Comply is a collection of advanced APIs that enable better and faster document understanding. The APIs are pre-trained to handle document conversion, table understanding, Natural Language Processing, and comparison for contracts. JSON output adds real power to end-user applications, for a wide variety of use cases. The machine learning feedback interface is available to collect your feedback which is then incorporated into regular improvements to the core NLP model; the more you use it, the better the system performs. |
| 25 | + |
| 26 | +Compare and Comply is designed to provide: |
| 27 | + |
| 28 | +- Natural language understanding of contracts and invoices |
| 29 | +- The ability to convert programmatic or scanned PDF documents, Microsoft Word files, image files, and text files to annotated JSON or to HTML |
| 30 | +- Identification of legal entities and categories that align with subject matter expertise |
| 31 | +- The ability to extract table information from an input document |
| 32 | +- The ability to compare two contracts |
| 33 | +- Compare and Comply brings together a functionally rich set of integrated, automated Watson APIs to input a file to identify sections, lists (numbered and bulleted), footnotes, and tables, converting these items into a structured HTML format. Furthermore, classification of this structured format is annotated and output as JSON with labeled elements, types, categories, and other information. |
| 34 | + |
| 35 | +#### HTML Conversion |
| 36 | +Uploads a file. The response includes an HTML version of the document. |
| 37 | +```cs |
| 38 | +using (FileStream fs = File.OpenRead(<file-path>)) |
| 39 | +{ |
| 40 | + var htmlConversionResult = service.ConvertToHtml(fs); |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +#### Classify Elements |
| 50 | +Uploads a file. The response includes an analysis of the document’s structural and semantic elements. |
| 51 | +```cs |
| 52 | +using (FileStream fs = File.OpenRead(<file-path>)) |
| 53 | +{ |
| 54 | + var elementClassificationResult = service.ClassifyElements(fs); |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +#### Extract Tables |
| 64 | +Uploads a file. The response includes an analysis of the document’s tables. |
| 65 | +```cs |
| 66 | +using (FileStream fs = File.OpenRead(<file-path>)) |
| 67 | +{ |
| 68 | + var extractTablesResult = service.ExtractTables(fs); |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +#### Compare Documents |
| 79 | +Uploads two PDF or JSON files. The response includes JSON comparing the two documents. Uploaded files must be in the same file format. |
| 80 | +```cs |
| 81 | + using (FileStream fs0 = File.OpenRead(<file-a-path>)) |
| 82 | +{ |
| 83 | + using (FileStream fs1 = File.OpenRead(<file-b-path>)) |
| 84 | + { |
| 85 | + var comparisonResults = service.CompareDocuments(fs0, fs1); |
| 86 | + } |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +#### List Feedback |
| 96 | +Gets the list of batch-processing jobs submitted by users. |
| 97 | +```cs |
| 98 | + var ListFeedbackResult = service.ListFeedback( |
| 99 | + feedbackType: "element_classification", |
| 100 | + before: <before>, |
| 101 | + after: <after>, |
| 102 | + documentTitle: "doc title", |
| 103 | + modelId: "contracts", |
| 104 | + modelVersion: "11.00", |
| 105 | + categoryRemoved: "categoryRemoved", |
| 106 | + categoryAdded: "categoryAdded", |
| 107 | + categoryNotChanged: "categoryUnchanged", |
| 108 | + typeRemoved: "nature:party", |
| 109 | + typeAdded: "nature:party", |
| 110 | + typeNotChanged: "nature:party", |
| 111 | + pageLimit: 3, |
| 112 | + sort: "sort" |
| 113 | + ); |
| 114 | +``` |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | +#### Add Feedback |
| 122 | +Adds feedback in the form of labels from a subject-matter expert (SME) to a governing document. |
| 123 | +Important: Feedback is not immediately incorporated into the training model, nor is it guaranteed to be incorporated at a later date. Instead, submitted feedback is used to suggest future updates to the training model. |
| 124 | +```cs |
| 125 | +var addFeedbackResult = service.AddFeedback(<feedbackData>); |
| 126 | +``` |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | +#### Get Feedback |
| 134 | +List a specified feedback entry |
| 135 | +```cs |
| 136 | +// temporary fix for a bug requiring `x-watson-metadata` header |
| 137 | +Dictionary<string, object> customData = new Dictionary<string, object>(); |
| 138 | +Dictionary<string, string> customHeaders = new Dictionary<string, string>(); |
| 139 | +customHeaders.Add("x-watson-metadata", "customer_id=sdk-test-customer-id"); |
| 140 | +customData.Add(Constants.CUSTOM_REQUEST_HEADERS, customHeaders); |
| 141 | + |
| 142 | +var getFeedbackResult = service.GetFeedback(<feedback-id>, customData:customData); |
| 143 | +``` |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | +#### Delete Feedback |
| 151 | +Deletes a specified feedback entry |
| 152 | +```cs |
| 153 | +var deleteFeedbackResult = service.DeleteFeedback(<feedback-id>); |
| 154 | +``` |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | +#### List Batches |
| 162 | +Gets the list of submitted batch-processing jobs |
| 163 | +```cs |
| 164 | +var getBatchesResult = service.ListBatches(); |
| 165 | +``` |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | +#### Create Batch Request |
| 173 | +Run Compare and Comply methods over a collection of input documents. |
| 174 | +Important: Batch processing requires the use of the IBM Cloud Object Storage service. The use of IBM Cloud Object Storage with Compare and Comply is discussed at Using batch processing. |
| 175 | +```cs |
| 176 | +using (FileStream fsInput = File.OpenRead(<input-credentials-file-path>)) |
| 177 | +{ |
| 178 | + using (FileStream fsOutput = File.OpenRead(<output-credentials-file-path>)) |
| 179 | + { |
| 180 | + var createBatchResult = service.CreateBatch( |
| 181 | + <action>, |
| 182 | + fsInput, |
| 183 | + <input-storage-location>, |
| 184 | + <input-bucket-name>, |
| 185 | + fsOutput, |
| 186 | + <output-storage-location>, |
| 187 | + <output-bucket-name> |
| 188 | + ); |
| 189 | + batchId = createBatchResult.BatchId; |
| 190 | + } |
| 191 | +} |
| 192 | +``` |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | +#### Get Batch |
| 200 | +Gets information about a specific batch-processing request |
| 201 | +```cs |
| 202 | +var getBatchResult = service.GetBatch(<batch-id>); |
| 203 | +``` |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | +#### Update Batch |
| 211 | +Updates a pending or active batch-processing request. You can rescan the input bucket to check for new documents or cancel a request. |
| 212 | +```cs |
| 213 | +var updateBatchResult = service.UpdateBatch(<batch-id>, <action>); |
| 214 | +``` |
| 215 | + |
| 216 | +[compare-comply]: https://cloud.ibm.com/docs/services/compare-comply/index.html |
0 commit comments