Skip to content

Commit

Permalink
[Speech] Add support for Xcode 15 (#19075)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Alex Soto <alex@soto.dev>
  • Loading branch information
3 people committed Sep 21, 2023
1 parent fc54e43 commit 7321bc8
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 62 deletions.
57 changes: 57 additions & 0 deletions src/speech.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ public enum SFSpeechRecognizerAuthorizationStatus : long {
Authorized,
}

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Native]
[ErrorDomain ("SFSpeechErrorDomain")]
public enum SFSpeechErrorCode : long {
InternalServiceError = 1,
UndefinedTemplateClassName = 7,
MalformedSupplementalModel = 8,
}

[MacCatalyst (13, 1)]
[DisableDefaultCtor]
[Abstract] // no docs (yet) but it has no means (init*) to create it, unlike its subclasses
Expand Down Expand Up @@ -77,6 +86,10 @@ interface SFSpeechRecognitionRequest {
[Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)]
[Export ("addsPunctuation")]
bool AddsPunctuation { get; set; }

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[NullAllowed, Export ("customizedLanguageModel", ArgumentSemantic.Copy)]
SFSpeechLanguageModelConfiguration CustomizedLanguageModel { get; set; }
}

[MacCatalyst (13, 1)]
Expand Down Expand Up @@ -347,4 +360,48 @@ interface SFVoiceAnalytics : NSCopying, NSSecureCoding {
[Export ("voicing", ArgumentSemantic.Copy)]
SFAcousticFeature Voicing { get; }
}

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
interface SFSpeechLanguageModelConfiguration : NSCopying {
[Export ("initWithLanguageModel:")]
NativeHandle Constructor (NSUrl languageModel);

[Export ("initWithLanguageModel:vocabulary:")]
NativeHandle Constructor (NSUrl languageModel, [NullAllowed] NSUrl vocabulary);

[Export ("languageModel", ArgumentSemantic.Copy)]
NSUrl LanguageModel { get; }

[NullAllowed, Export ("vocabulary", ArgumentSemantic.Copy)]
NSUrl Vocabulary { get; }
}

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SFSpeechLanguageModel {
[Static]
[Export ("prepareCustomLanguageModelForUrl:clientIdentifier:configuration:completion:")]
[Async]
void PrepareCustomModel (NSUrl asset, string clientIdentifier, SFSpeechLanguageModelConfiguration configuration, Action<NSError> completion);

[Static]
[Export ("prepareCustomLanguageModelForUrl:clientIdentifier:configuration:ignoresCache:completion:")]
[Async]
void PrepareCustomModel (NSUrl asset, string clientIdentifier, SFSpeechLanguageModelConfiguration configuration, bool ignoresCache, Action<NSError> completion);
}

