public GrpClassUtility(string connectionString, int timeoutInSecondsBD, int numberSubprocess, int numberSubprocessLanguageIdentification) { if (timeoutInSecondsBD <= 0) throw new ArgumentException(string.Format("timeoutInSecondsBD must be greather than 0 \"{0}\"", Convert.ToString(timeoutInSecondsBD))); else if (string.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullException("connectionString"); else grpClassDataAccess = new GrpClassDataAccess(connectionString, timeoutInSecondsBD); if (numberSubprocess <= 0) throw new ArgumentException(string.Format("numberSubprocess must be greather than 0 \"{0}\"", Convert.ToString(numberSubprocess))); else this.numberSubprocess = numberSubprocess; if (numberSubprocessLanguageIdentification <= 0) throw new ArgumentException(string.Format("numberSubprocessLanguageIdentification must be greather than 0 \"{0}\"", Convert.ToString(numberSubprocessLanguageIdentification))); else this.numberSubprocessLanguageIdentification = numberSubprocessLanguageIdentification; this.stopWords = new Dictionary<string, List<string>>(); vectorSpaceModelUtility = new VectorSpaceModelUtility(this.stopWords); languageIdentificationUtility = new LanguageIdentificationUtility(); groupingUtility = new GroupingUtility(); }
public GrpClassUtility(string connectionString, int timeoutInSecondsBD, int numberSubprocess, int numberSubprocessLanguageIdentification, Dictionary<string, string> stopWords) : this(connectionString, timeoutInSecondsBD, numberSubprocess, numberSubprocessLanguageIdentification) { foreach (KeyValuePair<string, string> _pair in stopWords) { string _language = _pair.Key, _stopWordsFile = _pair.Value; if (string.IsNullOrEmpty(_stopWordsFile) || string.IsNullOrWhiteSpace(_stopWordsFile)) throw new ArgumentNullException("_stopWordsFile"); else if (!File.Exists(_stopWordsFile)) throw new FileNotFoundException(string.Format("File {0} does not exist.", _stopWordsFile)); else { this.stopWords.Add(_language, File.ReadAllLines(_stopWordsFile).Select(l => l.Trim()).Where(l => !l.StartsWith("<!--") && !string.IsNullOrEmpty(l) && !string.IsNullOrWhiteSpace(l)).ToList()); } } vectorSpaceModelUtility = new VectorSpaceModelUtility(this.stopWords); }