예제 #1
0
        private static void AsrSentence(String token, String endpoint)
        {
            String encode_type = "wav";     // sentence flie type
            String sample_rate = "16k";     // sampling rate of speech,just adapt to the file suffix is ".wav"
            String dataUrl     = "";        // the obs url

            // post data by native file
            String data   = utils.ConvertFileToBase64("../../data/asr-sentence.wav");
            String reslut = Asr.AsrSentenceToken(token, data, dataUrl, encode_type, sample_rate, endpoint);

            Console.WriteLine(reslut);

            dataUrl = "https://ais-sample-data.obs.myhwclouds.com/asr-sentence.wav";

            // post data by obs url
            reslut = Asr.AsrSentenceToken(token, "", dataUrl, encode_type, sample_rate, endpoint);
            Console.WriteLine(reslut);
            Console.ReadKey();
        }
예제 #2
0
        private static void AsrSentence(String token, String endpoint)
        {
            // sentence flie type
            String encode_type = "wav";
            // sampling rate of speech,just adapt to the file suffix is ".wav"
            String sample_rate = "16k";
            // the obs url
            String dataUrl = "";

            // post data by native file
            String data   = utils.ConvertFileToBase64("../../data/asr-sentence.wav");
            String reslut = Asr.AsrSentenceToken(token, data, dataUrl, encode_type, sample_rate, endpoint);

            Console.WriteLine(reslut);

            // The OBS link must match the region, and the OBS resources of different regions are not shared
            dataUrl = "https://obs-ch-sdk-sample.obs.cn-north-1.myhwclouds.com/asr-sentence.wav";

            // post data by obs url
            reslut = Asr.AsrSentenceToken(token, "", dataUrl, encode_type, sample_rate, endpoint);
            Console.WriteLine(reslut);
            Console.ReadKey();
        }