[Partial]
[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
interface SFAnalysisContextTag {
[Field ("SFAnalysisContextTagLeftContext")]
NSString LeftContext { get; }

[Field ("SFAnalysisContextTagRightContext")]
NSString RightContext { get; }

[Field ("SFAnalysisContextTagSelectedText")]
NSString SelectedText { get; }
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# xcode 15, these are all private APIs
!missing-enum! _SFCommandRecognizerArgumentPresence not bound
!missing-enum! _SFEARResultType not bound
!missing-enum! _SFTranscriptionOptions not bound
!missing-enum! _SFTranscriptionResultAttributeOptions not bound
!missing-enum! SFSpeechErrorCode not bound
!missing-field! _SFAnalysisContextTagContextualNamedEntities not bound
!missing-field! _SFAnalysisContextTagGeoLMRegionID not bound
!missing-field! _SFAnalysisContextTagLeftContext not bound
!missing-field! _SFAnalysisContextTagRightContext not bound
!missing-field! _SFAnalysisContextTagSelectedText not bound
!missing-field! SFAnalysisContextTagLeftContext not bound
!missing-field! SFAnalysisContextTagRightContext not bound
!missing-field! SFAnalysisContextTagSelectedText not bound
!missing-field! SFSpeechErrorDomain not bound
!missing-protocol! _SFSpeechAnalyzerEndpointingResultDelegate not bound
!missing-protocol! _SFSpeechAnalyzerTranscriberResultDelegate not bound
!missing-selector! _SFAnalysisContext::contextualNamedEntities not bound
Expand Down Expand Up @@ -119,14 +115,6 @@
!missing-selector! _STTranscriberMultisegmentResult::segments not bound
!missing-selector! _STTranscriberMultisegmentResult::transcriptions not bound
!missing-selector! +_SFSpeechAnalyzer::modelDownloadRequestForClientIdentifier:transcriberOptions: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:completion: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:ignoresCache:completion: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel:vocabulary: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::languageModel not bound
!missing-selector! SFSpeechLanguageModelConfiguration::vocabulary not bound
!missing-selector! SFSpeechRecognitionRequest::customizedLanguageModel not bound
!missing-selector! SFSpeechRecognitionRequest::setCustomizedLanguageModel: not bound
!missing-type! _SFAnalysisContext not bound
!missing-type! _SFAnalyzerTranscriptionSegment not bound
!missing-type! _SFCommandRecognizerArgument not bound
Expand All @@ -146,5 +134,4 @@
!missing-type! _SFTranscriberResult not bound
!missing-type! _STCommandRecognizerResult not bound
!missing-type! _STTranscriberMultisegmentResult not bound
!missing-type! SFSpeechLanguageModel not bound
!missing-type! SFSpeechLanguageModelConfiguration not bound

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# xcode 15, these are all private APIs
!missing-enum! _SFCommandRecognizerArgumentPresence not bound
!missing-enum! _SFEARResultType not bound
!missing-enum! _SFTranscriptionOptions not bound
!missing-enum! _SFTranscriptionResultAttributeOptions not bound
!missing-enum! SFSpeechErrorCode not bound
!missing-field! _SFAnalysisContextTagContextualNamedEntities not bound
!missing-field! _SFAnalysisContextTagGeoLMRegionID not bound
!missing-field! _SFAnalysisContextTagLeftContext not bound
!missing-field! _SFAnalysisContextTagRightContext not bound
!missing-field! _SFAnalysisContextTagSelectedText not bound
!missing-field! SFAnalysisContextTagLeftContext not bound
!missing-field! SFAnalysisContextTagRightContext not bound
!missing-field! SFAnalysisContextTagSelectedText not bound
!missing-field! SFSpeechErrorDomain not bound
!missing-protocol! _SFSpeechAnalyzerEndpointingResultDelegate not bound
!missing-protocol! _SFSpeechAnalyzerTranscriberResultDelegate not bound
!missing-selector! _SFAnalysisContext::contextualNamedEntities not bound
Expand Down Expand Up @@ -119,14 +115,6 @@
!missing-selector! _STTranscriberMultisegmentResult::segments not bound
!missing-selector! _STTranscriberMultisegmentResult::transcriptions not bound
!missing-selector! +_SFSpeechAnalyzer::modelDownloadRequestForClientIdentifier:transcriberOptions: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:completion: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:ignoresCache:completion: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel:vocabulary: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::languageModel not bound
!missing-selector! SFSpeechLanguageModelConfiguration::vocabulary not bound
!missing-selector! SFSpeechRecognitionRequest::customizedLanguageModel not bound
!missing-selector! SFSpeechRecognitionRequest::setCustomizedLanguageModel: not bound
!missing-type! _SFAnalysisContext not bound
!missing-type! _SFAnalyzerTranscriptionSegment not bound
!missing-type! _SFCommandRecognizerArgument not bound
Expand All @@ -146,5 +134,4 @@
!missing-type! _SFTranscriberResult not bound
!missing-type! _STCommandRecognizerResult not bound
!missing-type! _STTranscriberMultisegmentResult not bound
!missing-type! SFSpeechLanguageModel not bound
!missing-type! SFSpeechLanguageModelConfiguration not bound

Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# xcode 15, these are all private APIs
!missing-enum! _SFCommandRecognizerArgumentPresence not bound
!missing-enum! _SFEARResultType not bound
!missing-enum! _SFTranscriptionOptions not bound
!missing-enum! _SFTranscriptionResultAttributeOptions not bound
!missing-enum! SFSpeechErrorCode not bound
!missing-field! _SFAnalysisContextTagContextualNamedEntities not bound
!missing-field! _SFAnalysisContextTagGeoLMRegionID not bound
!missing-field! _SFAnalysisContextTagLeftContext not bound
!missing-field! _SFAnalysisContextTagRightContext not bound
!missing-field! _SFAnalysisContextTagSelectedText not bound
!missing-field! SFAnalysisContextTagLeftContext not bound
!missing-field! SFAnalysisContextTagRightContext not bound
!missing-field! SFAnalysisContextTagSelectedText not bound
!missing-field! SFSpeechErrorDomain not bound
!missing-protocol! _SFSpeechAnalyzerEndpointingResultDelegate not bound
!missing-protocol! _SFSpeechAnalyzerTranscriberResultDelegate not bound
!missing-selector! _SFAnalysisContext::contextualNamedEntities not bound
Expand Down Expand Up @@ -119,14 +115,6 @@
!missing-selector! _STTranscriberMultisegmentResult::segments not bound
!missing-selector! _STTranscriberMultisegmentResult::transcriptions not bound
!missing-selector! +_SFSpeechAnalyzer::modelDownloadRequestForClientIdentifier:transcriberOptions: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:completion: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:ignoresCache:completion: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel:vocabulary: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::languageModel not bound
!missing-selector! SFSpeechLanguageModelConfiguration::vocabulary not bound
!missing-selector! SFSpeechRecognitionRequest::customizedLanguageModel not bound
!missing-selector! SFSpeechRecognitionRequest::setCustomizedLanguageModel: not bound
!missing-type! _SFAnalysisContext not bound
!missing-type! _SFAnalyzerTranscriptionSegment not bound
!missing-type! _SFCommandRecognizerArgument not bound
Expand All @@ -146,5 +134,4 @@
!missing-type! _SFTranscriberResult not bound
!missing-type! _STCommandRecognizerResult not bound
!missing-type! _STTranscriberMultisegmentResult not bound
!missing-type! SFSpeechLanguageModel not bound
!missing-type! SFSpeechLanguageModelConfiguration not bound

Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# xcode 15, these are all private APIs
!missing-enum! _SFCommandRecognizerArgumentPresence not bound
!missing-enum! _SFEARResultType not bound
!missing-enum! _SFTranscriptionOptions not bound
!missing-enum! _SFTranscriptionResultAttributeOptions not bound
!missing-enum! SFSpeechErrorCode not bound
!missing-field! _SFAnalysisContextTagContextualNamedEntities not bound
!missing-field! _SFAnalysisContextTagGeoLMRegionID not bound
!missing-field! _SFAnalysisContextTagLeftContext not bound
!missing-field! _SFAnalysisContextTagRightContext not bound
!missing-field! _SFAnalysisContextTagSelectedText not bound
!missing-field! SFAnalysisContextTagLeftContext not bound
!missing-field! SFAnalysisContextTagRightContext not bound
!missing-field! SFAnalysisContextTagSelectedText not bound
!missing-field! SFSpeechErrorDomain not bound
!missing-protocol! _SFSpeechAnalyzerEndpointingResultDelegate not bound
!missing-protocol! _SFSpeechAnalyzerTranscriberResultDelegate not bound
!missing-selector! _SFAnalysisContext::contextualNamedEntities not bound
Expand Down Expand Up @@ -119,14 +115,6 @@
!missing-selector! _STTranscriberMultisegmentResult::segments not bound
!missing-selector! _STTranscriberMultisegmentResult::transcriptions not bound
!missing-selector! +_SFSpeechAnalyzer::modelDownloadRequestForClientIdentifier:transcriberOptions: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:completion: not bound
!missing-selector! +SFSpeechLanguageModel::prepareCustomLanguageModelForUrl:clientIdentifier:configuration:ignoresCache:completion: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::initWithLanguageModel:vocabulary: not bound
!missing-selector! SFSpeechLanguageModelConfiguration::languageModel not bound
!missing-selector! SFSpeechLanguageModelConfiguration::vocabulary not bound
!missing-selector! SFSpeechRecognitionRequest::customizedLanguageModel not bound
!missing-selector! SFSpeechRecognitionRequest::setCustomizedLanguageModel: not bound
!missing-type! _SFAnalysisContext not bound
!missing-type! _SFAnalyzerTranscriptionSegment not bound
!missing-type! _SFCommandRecognizerArgument not bound
Expand All @@ -146,5 +134,4 @@
!missing-type! _SFTranscriberResult not bound
!missing-type! _STCommandRecognizerResult not bound
!missing-type! _STTranscriberMultisegmentResult not bound
!missing-type! SFSpeechLanguageModel not bound
!missing-type! SFSpeechLanguageModelConfiguration not bound

Loading

6 comments on commit 7321bc8

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.