SpeechPlugin.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. #import "SpeechPlugin.h"
  2. #import <iflyMSC/iflyMSC.h>
  3. #import "M4aToPcmHelper.h"
  4. #import "Mp4ToPcmHelper.h"
  5. #import "Results/ISEResult.h"
  6. #import "Results/ISEResultXmlParser.h"
  7. #import "Results/ISEResultTools.h"
  8. #import "aiengine.h"
  9. #import <TAISDK/TAISDK.h>
  10. #import <TAISDK/TAIOralEvaluation.h>
  11. @interface SpeechPlugin () <IFlySpeechEvaluatorDelegate, ISEResultXmlParserDelegate,TAIOralEvaluationDelegate>
  12. @property (nonatomic, strong) IFlySpeechEvaluator *iFlySpeechEvaluator;
  13. @property (nonatomic, strong) NSNumber *index;
  14. @property struct aiengine * engine;
  15. @property (strong, nonatomic) TAIOralEvaluation *oralEvaluation;
  16. @end
  17. @implementation SpeechPlugin
  18. + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
  19. _channel = [FlutterMethodChannel
  20. methodChannelWithName:@"speech_plugin"
  21. binaryMessenger:[registrar messenger]];
  22. SpeechPlugin* instance = [[SpeechPlugin alloc] init];
  23. [registrar addMethodCallDelegate:instance channel: _channel];
  24. }
  25. - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
  26. if ([@"getPlatformVersion" isEqualToString:call.method]) {
  27. result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
  28. } else if ([@"initSpeechSdk" isEqualToString:call.method]) {
  29. [self iflyInit];
  30. self.oralEvaluation=[[TAIOralEvaluation alloc]init];
  31. self.oralEvaluation.delegate=self;
  32. result(nil);
  33. } else if ([@"evaluatorByAudio" isEqualToString:call.method]) {
  34. NSNumber* index = call.arguments[@"index"];
  35. NSString* recordPath = call.arguments[@"recordPath"];
  36. NSString* text = call.arguments[@"en"];
  37. NSString* pathEvaluatorDecode = call.arguments[@"pathEvaluatorDecode"];
  38. NSString* videoId = call.arguments[@"videoId"];
  39. NSNumber* evaluatorType = call.arguments[@"evaluatorType"];
  40. NSNumber* sdkType = call.arguments[@"sdkType"];
  41. [self evaluateVoice:index andPath:recordPath andText:text andIsVideo:false pathEvaluatorDecode:pathEvaluatorDecode videoId:videoId evaluatorType:evaluatorType sdkType:sdkType];
  42. } else if ([@"evaluatorByMp4" isEqualToString:call.method]) {
  43. NSNumber* index = call.arguments[@"index"];
  44. NSString* recordPath = call.arguments[@"recordPath"];
  45. NSString* text = call.arguments[@"en"];
  46. NSString* pathEvaluatorDecode = call.arguments[@"pathEvaluatorDecode"];
  47. NSString* videoId = call.arguments[@"videoId"];
  48. NSNumber* evaluatorType = call.arguments[@"evaluatorType"];
  49. NSNumber* sdkType = call.arguments[@"sdkType"];
  50. [self evaluateVoice:index andPath:recordPath andText:text andIsVideo:true
  51. pathEvaluatorDecode:pathEvaluatorDecode videoId:videoId evaluatorType:evaluatorType sdkType:sdkType];
  52. } else {
  53. result(FlutterMethodNotImplemented);
  54. }
  55. }
  56. #pragma mark - Bridge Actions
  57. - (void)iflyInit {
  58. [IFlySpeechUtility createUtility:@"appid=5db7af6b"];
  59. self.iFlySpeechEvaluator = [IFlySpeechEvaluator sharedInstance];
  60. self.iFlySpeechEvaluator.delegate = self;
  61. [self configEvaluator];
  62. }
  63. - (void)chivosInit:(NSString *)en
  64. {
  65. char cfg[4096];
  66. char version[512] = {0};
  67. char record_id[64] = {0};
  68. char param[4096];
  69. NSString* user_id = @"ios_user";
  70. /*获取当前SDK版本号*/
  71. aiengine_opt(NULL, AIENGINE_OPT_GET_VERSION, version, sizeof(version));
  72. NSLog(@"version: %s\n",version);
  73. /*获取证书路径*/
  74. NSString * provision = [[NSBundle mainBundle] pathForResource:@"aiengine" ofType:@"provision"];
  75. /*引擎初始化传参设置*/
  76. NSMutableDictionary *jsonDic = [[NSMutableDictionary alloc] initWithCapacity:10];
  77. /*授权参数*/
  78. [jsonDic setValue:@"157775873600002d" forKey:@"appKey"];
  79. [jsonDic setValue:@"a6c766845f9a83974aed16f103e60621" forKey:@"secretKey"];
  80. [jsonDic setValue:provision forKey:@"provision"];
  81. /*日志传参*/
  82. NSMutableDictionary *logDic = [[NSMutableDictionary alloc] init];
  83. NSString *logFileName = @"log.txt";
  84. [logDic setValue:[NSNumber numberWithInt:0] forKey:@"enable"];
  85. [logDic setValue:logFileName forKey:@"output"];
  86. /*服务链接参数*/
  87. NSMutableDictionary *cloudDic = [[NSMutableDictionary alloc] init];
  88. NSString *serverPath = @"wss://cloud.chivox.com:443";
  89. [cloudDic setValue:[NSNumber numberWithInt:1] forKey:@"enable"];
  90. [cloudDic setValue:serverPath forKey:@"server"];
  91. [cloudDic setValue:[NSNumber numberWithInt:60] forKey:@"serverTimeout"];
  92. /*初始化传参设置*/
  93. [jsonDic setValue:logDic forKey:@"prof"];
  94. [jsonDic setValue:cloudDic forKey:@"cloud"];
  95. NSString *jsonString;
  96. jsonString = [self dicToString:jsonDic];
  97. /*cfg赋值:string转char*/
  98. strcpy(cfg, [jsonString UTF8String]);
  99. NSLog(@"cfg: %s\n",cfg);
  100. /*评分引擎初始化*/
  101. _engine = aiengine_new(cfg);
  102. NSLog(@"engine: %p\n", _engine);
  103. /*引擎启用param传参设置*/
  104. NSMutableDictionary *paramDic = [[NSMutableDictionary alloc] initWithCapacity:10];
  105. /*在线离线参数配置(cloud/native)*/
  106. [paramDic setValue:@"cloud" forKey:@"coreProvideType"];
  107. /*音量实时返回参数设置(0关/1开)*/
  108. [paramDic setValue:[NSNumber numberWithInt:0] forKey:@"soundIntensityEnable"];
  109. /*appUser传参*/
  110. NSMutableDictionary *appDic = [[NSMutableDictionary alloc] init];
  111. [appDic setValue:user_id forKey:@"userId"];
  112. /*audio音频数据传参*/
  113. NSMutableDictionary *audioDic = [[NSMutableDictionary alloc] init];
  114. [audioDic setValue:@"m4a" forKey:@"audioType"];//音频编码格式
  115. [audioDic setValue:[NSNumber numberWithInt:16000] forKey:@"sampleRate"];//音频采样率
  116. [audioDic setValue:[NSNumber numberWithInt:1] forKey:@"channel"];//单声道设置
  117. [audioDic setValue:[NSNumber numberWithInt:2] forKey:@"sampleBytes"];//采样字节数(1-单字节-8位,2-双字节-16位)
  118. /*内核request传参*/
  119. NSMutableDictionary *requestDic = [[NSMutableDictionary alloc] init];
  120. //内核类型设置cn.word.raw/cn.sent.raw/cn.pred.raw
  121. [requestDic setValue:@"en.sent.score" forKey:@"coreType"];
  122. [requestDic setValue:en forKey:@"refText"];//评测文本
  123. [requestDic setValue:[NSNumber numberWithInt:100] forKey:@"rank"];//总分分制
  124. [requestDic setValue:[NSNumber numberWithInt:1] forKey:@"attachAudioUrl"];
  125. [requestDic setValue:[NSNumber numberWithInt:1] forKey:@"precision"];//段落评分精度设置(0.5/1)
  126. [paramDic setValue:appDic forKey:@"app"];
  127. [paramDic setValue:audioDic forKey:@"audio"];
  128. [paramDic setValue:requestDic forKey:@"request"];
  129. NSString *paramString;
  130. paramString = [self dicToString:paramDic];
  131. /*cfg赋值:string转char*/
  132. strcpy(param, [paramString UTF8String]);
  133. int rv = 0;
  134. rv = aiengine_start(_engine,param,record_id,(aiengine_callback)_aiengine_callback, (__bridge const void *)(self));
  135. if (rv) {
  136. NSLog(@"aiengine_start() failed: %d\n", rv);
  137. return;
  138. }
  139. }
  140. /*字典转为String*/
  141. - (NSString *)dicToString: (NSMutableDictionary *) jsonDictionary{
  142. NSError *error;
  143. NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonDictionary options:0 error:&error];
  144. NSString *jsString;
  145. if (!jsonData) {
  146. NSLog(@"sorry you get an error:%@",error);
  147. } else {
  148. jsString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
  149. }
  150. NSLog(@"引擎初始化传参#####:%@",jsString);
  151. return jsString;
  152. }
  153. - (void) configEvaluator {
  154. [self.iFlySpeechEvaluator setParameter:@"" forKey:[IFlySpeechConstant PARAMS]];
  155. [self.iFlySpeechEvaluator setParameter:@"read_sentence" forKey:[IFlySpeechConstant ISE_CATEGORY]];
  156. [self.iFlySpeechEvaluator setParameter:@"en_us" forKey:[IFlySpeechConstant LANGUAGE]];
  157. [self.iFlySpeechEvaluator setParameter:@"5000" forKey:[IFlySpeechConstant VAD_BOS]];
  158. [self.iFlySpeechEvaluator setParameter:@"1800" forKey:[IFlySpeechConstant VAD_EOS]];
  159. [self.iFlySpeechEvaluator setParameter:@"-1" forKey:[IFlySpeechConstant SPEECH_TIMEOUT]];
  160. [self.iFlySpeechEvaluator setParameter:@"complete" forKey:[IFlySpeechConstant ISE_RESULT_LEVEL]];
  161. [self.iFlySpeechEvaluator setParameter:@"16000" forKey:[IFlySpeechConstant SAMPLE_RATE]];
  162. [self.iFlySpeechEvaluator setParameter:@"xml" forKey:[IFlySpeechConstant ISE_RESULT_TYPE]];
  163. [self.iFlySpeechEvaluator setParameter:@"0" forKey:@"plev"];
  164. [self.iFlySpeechEvaluator setParameter:@"-1" forKey:@"audio_source"];
  165. }
  166. - (void) evaluateVoice: (NSNumber*)index andPath:(NSString*)path andText:(NSString*)text andIsVideo:(BOOL) isVideo pathEvaluatorDecode:(NSString*)pathEvaluatorDecode videoId:(NSString*)videoId evaluatorType:(NSNumber*)evaluatorType sdkType:(NSNumber*)sdkType
  167. {
  168. self.index = index;
  169. if (sdkType.intValue == 0) {
  170. //调用讯飞解析
  171. [self.iFlySpeechEvaluator setParameter:evaluatorType.stringValue forKey:@"plev"];
  172. if(isVideo) {
  173. [Mp4ToPcmHelper Mp4ToPcmWithUrl:[[NSURL alloc] initFileURLWithPath:path] completion:^(NSData *data) {
  174. if(data == nil) {
  175. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  176. return;
  177. }
  178. NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
  179. NSMutableData *buffer= [NSMutableData dataWithData:[text dataUsingEncoding:encoding]];
  180. [self.iFlySpeechEvaluator startListening:buffer params:nil];
  181. [self.iFlySpeechEvaluator writeAudio:data];
  182. [self.iFlySpeechEvaluator stopListening];
  183. }];
  184. } else {
  185. NSData *voiceData = [M4aToPcmHelper M4aToPcmWithUrl:[[NSURL alloc] initFileURLWithPath:path]];
  186. if(voiceData == nil) {
  187. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  188. return;
  189. }
  190. NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
  191. NSMutableData *buffer= [NSMutableData dataWithData:[text dataUsingEncoding:encoding]];
  192. [self.iFlySpeechEvaluator startListening:buffer params:nil];
  193. [self.iFlySpeechEvaluator writeAudio:voiceData];
  194. [self.iFlySpeechEvaluator stopListening];
  195. }
  196. }else if(sdkType.intValue == 1){
  197. //调用池声解析
  198. [self chivosInit:text];
  199. int bytes = 0;
  200. char buf[1024]={0};
  201. FILE *file = NULL;
  202. const char * audiopath = [path UTF8String];
  203. file = fopen(audiopath, "rb");//待评分音频地址
  204. if(!file)
  205. {
  206. printf("read file error!\n");
  207. return;
  208. }
  209. // fseek(file, 44, SEEK_SET); //wav音频文件需要跳过头文件信息,其它音频格式不需要
  210. while ((bytes = (int)fread(buf, 1, 1024, file)))
  211. {
  212. aiengine_feed(_engine, buf, bytes);
  213. }
  214. aiengine_stop(_engine);
  215. }else {
  216. //调用腾讯解析
  217. TAIOralEvaluationParam *param =[[TAIOralEvaluationParam alloc]init];
  218. param.sessionId = [[NSUUID UUID]UUIDString];
  219. param.appId =@"1301049120";
  220. param.workMode = TAIOralEvaluationWorkMode_Once;
  221. param.evalMode = TAIOralEvaluationEvalMode_Sentence;
  222. param.storageMode = TAIOralEvaluationStorageMode_Disable;
  223. param.serverType = TAIOralEvaluationServerType_English;
  224. param.scoreCoeff = 1.0;
  225. param.fileType = TAIOralEvaluationFileType_Wav;
  226. param.refText = text;
  227. param.secretId = @"AKIDUf0EEzc8NMpPmu4Po1zhXBZicKp5G7xZ";
  228. param.secretKey = @"WnsjKaqtgDVbV9cMtABwVptarwpWyBAt";
  229. TAIOralEvaluationData *data = [[TAIOralEvaluationData alloc] init];
  230. data.seqId = 1;
  231. data.bEnd = YES;
  232. data.audio = [NSData dataWithContentsOfFile:path];
  233. [self.oralEvaluation oralEvaluation:param data:data callback:^(TAIError *error) {
  234. //接口调用结果返回
  235. if(error){
  236. NSLog(@"调用腾讯失败:code:%ld , msg:%@",(long)error.code ,error.desc);
  237. }else{
  238. NSLog(@"调用腾讯成功");
  239. }
  240. }];
  241. }
  242. }
  243. #pragma mark - iFly delegate
  244. // 评测结果回调
  245. - (void)onResults:(NSData *)results isLast:(BOOL)isLast {
  246. BOOL isSuccess = false;
  247. if (isLast) {
  248. if(results) {
  249. const char* chResult = [results bytes];
  250. NSString* strResults = nil;
  251. NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
  252. strResults = [[NSString alloc] initWithBytes:chResult length:[results length] encoding:encoding];
  253. if(strResults != nil) {
  254. ISEResultXmlParser *parser = [ISEResultXmlParser alloc];
  255. [parser setDelegate:self];
  256. [parser parserXml:strResults];
  257. isSuccess = YES;
  258. }
  259. }
  260. }
  261. if(isSuccess == NO){
  262. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  263. }
  264. }
  265. - (void)onCompleted:(IFlySpeechError *)errorCode {
  266. if (errorCode.errorCode != 0) {
  267. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  268. }
  269. }
  270. - (void)onCancel {}
  271. - (void)onBeginOfSpeech {}
  272. - (void)onEndOfSpeech {}
  273. - (void)onVolumeChanged:(int)volume buffer:(NSData *)buffer {}
  274. #pragma mark - ISEResultXmlParser delegate
  275. -(void)onISEResultXmlParser:(NSXMLParser *)parser Error:(NSError*)error {
  276. if (error.code != 0) {
  277. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  278. }
  279. }
  280. -(void)onISEResultXmlParserResult:(ISEResult*)result {
  281. if (result.is_rejected) {
  282. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  283. } else {
  284. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  285. [dic setValue:self.index forKey:@"index"];
  286. [dic setValue:@(result.total_score) forKey:@"score"];
  287. [dic setValue:@(result.accuracy_score) forKey:@"accuracy_score"];
  288. [dic setValue:@(result.fluency_score) forKey:@"fluency_score"];
  289. [dic setValue:@(result.integrity_score) forKey:@"integrity_score"];
  290. NSString* words = [ISEResultTools formatDetailsForLanguageEN: result.sentences];
  291. [dic setValue:words forKey:@"words"];
  292. [_channel invokeMethod:@"evaluatorResult" arguments: dic];
  293. }
  294. }
  295. #pragma mark - chisheng回掉
  296. /*评分引擎回调方法*/
  297. int _aiengine_callback(const void *usrdata, const char *id, int type, const void *message, int size)
  298. {
  299. if (type == AIENGINE_MESSAGE_TYPE_JSON) {
  300. [(__bridge SpeechPlugin *)usrdata performSelectorOnMainThread:@selector(onChiResult:) withObject:[[NSString alloc] initWithUTF8String:(char *)message] waitUntilDone:NO];
  301. }
  302. return 0;
  303. }
  304. //返回的内容
  305. -(void) onChiResult:(NSString *) result{
  306. if(result == nil){
  307. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  308. return;
  309. }
  310. NSLog(@"返回的结果:%@",result);
  311. NSData *jsonData = [result dataUsingEncoding:NSUTF8StringEncoding];
  312. NSError *err = nil;
  313. NSMutableDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
  314. if(err) {
  315. NSLog(@"json解析失败:%@",err);
  316. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  317. return ;
  318. }
  319. NSNumber *score = dic[@"result"][@"overall"];
  320. NSNumber *integrity = dic[@"result"][@"integrity"];
  321. NSNumber *accuracy = dic[@"result"][@"accuracy"];
  322. NSNumber *fluency = dic[@"result"][@"fluency"][@"overall"];
  323. NSArray<NSDictionary *>* worksList = dic[@"result"][@"details"];
  324. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  325. dict[@"index"] = self.index;
  326. dict[@"score"] = @(score.doubleValue/20);
  327. dict[@"accuracy_score"] = @(accuracy.doubleValue/20);
  328. dict[@"fluency_score"] = @(fluency.doubleValue/20);
  329. dict[@"integrity_score"] = @(integrity.doubleValue/20);
  330. NSMutableArray<NSDictionary *> * works =[NSMutableArray array];
  331. for (NSDictionary* work in worksList) {
  332. NSMutableDictionary *workDict = [NSMutableDictionary dictionary];
  333. workDict[@"score"] = work[@"score"];
  334. workDict[@"content"] = work[@"char"];
  335. [works addObject:workDict];
  336. }
  337. NSData *data = [NSJSONSerialization dataWithJSONObject:works options:NSJSONWritingPrettyPrinted error:nil];
  338. NSString *jsonStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
  339. [dict setValue:jsonStr forKey:@"words"];
  340. [_channel invokeMethod:@"evaluatorResult" arguments: dict];
  341. if (_engine) {
  342. aiengine_delete(_engine);
  343. _engine = NULL;
  344. }
  345. }
  346. #pragma mark - 腾讯会掉
  347. - (void)oralEvaluation:(TAIOralEvaluation *)oralEvaluation onEvaluateData:(TAIOralEvaluationData *)data result:(TAIOralEvaluationRet *)result error:(TAIError *)error {
  348. //数据和结果回调(只有data.bEnd为YES,result有效)
  349. if (data.bEnd) {
  350. float pronFluency = result.pronFluency *5;
  351. float pronAccuracy = result.pronAccuracy;
  352. if(pronAccuracy == -1){
  353. pronAccuracy = 0;
  354. }else {
  355. pronAccuracy = pronAccuracy/20;
  356. }
  357. float pronCompletion = result.pronCompletion * 5;
  358. float totalScore = (pronFluency + pronAccuracy + pronCompletion)/ 3;
  359. NSMutableArray* workList =[NSMutableArray array];
  360. for (TAIOralEvaluationWord* work in result.words) {
  361. NSMutableDictionary *dic =[NSMutableDictionary dictionary];
  362. float score = work.pronAccuracy;
  363. if(score == -1.0){
  364. score = 0;
  365. }else{
  366. score = score/20;
  367. }
  368. dic[@"score"]= [NSNumber numberWithFloat:score];
  369. dic[@"content"] = work.word;
  370. [workList addObject:dic];
  371. }
  372. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  373. [dict setValue:self.index forKey:@"index"];
  374. [dict setValue:@(totalScore) forKey:@"score"];
  375. [dict setValue:@(pronAccuracy) forKey:@"accuracy_score"];
  376. [dict setValue:@(pronFluency) forKey:@"fluency_score"];
  377. [dict setValue:@(pronCompletion) forKey:@"integrity_score"];
  378. NSData *data = [NSJSONSerialization dataWithJSONObject:workList options:NSJSONWritingPrettyPrinted error:nil];
  379. NSString *jsonStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
  380. [dict setValue:workList forKey:@"words"];
  381. [_channel invokeMethod:@"evaluatorResult" arguments: dict];
  382. }else{
  383. [_channel invokeMethod:@"evaluatorResult" arguments: [NSDictionary dictionaryWithObjectsAndKeys: self.index, @"index", [NSNull null], @"score", nil]];
  384. }
  385. }
  386. @end