Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:XamarinCognitiveServices.ViewModels.TextApiViewModel"/> class.
 /// </summary>
 public TextApiViewModel()
 {
     _bingSpellCheckService  = new BingSpellCheckService();
     _textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));
     SpellCheckCommand       = new Command(OnSpellCheck);
     TranslateCommand        = new Command(OnTranslate);
 }
Пример #2
0
        public TodoItemPage()
        {
            InitializeComponent();

            bingSpeechService      = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.RuntimePlatform);
            bingSpellCheckService  = new BingSpellCheckService();
            textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));
        }
Пример #3
0
        public AddPage()
        {
            InitializeComponent();
            Context = this.BindingContext as AddPageViewModel;

            bingSpeechService      = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.RuntimePlatform);
            bingSpellCheckService  = new BingSpellCheckService();
            textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));

            audioRecordingService = new AudioRecorderService();
        }
Пример #4
0
        public TodoItemPage(TodoItem item)
        {
            InitializeComponent();
            this.BackgroundColor = Color.FromHex("#FFFFFF");
            this.reteived        = item;
            BindingContext       = item;

            bingSpeechService      = new BingSpeechService(new AuthenticationService(Constants.BingSpeechApiKey), Device.OS.ToString());
            bingSpellCheckService  = new BingSpellCheckService();
            textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));
        }
Пример #5
0
        async void analyticButton_Click(object sender, EventArgs e)
        {
            string translatedText = string.Empty;

            translatedText = analyticText.Text;
            try
            {
                if (!string.IsNullOrWhiteSpace(translatedText))
                {
                    //IsProcessing = true;
                    //textTranslationService = new TextTranslationService(new AuthenticationService(Constants.TextTranslatorApiKey));
                    //string t = await textTranslationService.TranslateTextAsync(translatedText);

                    //textAnalyticService = new TextAnalyticService(new AuthenticationService(Constants.TextAnalyticApiKey));
                    //string t = await textAnalyticService.AnalyticTextAsync(translatedText);

                    bingSpellCheckService = new BingSpellCheckService();
                    var spellCheckResult = await bingSpellCheckService.SpellCheckTextAsync(translatedText);

                    foreach (var flaggedToken in spellCheckResult.FlaggedTokens)
                    {
                        translatedText = translatedText.Replace(flaggedToken.Token, flaggedToken.Suggestions.FirstOrDefault().Suggestion);
                    }
                    analyticText.Text = translatedText;
                    //OnPropertyChanged("TodoItem");
                    //analyticText.Text = t;
                    //string t = "";
                    //IsProcessing = false;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                analyticText.Text += ex.Message; // " error";
            }
        }
Пример #6
0
 public SpellRecognition()
 {
     InitializeComponent();
     bingSpellCheckService = new BingSpellCheckService();
 }