CompareComply
public class CompareComply
IBM Watson™ Compare and Comply is discontinued. Existing instances are supported until 30 November 2021, but as of 1 December 2020, you can’t create instances. Any instance that exists on 30 November 2021 will be deleted. Consider migrating to Watson Discovery Premium on IBM Cloud for your Compare and Comply use cases. To start the migration process, visit https://ibm.biz/contact-wdc-premium. {: deprecated} Compare and Comply analyzes governing documents to provide details about critical aspects of the documents.
-
The base URL to use when contacting the service.
Declaration
Swift
public var serviceURL: String? -
Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is
2018-10-15.Declaration
Swift
public var version: String -
Service identifiers
Declaration
Swift
public static let defaultServiceName: String -
The default HTTP headers for all requests to the service.
Declaration
Swift
public var defaultHeaders: [String : String] -
Undocumented
Declaration
Swift
public let authenticator: Authenticator -
Create a
CompareComplyobject.If an authenticator is not supplied, the initializer will retrieve credentials from the environment or a local credentials file and construct an appropriate authenticator using these credentials. The credentials file can be downloaded from your service instance on IBM Cloud as ibm-credentials.env. Make sure to add the credentials file to your project so that it can be loaded at runtime.
If an authenticator is not supplied and credentials are not available in the environment or a local credentials file, initialization will fail by throwing an exception. In that case, try another initializer that directly passes in the credentials.
- serviceName: String = defaultServiceName
-
Create a
CompareComplyobject.Declaration
Swift
public init(version: String, authenticator: Authenticator)Parameters
versionRelease date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is
2018-10-15.authenticatorThe Authenticator object used to authenticate requests to the service
-
Allow network requests to a server without verification of the server certificate. IMPORTANT: This should ONLY be used if truly intended, as it is unsafe otherwise.
Declaration
Swift
public func disableSSLVerification() -
Convert document to HTML.
Converts a document to HTML.
Declaration
Swift
public func convertToHTML( file: Data, fileContentType: String? = nil, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<HTMLReturn>?, WatsonError?) -> Void)Parameters
fileThe document to convert.
fileContentTypeThe content type of file.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
Classify the elements of a document.
Analyzes the structural and semantic elements of a document.
Declaration
Swift
public func classifyElements( file: Data, fileContentType: String? = nil, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<ClassifyReturn>?, WatsonError?) -> Void)Parameters
fileThe document to classify.
fileContentTypeThe content type of file.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
Extract a document’s tables.
Analyzes the tables in a document.
Declaration
Swift
public func extractTables( file: Data, fileContentType: String? = nil, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<TableReturn>?, WatsonError?) -> Void)Parameters
fileThe document on which to run table extraction.
fileContentTypeThe content type of file.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
compareDocuments(file1:file2: file1ContentType: file2ContentType: file1Label: file2Label: model: headers: completionHandler: ) Compare two documents.
Compares two input documents. Documents must be in the same format.
Declaration
Swift
public func compareDocuments( file1: Data, file2: Data, file1ContentType: String? = nil, file2ContentType: String? = nil, file1Label: String? = nil, file2Label: String? = nil, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<CompareReturn>?, WatsonError?) -> Void)Parameters
file1The first document to compare.
file2The second document to compare.
file1ContentTypeThe content type of file1.
file2ContentTypeThe content type of file2.
file1LabelA text label for the first document.
file2LabelA text label for the second document.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
Add feedback.
Adds feedback in the form of labels from a subject-matter expert (SME) to a governing document. 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.
Declaration
Swift
public func addFeedback( feedbackData: FeedbackDataInput, userID: String? = nil, comment: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<FeedbackReturn>?, WatsonError?) -> Void)Parameters
feedbackDataFeedback data for submission.
userIDAn optional string identifying the user.
commentAn optional comment on or description of the feedback.
headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
listFeedback(feedbackType:documentTitle: modelID: modelVersion: categoryRemoved: categoryAdded: categoryNotChanged: typeRemoved: typeAdded: typeNotChanged: pageLimit: cursor: sort: includeTotal: headers: completionHandler: ) List the feedback in a document.
Lists the feedback in a document.
Declaration
Swift
public func listFeedback( feedbackType: String? = nil, documentTitle: String? = nil, modelID: String? = nil, modelVersion: String? = nil, categoryRemoved: String? = nil, categoryAdded: String? = nil, categoryNotChanged: String? = nil, typeRemoved: String? = nil, typeAdded: String? = nil, typeNotChanged: String? = nil, pageLimit: Int? = nil, cursor: String? = nil, sort: String? = nil, includeTotal: Bool? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<FeedbackList>?, WatsonError?) -> Void)Parameters
feedbackTypeAn optional string that filters the output to include only feedback with the specified feedback type. The only permitted value is
element_classification.documentTitleAn optional string that filters the output to include only feedback from the document with the specified
document_title.modelIDAn optional string that filters the output to include only feedback with the specified
model_id. The only permitted value iscontracts.modelVersionAn optional string that filters the output to include only feedback with the specified
model_version.categoryRemovedAn optional string in the form of a comma-separated list of categories. If it is specified, the service filters the output to include only feedback that has at least one category from the list removed.
categoryAddedAn optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list added.
categoryNotChangedAn optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list unchanged.
typeRemovedAn optional string of comma-separated
nature:partypairs. If this is specified, the service filters the output to include only feedback that has at least onenature:partypair from the list removed.typeAddedAn optional string of comma-separated
nature:partypairs. If this is specified, the service filters the output to include only feedback that has at least onenature:partypair from the list removed.typeNotChangedAn optional string of comma-separated
nature:partypairs. If this is specified, the service filters the output to include only feedback that has at least onenature:partypair from the list unchanged.pageLimitAn optional integer specifying the number of documents that you want the service to return.
cursorAn optional string that returns the set of documents after the previous set. Use this parameter with the
page_limitparameter.sortAn optional comma-separated list of fields in the document to sort on. You can optionally specify the sort direction by prefixing the value of the field with
-for descending order or+for ascending order (the default). Currently permitted sorting fields arecreated,user_id, anddocument_title.includeTotalAn optional boolean value. If specified as
true, thepaginationobject in the output includes a value calledtotalthat gives the total count of feedback created.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
Get a specified feedback entry.
Gets a feedback entry with a specified
feedback_id.Declaration
Swift
public func getFeedback( feedbackID: String, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<GetFeedback>?, WatsonError?) -> Void)Parameters
feedbackIDA string that specifies the feedback entry to be included in the output.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
Delete a specified feedback entry.
Deletes a feedback entry with a specified
feedback_id.Declaration
Swift
public func deleteFeedback( feedbackID: String, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<FeedbackDeleted>?, WatsonError?) -> Void)Parameters
feedbackIDA string that specifies the feedback entry to be deleted from the document.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
createBatch(function:inputCredentialsFile: inputBucketLocation: inputBucketName: outputCredentialsFile: outputBucketLocation: outputBucketName: model: headers: completionHandler: ) Submit a batch-processing request.
Run Compare and Comply methods over a collection of input documents. 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.
Declaration
Swift
public func createBatch( function: String, inputCredentialsFile: Data, inputBucketLocation: String, inputBucketName: String, outputCredentialsFile: Data, outputBucketLocation: String, outputBucketName: String, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<BatchStatus>?, WatsonError?) -> Void)Parameters
functionThe Compare and Comply method to run across the submitted input documents.
inputCredentialsFileA JSON file containing the input Cloud Object Storage credentials. At a minimum, the credentials must enable
READpermissions on the bucket defined by theinput_bucket_nameparameter.inputBucketLocationThe geographical location of the Cloud Object Storage input bucket as listed on the Endpoint tab of your Cloud Object Storage instance; for example,
us-geo,eu-geo, orap-geo.inputBucketNameThe name of the Cloud Object Storage input bucket.
outputCredentialsFileA JSON file that lists the Cloud Object Storage output credentials. At a minimum, the credentials must enable
READandWRITEpermissions on the bucket defined by theoutput_bucket_nameparameter.outputBucketLocationThe geographical location of the Cloud Object Storage output bucket as listed on the Endpoint tab of your Cloud Object Storage instance; for example,
us-geo,eu-geo, orap-geo.outputBucketNameThe name of the Cloud Object Storage output bucket.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
List submitted batch-processing jobs.
Lists batch-processing jobs submitted by users.
Declaration
Swift
public func listBatches( headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<Batches>?, WatsonError?) -> Void)Parameters
headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
Get information about a specific batch-processing job.
Gets information about a batch-processing job with a specified ID.
Declaration
Swift
public func getBatch( batchID: String, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<BatchStatus>?, WatsonError?) -> Void)Parameters
batchIDThe ID of the batch-processing job whose information you want to retrieve.
headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
-
Update a pending or active batch-processing job.
Updates a pending or active batch-processing job. You can rescan the input bucket to check for new documents or cancel a job.
Declaration
Swift
public func updateBatch( batchID: String, action: String, model: String? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse<BatchStatus>?, WatsonError?) -> Void)Parameters
batchIDThe ID of the batch-processing job you want to update.
actionThe action you want to perform on the specified batch-processing job.
modelThe analysis model to be used by the service. For the Element classification and Compare two documents methods, the default is
contracts. For the Extract tables method, the default istables. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.headersA dictionary of request headers to be sent with this request.
completionHandlerA function executed when the request completes with a successful result or error
View on GitHub
CompareComply Class Reference