Updated MPPTextClassifier header formatting

This commit is contained in:
Prianka Liz Kariat 2023-01-06 15:11:34 +05:30
parent 7d0678c110
commit ad7fd76fb1

View File

@ -21,49 +21,52 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/** /**
* @brief Performs classification on text.
*
* This API expects a TFLite model with (optional) [TFLite Model * This API expects a TFLite model with (optional) [TFLite Model
* Metadata](https://www.tensorflow.org/lite/convert/metadata")that contains the mandatory * Metadata](https://www.tensorflow.org/lite/convert/metadata")that contains the mandatory
* (described below) input tensors, output tensor, and the optional (but recommended) label items as * (described below) input tensors, output tensor, and the optional (but recommended) label
* AssociatedFiles with type TENSOR_AXIS_LABELS per output classification tensor. * items as AssociatedFiles with type TENSOR_AXIS_LABELS per output classification tensor.
* *
* Metadata is required for models with int32 input tensors because it contains the input process * Metadata is required for models with int32 input tensors because it contains the input
* unit for the model's Tokenizer. No metadata is required for models with string input tensors. * process unit for the model's Tokenizer. No metadata is required for models with string
* input tensors.
* *
* Input tensors * Input tensors
* - Three input tensors `kTfLiteInt32` of shape `[batch_size xbert_max_seq_len]` * - Three input tensors `kTfLiteInt32` of shape `[batch_size xbert_max_seq_len]`
* representing the input ids, mask ids, and segment ids. This input signature requires a * representing the input ids, mask ids, and segment ids. This input signature requires
* Bert Tokenizer process unit in the model metadata. * a Bert Tokenizer process unit in the model metadata.
* - Or one input tensor `kTfLiteInt32` of shape `[batch_size xmax_seq_len]` representing * - Or one input tensor `kTfLiteInt32` of shape `[batch_size xmax_seq_len]` representing
* the input ids. This input signature requires a Regex Tokenizer process unit in the * the input ids. This input signature requires a Regex Tokenizer process unit in the
* model metadata. * model metadata.
* - Or one input tensor ({@code kTfLiteString}) that is shapeless or has shape `[1]` containing * - Or one input tensor (`kTfLiteString`) that is shapeless or has shape `[1]` containing
* the input string. * the input string.
* *
* At least one output tensor `(kTfLiteFloat32}/kBool)` with: * At least one output tensor (`kTfLiteFloat32/kBool`) with:
* - `N` classes and shape `[1 x N]` * - `N` classes and shape `[1 x N]`
* - optional (but recommended) label map(s) as AssociatedFile-s with type TENSOR_AXIS_LABELS, * - optional (but recommended) label map(s) as AssociatedFiles with type
* containing one label per line. The first such AssociatedFile (if any) is used to fill the * TENSOR_AXIS_LABELS,
* `class_name` field of the results. The `display_name` field is filled from the AssociatedFile * containing one label per line. The first such AssociatedFile (if any) is used to fill
* (if any) whose locale matches the `display_names_locale` field of the * the `categoryName` field of the results. The `displayName` field is filled from the
* `MPPTextClassifierOptions` used at creation time ("en" by default, i.e. English). If none of * AssociatedFile (if any) whose locale matches the `displayNamesLocale` field of the
* these are available, only the `index` field of the results will be filled. * `MPPTextClassifierOptions` used at creation time ("en" by default, i.e. English). If
* * none of these are available, only the `index` field of the results will be filled.
* @brief Performs classification on text. **/
*/
NS_SWIFT_NAME(TextClassifier) NS_SWIFT_NAME(TextClassifier)
@interface MPPTextClassifier : NSObject @interface MPPTextClassifier : NSObject
/** /**
* Creates a new instance of `MPPTextClassifier` from an absolute path to a TensorFlow Lite model * Creates a new instance of `MPPTextClassifier` from an absolute path to a TensorFlow Lite
* file stored locally on the device and the default `MPPTextClassifierOptions`. * model file stored locally on the device and the default `MPPTextClassifierOptions`.
* *
* @param modelPath An absolute path to a TensorFlow Lite model file stored locally on the device. * @param modelPath An absolute path to a TensorFlow Lite model file stored locally on the
* device.
* @param error An optional error parameter populated when there is an error in initializing * @param error An optional error parameter populated when there is an error in initializing
* the text classifier. * the text classifier.
* *
* @return A new instance of `MPPTextClassifier` with the given model path. `nil` if there is an * @return A new instance of `MPPTextClassifier` with the given model path. `nil` if there is an
* error in initializing the text classifier. * error in initializing the text classifier.
*/ **/
- (instancetype)initWithModelPath:(NSString *)modelPath error:(NSError **)error; - (instancetype)initWithModelPath:(NSString *)modelPath error:(NSError **)error;
/** /**
@ -74,10 +77,11 @@ NS_SWIFT_NAME(TextClassifier)
* @param error An optional error parameter populated when there is an error in initializing * @param error An optional error parameter populated when there is an error in initializing
* the text classifier. * the text classifier.
* *
* @return A new instance of `MPPTextClassifier` with the given options. `nil` if there is an error * @return A new instance of `MPPTextClassifier` with the given options. `nil` if there is an
* in initializing the text classifier. * error in initializing the text classifier.
*/ **/
- (instancetype)initWithOptions:(MPPTextClassifierOptions *)options error:(NSError **)error; - (instancetype)initWithOptions:(MPPTextClassifierOptions *)options
error:(NSError **)error NS_DESIGNATED_INITIALIZER;
/** /**
* Performs classification on the input text. * Performs classification on the input text.
@ -87,7 +91,7 @@ NS_SWIFT_NAME(TextClassifier)
* classification on the input text. * classification on the input text.
* *
* @return A `MPPTextClassifierResult` object that contains a list of text classifications. * @return A `MPPTextClassifierResult` object that contains a list of text classifications.
*/ **/
- (nullable MPPTextClassifierResult *)classifyWithText:(NSString *)text error:(NSError **)error; - (nullable MPPTextClassifierResult *)classifyWithText:(NSString *)text error:(NSError **)error;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;