-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsForm_StopList.cs
More file actions
194 lines (145 loc) · 6.38 KB
/
Copy pathSettingsForm_StopList.cs
File metadata and controls
194 lines (145 loc) · 6.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
using System;
using System.Windows.Forms;
namespace StopList
{
internal partial class SettingsForm_StopList : Form
{
#region Get and Set Options
public string stopListString { get; set; }
public bool caseSensitive { get; set; }
public int WordWindowLeft { get; set; }
public int WordWindowRight { get; set; }
#endregion
private static string windowSizeErrorMsg = "Your word window parameters must be greater than or equal to 0.";
public SettingsForm_StopList(string SLString, bool caseSense, int WordWindowLeftInput, int WordWindowRightInput)
{
InitializeComponent();
//populate stop list language box, conversions box, and lemmatization box
StopListLanguageSelector.Items.AddRange(new string[] {
"Punctuation (Default)",
"English (Mallet Stop List)",
"English",
"Беларуская (Bulgarian)",
"中文 (Chinese; Jieba Stop List)",
"čeština (Czech)",
"français (French)",
"Deutsch (German)",
"Magyar (Hungarian)",
"italiano (Italian)",
"Македонски (Macedonian)",
"فارسی (Persian)",
"polski (Polish)",
"Pyccĸий (Russian)",
"Español (Spanish)",
"Türkçe (Turkish)"});
StopListLanguageSelector.SelectedIndex = 0;
if (caseSense)
{
caseSensitive = true;
CaseSensitiveCheckbox.Checked = true;
}
else
{
caseSensitive = false;
CaseSensitiveCheckbox.Checked = false;
}
StopListTextbox.Text = SLString;
WordWindowLeftTextbox.Text = WordWindowLeftInput.ToString();
WordWindowRightTextbox.Text = WordWindowRightInput.ToString();
}
private void OKButton_Click(object sender, System.EventArgs e)
{
bool isNumeric = int.TryParse(WordWindowLeftTextbox.Text.Trim(), out int n);
if (!isNumeric)
{
MessageBox.Show(windowSizeErrorMsg, "Parameter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
if (int.Parse(WordWindowLeftTextbox.Text.Trim()) < 0)
{
MessageBox.Show(windowSizeErrorMsg, "Parameter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
isNumeric = int.TryParse(WordWindowRightTextbox.Text.Trim(), out int o);
if (!isNumeric)
{
MessageBox.Show(windowSizeErrorMsg, "Parameter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
if (int.Parse(WordWindowRightTextbox.Text.Trim()) < 0)
{
MessageBox.Show(windowSizeErrorMsg, "Parameter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
this.WordWindowLeft = int.Parse(WordWindowLeftTextbox.Text.Trim());
this.WordWindowRight = int.Parse(WordWindowRightTextbox.Text.Trim());
this.stopListString = StopListTextbox.Text;
this.caseSensitive = (CaseSensitiveCheckbox.Checked);
this.DialogResult = DialogResult.OK;
}
private void LoadStopListButton_Click(object sender, System.EventArgs e)
{
StopListTextbox.Text = Properties.Resources.StopListCharacters + Environment.NewLine;
switch (StopListLanguageSelector.SelectedItem.ToString())
{
case "English":
StopListTextbox.Text += Properties.Resources.stoplist_english.ToLower();
break;
case "Беларуская (Bulgarian)":
StopListTextbox.Text += Properties.Resources.bulgarianST.ToLower();
break;
case "中文 (Chinese; Jieba Stop List)":
StopListTextbox.Text = Properties.Resources.ChineseJieba.ToLower();
break;
case "čeština (Czech)":
StopListTextbox.Text += Properties.Resources.czechstoplist.ToLower();
break;
case "français (French)":
StopListTextbox.Text += Properties.Resources.frenchstoplist.ToLower();
break;
case "Deutsch (German)":
StopListTextbox.Text += Properties.Resources.germanstoplist.ToLower();
break;
case "Magyar (Hungarian)":
StopListTextbox.Text += Properties.Resources.hungarianST.ToLower();
break;
case "italiano (Italian)":
StopListTextbox.Text += Properties.Resources.italianstoplist.ToLower();
break;
case "فارسی (Persian)":
StopListTextbox.Text += Properties.Resources.persianST.ToLower();
break;
case "polski (Polish)":
StopListTextbox.Text += Properties.Resources.polishST.ToLower();
break;
case "Pyccĸий (Russian)":
StopListTextbox.Text += Properties.Resources.russianstoplist.ToLower();
break;
case "Español (Spanish)":
StopListTextbox.Text += Properties.Resources.spanishstoplist.ToLower();
break;
case "Türkçe (Turkish)":
StopListTextbox.Text += Properties.Resources.turkishstoplist.ToLower();
break;
case "English (Mallet Stop List)":
StopListTextbox.Text += Properties.Resources.stoplist_mallet_en.ToLower();
break;
case "Punctuation (Default)":
break;
}
StopListTextbox.SelectionStart = StopListTextbox.Text.Length;
StopListTextbox.SelectionLength = 0;
StopListTextbox.ScrollToCaret();
}
private void ClearStopListButton_Click(object sender, EventArgs e)
{
StopListTextbox.Text = "";
}
}
}