public MainPage() { InitializeComponent(); try { _speechRecongnitionService = DependencyService.Get <ISpeechToTextService>(); MyButton.ImageSource = ImageSource.FromResource("TestApp.Images.mic.png"); CheckPermissionStatus(); } catch (Exception ex) { recon.Text = ex.Message; } MessagingCenter.Subscribe <ISpeechToTextService, string>(this, "STT", (sender, args) => { SpeechToTextFinalResultRecieved(args); }); MessagingCenter.Subscribe <ISpeechToTextService>(this, "Final", (sender) => { //used for iOS specific code. Enabling button is done here }); }
public MainViewModel(IMscsService mscsService, ISerializationService serializationService, IPhotoService photoService, IMessageBoxService messageBoxService, ITextToSpeechService textToSpeechService, ILocationService locationService, IGeocodingService geocodingService, ISpeechToTextService speechToTextService, IPublicTransportServices publicTransportServices, ITranslationService translationService, IMvxAndroidCurrentTopActivity activity) { this._mscsService = mscsService; this._photoService = photoService; this._messageBoxService = messageBoxService; this._textToSpeechService = textToSpeechService; this._locationService = locationService; this._geocodingService = geocodingService; this._speechToTextService = speechToTextService; this._publicTransportServices = publicTransportServices; this._translationService = translationService; this._checkNetwork = new CheckInternetConnection(); this._checkLocation = new CheckLocationAvailability(); this._speechToTextService.MessageChanged += HandleMessageChanged; this._photoService.PhotoChanged += HandlePhotoChanged; _textToSpeechService.Speak( "Witaj w aplikacji blind. Tapnij na ekran i powiedz komende dla danej funkcji. Aby uzyskaæ informacjê o dostêpnych funkcjach tapnij w ekran i powiedz menu"); CheckSettingsAfterStart(); }
/// <summary> /// Initializes a new instance of the <see cref="SpeechToTextController"/> class. /// API Controller for Grocery service. /// </summary> /// <param name="logger">The logger to use.</param> /// <param name="localizer">The localized ressources to use.</param> /// <param name="speechToTextService">The SpeechToTextService to use.</param> public SpeechToTextController( ILogger <SpeechToTextController> logger, IStringLocalizer <SpeechToTextController> localizer, ISpeechToTextService speechToTextService) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } else { this.logger = logger; } if (localizer == null) { throw new ArgumentNullException(nameof(localizer)); } else { this.localizer = localizer; } if (speechToTextService == null) { throw new ArgumentNullException(nameof(speechToTextService)); } else { this.speechToTextService = speechToTextService; } }
public MainPageViewModel(Func <Task> scrollDown) { _scrollDown = scrollDown; _speechToTextService = DependencyService.Get <ISpeechToTextService>(); _speechRecognitionService = DependencyService.Get <ISpeechRecognitionService>(); var directLineClient = new DirectLineRestApiClientService(new HttpClient(), "YOUR_DIRECT_LINE_KEY"); _fieldBotCommunicationService = new FieldBotCommunicationService(directLineClient, "YOUR_USER_NAME"); }
void GetSttService() { if (_SttService == null) { Console.WriteLine(" GetSttService() ------------1- CurrentLanguage : " + CurrentLanguage); _SttService = DependencyService.Get <ISpeechToTextService>(DependencyFetchTarget.GlobalInstance); Languages = new ObservableCollection <SttLanguage>(); // TODO: how to check if the current language is supported by STT engine. //CultureInfo _cultureInfo = new CultureInfo(CurrentLanguage); //RegionInfo _regionInfo = new RegionInfo(CurrentLanguage.Replace("_", "-")); //Languages.Add(new SttLanguage(CurrentLanguage, "Automatic", Regex.Replace(_cultureInfo.DisplayName, @"\t|\n|\r", ""))); _AppDataService = DependencyService.Get <IAppDataService>(); var dafaultLang = "en_US"; // Restore the selected language for STT or use the STT service's current language if (_AppDataService.Contain(LANGUAGE_FOR_STT)) { dafaultLang = _AppDataService.GetValue(LANGUAGE_FOR_STT); Console.WriteLine(" IAppDataService.GetValue => language for stt : " + dafaultLang); } else { dafaultLang = _SttService.CurrentSttLanguage; Console.WriteLine(" IAppDataService no value => CurrentSttLanguage : " + dafaultLang); } // For updating STT service's CurrentSttLanguage CurrentLanguage = dafaultLang; foreach (var lang in _SttService.GetInstalledLanguages()) { CultureInfo cultureInfo = new CultureInfo(lang); RegionInfo regionInfo = new RegionInfo(lang.Replace("_", "-")); //Console.WriteLine(" [GetSttService] lang : " + lang + ", " + cultureInfo.DisplayName + ", " + regionInfo.EnglishName); var stt = new SttLanguage(lang, cultureInfo.DisplayName, regionInfo.EnglishName); Languages.Add(stt); //Languages.Add(new SttLanguage(lang, cultureInfo.DisplayName, regionInfo.EnglishName)); if (lang == dafaultLang) { stt.IsOn = true; SelectedItemIndex = stt; } } #if ENABLE_DEBUG_PRINT foreach (var lang in Languages) { Console.WriteLine(" Languages -- " + lang.Country + ", " + lang.Name + ", " + lang.IsOn); /*+ " vs. " + lang.isNotOn*/ } #endif Console.WriteLine(" GetSttService() ------------2- " + _SttService.GetHashCode()); } }
private void ReadPartialResponse(ISpeechToTextService service, string response) { if (isRecordingCancelled) { return; } Device.BeginInvokeOnMainThread(() => { AddMessageAndSendResponse(response, false, !isNewQueryStarted); isNewQueryStarted = true; }); }
/// <summary> /// Initializes a new instance of the <see cref="GroceryController"/> class. /// </summary> /// <param name="appSettings">The application configuration.</param> /// <param name="logger">The logger to use.</param> /// <param name="localizer">The localized ressources to use.</param> /// <param name="speechToTextService">The <see cref="ISpeechToTextService"/> to use.</param> public GroceryController( IOptions <AppSettings> appSettings, ILogger <GroceryController> logger, IStringLocalizer <GroceryController> localizer, ISpeechToTextService speechToTextService, IGroceryActionService groceryActionService, IGroceryItemService groceryItemService) { if (appSettings == null) { throw new ArgumentNullException(nameof(appSettings)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (localizer == null) { throw new ArgumentNullException(nameof(localizer)); } if (speechToTextService == null) { throw new ArgumentNullException(nameof(speechToTextService)); } if (groceryActionService == null) { throw new ArgumentNullException(nameof(groceryActionService)); } if (groceryItemService == null) { throw new ArgumentNullException(nameof(groceryItemService)); } this.appSettings = appSettings.Value; this.logger = logger; this.localizer = localizer; this.speechToTextService = speechToTextService; this.groceryActionService = groceryActionService; this.groceryItemService = groceryItemService; }
private void ReadFinalResponse(ISpeechToTextService service, string response) { if (isRecordingCancelled) { return; } Device.BeginInvokeOnMainThread(() => { //response = LanguageUtility.GetProperLanguageContent(response); AddMessageAndSendResponse(response, true, !isNewQueryStarted); isNewQueryStarted = false; PlaceHolderText = string.Empty; IsRecording = false; CanSend = false; }); }
private const int DelayTime = 100; // milisaniye cinsinden /// <summary> /// Resolver Servisi /// </summary> /// <param name="webDriver">WebDriver</param> /// <param name="apiKey">IBM Speech to Text Api Key</param> /// <param name="serviceUrl">IBM Speech to Text Service Url</param> public ResolverService(string apiKey, string serviceUrl) { _speechToTextService = new SpeechToTextManager(apiKey, serviceUrl); }