wit-ai / wit-ios

Wit.ai iOS client
Other
222 stars 71 forks source link

Wit recognise a wrong language #82

Closed gerlandiolucena closed 7 years ago

gerlandiolucena commented 7 years ago

Hi,

We are facing a problem related to our language, some time ago we were able to speak in portuguese and receive the correct text but now we are receiving a german text that can not been understand by our specific algorithm.

Are we doing something wrong in this current version (4.2.0) ?

hactar commented 7 years ago

Well spotted. If you are building for iOS 10 and using the speech recogniser then there's a line of code which manually sets the region to german at the moment. Check out WITSFSpeechRecordingSession.m, line 41.

speechRecognizer = [[SFSpeechRecognizer alloc] initWithLocale:[NSLocale localeWithLocaleIdentifier:@"de-AT"]];

Change the de-AT to the locale you wish to use as a workaround. We'll add a locale choice to the next sdk version.

gerlandiolucena commented 7 years ago

Please release a new version with this correction, we always have to "pod install" after cloning our code and the problem it's still there.

hactar commented 7 years ago

@gerlandiolucena please give the https://github.com/wit-ai/wit-ios-sdk/tree/language-fix branch a try. Your wit instance now has a new property named speechRecognitionLocale:

/**
 On iOS 10 and above wit-ios-sdk uses Apple's speech recognition. The speech recognition
 needs to know which locale to use for recognition. A list of supported locales can be found via:
 https://developer.apple.com/documentation/speech/sfspeechrecognizer/1649889-supportedlocales
 Note that this locale must match the language of your wit model.
 The default value is @"en_US"
 */
@property (nonatomic, copy) NSString *speechRecognitionLocale;

If it works for you we'll pull it into the master branch and deploy a new version to cocoapods.

gerlandiolucena commented 7 years ago

@hactar thank you for the response, i tried:

pod 'Wit', :git => 'https://github.com/wit-ai/wit-ios-sdk/tree/language-fix' and pod 'Wit', :git => 'https://github.com/wit-ai/wit-ios-sdk/tree/language-fix', :tag => '4.2.1'

But without success. I used this:

pod 'Wit', :git => 'https://github.com/wit-ai/wit-ios-sdk.git', :branch => 'language-fix'

hactar commented 7 years ago

The files are not tagged yet, so your first two versions shouldn't work. The third one looks correct - is it working? Assuming it works for you I'll pull it into the master branch and update the official pod.