dialogflow / dialogflow-apple-client

iOS SDK for Dialogflow
http://api.ai
Apache License 2.0
244 stars 65 forks source link

iOS SDK voice recognition not recognizing returning desired result #5

Closed ghost closed 8 years ago

ghost commented 9 years ago

Using iOS SDK voice recognition is not working properly. For Android it's working properly. Also whenever I speak using iOS SDK all requests are visible as Sub-Log of main Log. Is that a issue or do I need to set some parameter in the iOS sdk provided?

sstepashka commented 9 years ago

Hi, do your have some error? You use demo application or not?

ghost commented 9 years ago

Nope. There is no error. It's not recognizing properly. I am speaking same sentence simultaneous on my android and iOS app. Android app is doing very good while iOS app is not recognizing. I can share my client access token if required. I am using api.ai with email id normjr1@gmail.com. I can see in api.ai log that my recognized sentenced is totally wrong.

sstepashka commented 9 years ago

Maybe... You can show Your code? Android SDK using google speech recognizer, but in iOS using our ASR... it differed

sstepashka commented 9 years ago

Or just low quality of the recognition?

ghost commented 9 years ago

Here it goes

// Define API.AI configuration here.
-(instancetype)initWithView:(UIView*)view{
    self.apiAI = [ApiAI sharedApiAI];
    id <AIConfiguration> configuration = [[AIDefaultConfiguration alloc] init];
    configuration.baseURL = [NSURL URLWithString:@"https://api.api.ai/v1"];
    configuration.clientAccessToken = @"XXXXX"; 
    configuration.subscriptionKey = @"YYYY";
    self.apiAI.configuration = configuration;
        self.view = view;
        return self;
}
-(UIView*)getRequestButtonView:(BOOL)showButton{
    if (showButton) {
        UIView *customView = [[UIView alloc] init];
        [customView setFrame:CGRectMake(20, self.view.frame.size.height/4, self.view.frame.size.width - 40, self.view.frame.size.height/3 + 50)];
        customView.layer.cornerRadius = 10;
        UILabel *speakLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 15, customView.frame.size.width, 30)];
        [speakLabel setTextAlignment:NSTextAlignmentCenter];
        speakLabel.text = @"Speak";
        [speakLabel setTextColor:[UIColor darkGrayColor]];
        [customView addSubview:speakLabel];
        [customView setBackgroundColor:[UIColor colorWithWhite:200.0/255 alpha:1.0]];
        AIVoiceRequestButton *button = [[AIVoiceRequestButton alloc] init];
        [button setSuccessCallback:^(id response) {
            NSLog(@"Response: %@",[response description]);
        }];

        [button setFailureCallback:^(NSError *error) {
            NSLog(@"Error: %@",[error description]);
        }];

        [customView addSubview:button];
        [self alignToCenter:button toView:customView];

        self.requestButton = button;
        return customView;
    }
    return nil;
}
sstepashka commented 9 years ago

You skip step "Init audio session.". If does not do it, then audio cannot be recorded.

see https://github.com/api-ai/api-ai-ios-sdk#integratingintoyourapp

That's right?

ghost commented 9 years ago

It has been done in AppDelegate.m

-(void)initAudioService{
   [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
   [[AVAudioSession sharedInstance] setActive:YES error:nil];
}
ghost commented 9 years ago

True, it is a low quality of recognition. Some simple text it's able to recognize.

sstepashka commented 9 years ago

Okey. I Cannot fix this problem now. We always working with quality of out ASR.