objc2_speech/generated/SFTranscription.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// A textual representation of the specified speech in its entirety, as recognized by the speech recognizer.
12 ///
13 /// Use `SFTranscription` to obtain all the recognized utterances from your audio content. An _utterance_ is a vocalized word or group of words that represent a single meaning to the speech recognizer (``SFSpeechRecognizer``).
14 ///
15 /// Use the ``formattedString`` property to retrieve the entire transcription of utterances, or use the ``segments`` property to retrieve an individual utterance (``SFTranscriptionSegment``).
16 ///
17 /// You don't create an `SFTranscription` directly. Instead, you retrieve it from an ``SFSpeechRecognitionResult`` instance. The speech recognizer sends a speech recognition result to your app in one of two ways, depending on how your app started a speech recognition task.
18 ///
19 /// You can start a speech recognition task by using the speech recognizer's ``SFSpeechRecognizer/recognitionTask(with:resultHandler:)`` method. When the task is complete, the speech recognizer sends an ``SFSpeechRecognitionResult`` instance to your `resultHandler` closure. Alternatively, you can use the speech recognizer's ``SFSpeechRecognizer/recognitionTask(with:delegate:)`` method to start a speech recognition task. When the task is complete, the speech recognizer uses your ``SFSpeechRecognitionTaskDelegate`` to send an ``SFSpeechRecognitionResult`` by using the delegate's ``SFSpeechRecognitionTaskDelegate/speechRecognitionTask(_:didFinishRecognition:)`` method.
20 ///
21 /// An `SFTranscription` represents only a potential version of the speech. It might not be an accurate representation of the utterances.
22 ///
23 /// See also [Apple's documentation](https://developer.apple.com/documentation/speech/sftranscription?language=objc)
24 #[unsafe(super(NSObject))]
25 #[derive(Debug, PartialEq, Eq, Hash)]
26 pub struct SFTranscription;
27);
28
29extern_conformance!(
30 unsafe impl NSCoding for SFTranscription {}
31);
32
33extern_conformance!(
34 unsafe impl NSCopying for SFTranscription {}
35);
36
37unsafe impl CopyingHelper for SFTranscription {
38 type Result = Self;
39}
40
41extern_conformance!(
42 unsafe impl NSObjectProtocol for SFTranscription {}
43);
44
45extern_conformance!(
46 unsafe impl NSSecureCoding for SFTranscription {}
47);
48
49impl SFTranscription {
50 extern_methods!(
51 /// The entire transcription of utterances, formatted into a single, user-displayable string.
52 #[unsafe(method(formattedString))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn formattedString(&self) -> Retained<NSString>;
55
56 #[cfg(feature = "SFTranscriptionSegment")]
57 /// An array of transcription segments that represent the parts of the transcription, as identified by the speech recognizer.
58 ///
59 /// The order of the segments in the array matches the order in which the corresponding utterances occur in the spoken content.
60 #[unsafe(method(segments))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn segments(&self) -> Retained<NSArray<SFTranscriptionSegment>>;
63
64 /// The number of words spoken per minute.
65 #[deprecated = "speakingRate is moved to SFSpeechRecognitionMetadata"]
66 #[unsafe(method(speakingRate))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn speakingRate(&self) -> c_double;
69
70 /// The average pause duration between words, measured in seconds.
71 #[deprecated = "averagePauseDuration is moved to SFSpeechRecognitionMetadata"]
72 #[unsafe(method(averagePauseDuration))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn averagePauseDuration(&self) -> NSTimeInterval;
75 );
76}
77
78/// Methods declared on superclass `NSObject`.
79impl SFTranscription {
80 extern_methods!(
81 #[unsafe(method(init))]
82 #[unsafe(method_family = init)]
83 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
84
85 #[unsafe(method(new))]
86 #[unsafe(method_family = new)]
87 pub unsafe fn new() -> Retained<Self>;
88 );
89}