Esempio n. 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // Read the Code Project article linked in README.md to figure out how to get the URL and API Key for this application
            if (!File.Exists("api.url") || string.IsNullOrEmpty(endpoint = File.ReadAllText("api.url")))
            {
                endpoint = ShowDialog("Please enter the endpoint of your Azure Web Service. ", "Language Detector");
                File.WriteAllText("api.url", endpoint);
            }
            if (!File.Exists("api.key") || string.IsNullOrEmpty(apikey = File.ReadAllText("api.key")))
            {
                apikey = ShowDialog("Please enter the API Key for your Azure Web Service. ", "Language Detector");
                File.WriteAllText("api.key", apikey);
            }

            // Initialize our chosen feature extractor and classifier
            fe = new LetterGroupFeatureExtractor(ngram);
            cs = new AzureClassifier(fe, endpoint, apikey);
            sp = new CodeSnippetParser();

            // Create a training set off of a lot of code samples
            // ExtractTrainingSetFromFolder();
        }
 public SnippetProvider(ISnippetParser snippetParser)
 {
     _snippetParser = snippetParser;
 }