Git Product home page Git Product logo

Comments (7)

kurtzeborn avatar kurtzeborn commented on June 15, 2024

Thanks for opening this issue (and @amarzavery for moving it to the correct repo). It looks like this is an auth issue with the cognitive services REST endpoint for spellcheck. We apologize for not getting to this sooner while it was open in the other repo. @stephanbisser, if you're still watching this issue, can you let us know if this is still happening for you?

from azure-sdk-for-js.

stephanbisser avatar stephanbisser commented on June 15, 2024

Hi @kurtzeborn I need to check it and come back to you asap with the result! Thanks

from azure-sdk-for-js.

ChrisHMSFT avatar ChrisHMSFT commented on June 15, 2024

Hi @stephanbisser,

Can you try again with the latest version of this SDK?

https://www.npmjs.com/package/@azure/cognitiveservices-spellcheck

Thanks,
Chris

from azure-sdk-for-js.

ramya-rao-a avatar ramya-rao-a commented on June 15, 2024

@sarangan12 If this doesnt repro with the latest re-generated code, then please close this issue

from azure-sdk-for-js.

wiazur avatar wiazur commented on June 15, 2024

Hi @stephanbisser, yeah that sample you found is a year old. The snippet below is current and working. Instructions on how to run are found here: https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/javascript/BingSpellCheck/bing_spell_check_quickstart.js

"use strict";
var SpellCheck = require("@azure/cognitiveservices-spellcheck");
var msRest = require("@azure/ms-rest-js");

const key = process.env['BING_SPELL_CHECK_SUBSCRIPTION_KEY'];
if (!key) {
    throw new Error('Set/export a BING_SPELL_CHECK_SUBSCRIPTION_KEY environment variable.');
}

const endpoint = process.env['BING_SPELL_CHECK_ENDPOINT'];
if (!endpoint) {
    throw new Error('Set/export a BING_SPELL_CHECK_ENDPOINT environment variable.');
}

const creds = new msRest.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': key } });
const client = new SpellCheck.SpellCheckClient(creds, { endpoint: endpoint });

async function quickstart() {
    let query = 'bill gtaes was eher';
    let misspelledWords = [];
    let suggestedWords = [];
    await client.spellChecker(query)
        .then((response) => {
            console.log();
            for (var i = 0; i < response._response.parsedBody.flaggedTokens.length; i++) {
                var spellingFlaggedToken = response._response.parsedBody.flaggedTokens[i];
                misspelledWords.push(spellingFlaggedToken.token);
                var correction = spellingFlaggedToken.suggestions[0].suggestion; // gets each word
                suggestedWords.push(correction);
            }
            console.log('Original query: ' + query);
            console.log();
            console.log('Misspelled words: ');
            console.log(misspelledWords);
            console.log();
            console.log('Suggested correction(s): ');
            console.log(suggestedWords);
        }).catch((err) => {
            throw err;
        })
}

try {
    quickstart();
}
catch (error) {
    console.log(error);
}

from azure-sdk-for-js.

ChrisHMSFT avatar ChrisHMSFT commented on June 15, 2024

Closing the ticket given there has not been a response. Please re-open if this issue has not been resolved.

Thanks,
Chris

from azure-sdk-for-js.

 avatar commented on June 15, 2024

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

from azure-sdk-for-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.