Exemple #1
0
 public TextAnalysisViewModel()
 {
     _pathInput = new PathInput {
         LicensePath = Strings.Label_LicensePath, DataPath = Strings.Label_DataPath
     };
     _input = new Input {
         InputText = Strings.Label_InputText_SampleString
     };
     _themes        = new Themes();
     _summary       = new Summary();
     _namedEntities = new NamedEntities();
     _import        = new Import();
     _textToAnalyse = InputText;
     try
     {
         Engine = new Salience(PathInput.LicensePath, PathInput.DataPath);
     }
     catch (SalienceException e)
     {
         //not sure how to handle this yet
     }
 }
        public MainViewModel()
        {
            try
            {
                //We declared Engine before initializing it so we could put this in a try/catch block, and
                //have the rest of the code outside.
                Engine = new Salience(_licensePath, _dataPath);
            }
            catch (SalienceException e)
            {
                /*If the SalienceEngine constructor throws an error, one of these is likely to be true:
                 * 1) The license file is missing/invalid/out of date
                 * 2) The data directory was missing or contained incorrect files
                 * 3) Salience6.dll could not be found. */
                System.Console.WriteLine("Error Loading SalienceEngine: " + e.Message);
                return;
            }

            PieChartItems.Add(new KeyValuePair <string, int>("Positive", 25));
            PieChartItems.Add(new KeyValuePair <string, int>("Negative", 25));
            PieChartItems.Add(new KeyValuePair <string, int>("Mixed", 25));
            PieChartItems.Add(new KeyValuePair <string, int>("Neutral", 25));
        }