private List <decimal> GetSequence(string filePath, GetSequenceDelegate workerMethod) { if (workerMethod == null) { throw new ArgumentNullException("workerMethod"); } if (!File.Exists(filePath)) { throw new FileNotFoundException("filePath"); } List <decimal> results = new List <decimal>(); foreach (List <string> sentence in TrainedDataSet.TokenizeTextFile(filePath)) { string lastWord = string.Empty; foreach (string word in sentence) { if (string.IsNullOrWhiteSpace(word)) { continue; } if (!string.IsNullOrEmpty(lastWord)) { results.Add(workerMethod(lastWord, word)); } lastWord = word; } results.Add(workerMethod(lastWord, WordDictionary.EndPlaceholder)); } return(results); }
private void NewDataSet() { if (AskIfSaveFirst()) { dataSet = new TrainedDataSet(); OnDataSetLoaded(); } }
private void SaveDataSet() { string selectedFile = ShowFileDialog(saveFileDialog); if (!string.IsNullOrWhiteSpace(selectedFile)) { if (TrainedDataSet.SerializeToXml(dataSet, selectedFile)) { IsDatasetDirty = false; } } }
// text corpus // lexicon, idiom, diction, locution, vernacular, // continuity, congruity, corpus, collocation, forensic linguistics, article frequency public Stylometry(TrainedDataSet modelDatum) { if (modelDatum == null) { throw new ArgumentNullException("modelDatum"); } if (modelDatum._wordDictionary == null) { throw new ArgumentNullException("modelDatum._wordDictionary"); } _wordDictionary = modelDatum._wordDictionary; }
private void OpenDataSet() { if (AskIfSaveFirst()) { string selectedFile = ShowFileDialog(openFileDialog); if (!string.IsNullOrWhiteSpace(selectedFile) && File.Exists(selectedFile)) { dataSet = TrainedDataSet.DeserializeFromXml(selectedFile); if (dataSet != null) { OnDataSetLoaded(); } } } }
public MainForm() { InitializeComponent(); dataSet = new TrainedDataSet(); IsDatasetDirty = false; }