//this is what runs at initialization public Form1() { InitializeComponent(); foreach (var encoding in Encoding.GetEncodings()) { EncodingDropdown.Items.Add(encoding.Name); } try { EncodingDropdown.SelectedIndex = EncodingDropdown.FindStringExact("utf-8"); } catch { EncodingDropdown.SelectedIndex = EncodingDropdown.FindStringExact(Encoding.Default.BodyName); } //automatically read in all of the models DirectoryInfo d = new DirectoryInfo(modelsDirectory); foreach (var file in d.GetFiles("*.*")) { if (file.Name.EndsWith(".tagger") || file.Name.EndsWith(".model")) { ModelSelectionBox.Items.Add(file.Name); } } if (ModelSelectionBox.Items.Count == 0) { MessageBox.Show("You do not appear to have any model files with the software. Please ensure that you have the full StanfordNLP package and its associated models included with this software.", "No models found!", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } else { try { ModelSelectionBox.SelectedIndex = ModelSelectionBox.FindStringExact("english-bidirectional-distsim.tagger"); } catch { ModelSelectionBox.SelectedIndex = 0; } } }
public SettingsForm_CoreNLPNET(string SelectedModel, string ModelsDirectory) { InitializeComponent(); DirectoryInfo d = new DirectoryInfo(ModelsDirectory); foreach (var file in d.GetFiles("*.*")) { if (file.Name.EndsWith(".tagger") || file.Name.EndsWith(".model")) { ModelSelectionBox.Items.Add(file.Name); } } try { ModelSelectionBox.SelectedIndex = ModelSelectionBox.FindStringExact(SelectedModel); } catch { ModelSelectionBox.SelectedIndex = 0; } }