sensitivity.io for iOS & macOS  1.1.4
Instance Methods | List of all members
Classifier Class Reference

#import <Classifier.h>

Inheritance diagram for Classifier:

Instance Methods

(instancetype _Nullable) - initWithError:
 
(BOOL) - cancelClassifyWithError:
 
(BOOL) - isCanceled:withError:
 
(Classification *_Nullable) - classifyString:withError:
 
(Classification *_Nullable) - classifyData:fileName:withError:
 
(Classification *_Nullable) - classifyFileAtPath:withError:
 

Detailed Description

Classifier class provides the means to classify texts, data and files. Before performing any classify action the classification module needs to have its resources initialized, the license needs to be loaded, the classifier needs to be registered with a settings loader and the classifier settings need to be loaded with that settings loader. When cancelling a classifier, it will become invalid, so in order to perform a new classify you need to create a new instance of Classifier.

Method Documentation

◆ cancelClassifyWithError:()

- (BOOL) cancelClassifyWithError: (NSError *_Nullable *_Nullable)  error

Cancels current classify

Note
The classifier object is invalidated when classify is canceled and no other classify can be done with the canceled classifier.
Parameters
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ classifyData:fileName:withError:()

- (Classification* _Nullable) classifyData: (NSData *_Nonnull)  data
fileName: (NSString *_Nullable)  fileName
withError: (NSError *_Nullable *_Nullable)  error 

Classifies data.

Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, SENSITIVITYIO_EUNSUPPORTEDMIMETYPE, ECANCELED, EIO
Parameters
dataThe data that needs to be classified
fileNameIf data is the content of a file, pass file name (otherwise it may be nil or empty string)
errorThe error representing the reason for the failure
Returns
The classification or nil in case an error occured

◆ classifyFileAtPath:withError:()

- (Classification* _Nullable) classifyFileAtPath: (NSString *_Nonnull)  filePath
withError: (NSError *_Nullable *_Nullable)  error 

Classifies file.

Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, SENSITIVITYIO_EUNSUPPORTEDMIMETYPE, ECANCELED, ENOENT, EIO
Parameters
filePathThe path of the file that needs to be classified
errorThe error representing the reason for the failure
Returns
The classification or nil in case an error occured

◆ classifyString:withError:()

- (Classification* _Nullable) classifyString: (NSString *_Nonnull)  text
withError: (NSError *_Nullable *_Nullable)  error 

Classifies provided text.

Remarks
Relevant errors: SENSITIVITYIO_ELICENSEEXPIRED, SENSITIVITYIO_EINVALIDLICENSE, SENSITIVITYIO_ESETTINGS, ECANCELED, EIO
Parameters
textThe text to classify
errorThe error representing the reason for the failure
Returns
The classification or nil in case an error occured

◆ initWithError:()

- (instancetype _Nullable) initWithError: (NSError *_Nullable *_Nullable)  error

Initializes a new object immediately after memory for it has been allocated

Note
The designated initializer
Parameters
errorThe error representing the reason for the failure
Returns
The initialized object

◆ isCanceled:withError:()

- (BOOL) isCanceled: (BOOL *_Nonnull)  canceled
withError: (NSError *_Nullable *_Nullable)  error 

Checks if classifier is canceled

Parameters
canceledWill be set to the canceled status in case the check was successful
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

The documentation for this class was generated from the following file: