SensitiveInfoAnalyzer

public class SensitiveInfoAnalyzer

Class to analyse a text for sensitive information.

It is a good idea to test that the model is loaded before calling analyseText(). A simple use-case to test a text for sensitive information would be:

func classifyText(text: String) -> Score? {
    if (SensitiveInfoAnalyzer.sharedInstance().isLoaded()) {
        return SensitiveInfoAnalyzer.sharedInstance().analyse(text: text)
    }
    return nil
}
  • Class function to get the single instance of this class.

    Declaration

    Swift

    public class func sharedInstance() -> SensitiveInfoAnalyzer

    Return Value

    The singleton instance of the class.

  • Initialise The sensitive info analyzer.

    Declaration

    Swift

    public func initManager()
  • Check whether the model has been initialised or not.

    Declaration

    Swift

    public func isLoaded() -> Bool

    Return Value

    true if the model is loaded.

  • Declaration

    Swift

    public func getVersion() -> String

    Return Value

    The version of this model.

  • Analyse a text for sensitive information. Catches sharing of UK postcode, UK phone numbers and email addresses.

    Declaration

    Swift

    public func analyse(text: String) -> SensitiveInfoResult?

    Parameters

    text

    The text to analyse.

    Return Value

    A SensitiveInfoResult encapsulating the result of the analysis.