From 1c6414eb0284a8e1c7bb10cdbbfbc1b4a2a0c2e3 Mon Sep 17 00:00:00 2001 From: garenwang Date: Tue, 26 Jul 2022 18:30:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=B8=80=E4=BA=9B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CI/model/QCloudAudioAsrqueueResult.h | 12 ++++ .../CI/model/QCloudAudioAsrqueueResult.m | 6 +- .../model/QCloudGetAudioDiscernTaskResult.h | 14 +--- .../model/QCloudGetAudioDiscernTaskResult.m | 9 +-- .../CI/model/QCloudPostAudioDiscernTaskInfo.h | 64 +++++++++++++++++++ .../CI/model/QCloudPostAudioDiscernTaskInfo.m | 49 +++++++++++++- 6 files changed, 131 insertions(+), 23 deletions(-) diff --git a/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.h b/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.h index d57374e..f6a6bc8 100644 --- a/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.h +++ b/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.h @@ -9,6 +9,7 @@ @class QCloudAudioAsrqueueQueueListItem; @class QCloudAudioAsrqueueNotifyConfig; +@class QCloudAudioAsrqueueResultNonExistPIDs; NS_ASSUME_NONNULL_BEGIN @interface QCloudAudioAsrqueueResult : NSObject @@ -28,8 +29,19 @@ NS_ASSUME_NONNULL_BEGIN /// 队列数组 @property (nonatomic,strong)NSArray *QueueList; +/// 队列 ID +@property (nonatomic,strong)QCloudAudioAsrqueueResultNonExistPIDs * NonExistPIDs; + @end + +/// 不存在的队列 ID 列表 +@interface QCloudAudioAsrqueueResultNonExistPIDs : NSObject + +@property (nonatomic,strong)NSString *QueueID; +@end + + @interface QCloudAudioAsrqueueQueueListItem : NSObject /// 队列 ID diff --git a/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.m b/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.m index b0ed692..a0dfc42 100644 --- a/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.m +++ b/QCloudCOSXML/Classes/CI/model/QCloudAudioAsrqueueResult.m @@ -10,7 +10,8 @@ @implementation QCloudAudioAsrqueueResult + (NSDictionary *)modelContainerPropertyGenericClass { return @{ - @"QueueList": [QCloudAudioAsrqueueQueueListItem class] + @"QueueList": [QCloudAudioAsrqueueQueueListItem class], + @"NonExistPIDs": [QCloudAudioAsrqueueResultNonExistPIDs class] }; } @@ -28,6 +29,9 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic { @end +@implementation QCloudAudioAsrqueueResultNonExistPIDs +@end + @implementation QCloudAudioAsrqueueQueueListItem + (NSDictionary *)modelContainerPropertyGenericClass { return @{ diff --git a/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.h b/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.h index 113f8d1..7b50bb7 100644 --- a/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.h +++ b/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.h @@ -7,7 +7,6 @@ #import #import "QCloudPostAudioDiscernTaskInfo.h" -@class QCloudGetAudioDiscernTaskSpeechRecognitionResult; NS_ASSUME_NONNULL_BEGIN @interface QCloudGetAudioDiscernTaskResult : NSObject @@ -19,18 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *NonExistJobIds; /// 在 job 的类型为 SpeechRecognition 且 job 状态为 success 时,返回语音识别的识别结果详情。 -@property (nonatomic,strong)QCloudGetAudioDiscernTaskSpeechRecognitionResult *SpeechRecognitionResult; -@end - - -@interface QCloudGetAudioDiscernTaskSpeechRecognitionResult : NSObject -/// 识别结果 -@property (nonatomic,strong)NSString *Result; -/// Response.SpeechRecognition.ResultDetail 识别结果详情,包含每个句子中的词时间偏移,一般用于生成字幕的场景。(识别请求中ResTextFormat=1时该字段不为空) -/// 注意:此字段可能返回 null,表示取不到有效值。 -@property (nonatomic,strong)NSString *ResultDetail; -/// 语音时长 -@property (nonatomic,assign)CGFloat AudioTime; +@property (nonatomic,strong)QCloudPostAudioDiscernTaskInfoSpeechRecognitionResult *SpeechRecognitionResult; @end diff --git a/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.m b/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.m index bd04370..ef39484 100644 --- a/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.m +++ b/QCloudCOSXML/Classes/CI/model/QCloudGetAudioDiscernTaskResult.m @@ -12,16 +12,9 @@ @implementation QCloudGetAudioDiscernTaskResult + (NSDictionary *)modelContainerPropertyGenericClass { return @{ @"JobsDetail": [QCloudPostAudioDiscernTaskJobsDetail class], - @"SpeechRecognitionResult": [QCloudGetAudioDiscernTaskSpeechRecognitionResult class], + @"SpeechRecognitionResult": [QCloudPostAudioDiscernTaskInfoSpeechRecognitionResult class], }; } -@end - - -@implementation QCloudGetAudioDiscernTaskSpeechRecognitionResult - - - @end @implementation QCloudBatchGetAudioDiscernTaskResult diff --git a/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.h b/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.h index 5e2d374..709fa49 100644 --- a/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.h +++ b/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.h @@ -17,6 +17,10 @@ @class QCloudPostAudioDiscernTaskJobsOperation; @class QCloudPostAudioDiscernTaskResultInput; +@class QCloudPostAudioDiscernTaskInfoSpeechRecognitionResult; + +@class QCloudPostAudioDiscernTaskInfoSpeechWords; +@class QCloudPostAudioDiscernTaskInfoSpeechResultDetail; NS_ASSUME_NONNULL_BEGIN @interface QCloudPostAudioDiscernTaskInfo : NSObject @@ -124,6 +128,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *EndTime; + +@property (nonatomic,strong)NSString *StartTime; + /// 任务所属的队列 ID @property (nonatomic,strong)NSString *QueueId; @@ -156,6 +163,63 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QCloudPostAudioDiscernTaskInfoOutput *Output; @property (nonatomic,strong)QCloudPostAudioDiscernTaskInfoSpeechRecognition *SpeechRecognition; + +@property (nonatomic,strong)QCloudPostAudioDiscernTaskInfoSpeechRecognitionResult *SpeechRecognitionResult; +@end + +@interface QCloudPostAudioDiscernTaskInfoSpeechRecognitionResult : NSObject + +/// 语音时长 +@property (nonatomic,strong)NSString *AudioTime; + +/// 识别结果 +@property (nonatomic,strong)NSString *Result; + +/// 结果详情 +@property (nonatomic,strong)NSArray *ResultDetail; @end +@interface QCloudPostAudioDiscernTaskInfoSpeechResultDetail : NSObject + +/// 单句结束时间(毫秒) +@property (nonatomic,strong)NSString * EndMs; + +/// 单句最终识别结果 +@property (nonatomic,strong)NSString * FinalSentence; + +/// 单句中间识别结果,使用空格拆分为多个词 +@property (nonatomic,strong)NSString * SliceSentence; + +/// 声道或说话人 Id(请求中如果设置了 speaker_diarization或者ChannelNum为双声道,可区分说话人或声道) +@property (nonatomic,strong)NSString * SpeakerId; + +/// 单句语速,单位:字数/秒 +@property (nonatomic,strong)NSString * SpeechSpeed; + +/// 单句开始时间(毫秒) +@property (nonatomic,strong)NSString * StartMs; + +/// 单句中词详情 +@property (nonatomic,strong)NSArray * Words; + +/// 单句中词个数 +@property (nonatomic,strong)NSString * WordsNum; +@end + +@interface QCloudPostAudioDiscernTaskInfoSpeechWords : NSObject + + +/// 在句子中的结束时间偏移量 +@property (nonatomic,strong)NSString * OffsetEndMs; + +/// 在句子中的开始时间偏移量 +@property (nonatomic,strong)NSString * OffsetStartMs; +@property (nonatomic,strong)NSString * VoiceType; + +/// 词文本 +@property (nonatomic,strong)NSString * Word; + +@end + + NS_ASSUME_NONNULL_END diff --git a/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.m b/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.m index d5bff9f..0afea24 100644 --- a/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.m +++ b/QCloudCOSXML/Classes/CI/model/QCloudPostAudioDiscernTaskInfo.m @@ -75,7 +75,8 @@ @implementation QCloudPostAudioDiscernTaskJobsOperation + (NSDictionary *)modelContainerPropertyGenericClass { return @{ @"Output": [QCloudPostAudioDiscernTaskInfoOutput class], - @"SpeechRecognition":[QCloudPostAudioDiscernTaskInfoSpeechRecognition class] + @"SpeechRecognition":[QCloudPostAudioDiscernTaskInfoSpeechRecognition class], + @"SpeechRecognitionResult":[QCloudPostAudioDiscernTaskInfoSpeechRecognitionResult class] }; } @@ -84,3 +85,49 @@ + (NSDictionary *)modelContainerPropertyGenericClass { @implementation QCloudPostAudioDiscernTaskResultInput @end + +@implementation QCloudPostAudioDiscernTaskInfoSpeechRecognitionResult ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{ + @"ResultDetail": [QCloudPostAudioDiscernTaskInfoSpeechResultDetail class] + }; +} + +- (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic { + if (!dic) { + return dic; + } + + NSMutableDictionary * mdic = [NSMutableDictionary dictionaryWithDictionary:dic]; + if ([mdic[@"ResultDetail"] isKindOfClass:[NSDictionary class]]) { + [mdic setValue:@[mdic[@"ResultDetail"]] forKey:@"ResultDetail"]; + } + return mdic.mutableCopy; +} +@end + + +@implementation QCloudPostAudioDiscernTaskInfoSpeechResultDetail ++ (NSDictionary *)modelContainerPropertyGenericClass { + return @{ + @"Words": [QCloudPostAudioDiscernTaskInfoSpeechWords class] + }; +} + +- (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic { + if (!dic) { + return dic; + } + + NSMutableDictionary * mdic = [NSMutableDictionary dictionaryWithDictionary:dic]; + if ([mdic[@"Words"] isKindOfClass:[NSDictionary class]]) { + [mdic setValue:@[mdic[@"Words"]] forKey:@"Words"]; + } + return mdic.mutableCopy; +} +@end + +@implementation QCloudPostAudioDiscernTaskInfoSpeechWords + +@end +