private void trainingFileToolStripMenuItem_Click(object sender, EventArgs e) { List <TrainWord> word = new List <TrainWord>(); foreach (var item in translators.getTTranslator().GetLocalWords()) { if (item.PerCent < 50) { word.Add(item); } } for (int i = 0; i < word.Count; i++) { for (int j = i; j < word.Count; j++) { if (word[i].PerCent > word[j].PerCent) { TrainWord temp = word[i]; word[i] = word[j]; word[j] = temp; } } } if (word.Count > 0) { WordsWriteCoach WWC = new WordsWriteCoach(word); WWC.Show(); } }
public void replaceWord(TrainWord word) { string wor = ""; foreach (ListViewItem item in listView1.Items) { if (item.SubItems[0].Text == word.Index.ToString()) { wor = item.SubItems[1].Text; item.SubItems[1].Text = word.Word; item.SubItems[2].Text = word.Transcription; item.SubItems[3].Text = word.Translete; item.SubItems[4].Text = word.PerCent.ToString(); item.SubItems[5].Text = word.Url; ErrorWord er = new ErrorWord(); er.id = word.Index; er.path = word.path; er.word = word.Word; if (item.BackColor == Color.Red) { ErrorWord.remove(er); item.BackColor = Color.LightSteelBlue; return; } } } }
private void playsound() { TrainWord w = Transletors.getTrainerWord(); try { if (File.Exists(w.Url)) { Player.URL = w.Url; Player.controls.play(); } else { ErrorWord.add(new ErrorWord() { id = w.Index, path = w.path, word = w.Word }); } } catch { if (!File.Exists(w.Url)) { ErrorWord.add(new ErrorWord() { id = w.Index, path = w.path, word = w.Word }); } } }
public void AddWord(TrainWord word, bool newfile = false) { if (Path != String.Empty) { if (containWord(word.Word) == false) { word.path = Path; word.PerCent = 50; word.Audio(); if (BufferWords.Count + 1 <= 100 || newfile == false) { word.Index = BufferWords.Count + 1; File.AppendAllText(Path, word.ToString()); BufferWords.Add(word); CountLocalWords++; } else { BufferWords.Clear(); CountLocalWords = 0; this.Path = GetFileName(); word.Index = 1; File.AppendAllText(Path, word.ToString()); BufferWords.Add(word); throw new Exception(this.Path); } } } else { throw new Exception("Selected File"); } }
public void Next() { int n = rand.Next(0, Iterator); if (WorkWords.Count == 0) { if (NewWords.Count == 0) { throw new Exception(String.Format("Result All={0},F1={1},Correct={2}", AmountWord, AmountF1, AmountCorrectAnswer)); } else { //StartTraires(); throw new Exception(String.Format("Result All={0},F1={1},Correct={2}", AmountWord, AmountF1, AmountCorrectAnswer)); } } else { CurrentWordF1 = false; CurrentWord = WorkWords[n]; WorkWords.RemoveAt(n); if (Iterator - 1 != -1) { Iterator--; } } }
private void button1_Click(object sender, EventArgs e) { ListViewItem item = listView1.SelectedItems[0]; TrainWord word = new TrainWord(""); word.Index = Convert.ToInt32(item.Tag); word.PerCent = Convert.ToInt32(textBoxColumn.Text); word.Transcription = textBoxTranscription.Text; word.Translete = textBoxTranslate.Text; word.Word = textBoxWord.Text; word.Url = textBox3.Text; RemoveEvent(word); removeFromList(word); if (word.Index - 1 >= 0) { listView1.Items[word.Index - 1].Selected = true; } else { if (listView1.Items.Count >= 1) { listView1.Items[0].Selected = true; } } for (int i = 0; i < words.Count; i++) { words[i].Index = i + 1; } }
public void NextWord() { if (count < 8) { count++; richTextBox1.Text += curentWord.Word + ", "; } else { if (words.Count > 0) { curentWord = words[0]; words.RemoveAt(0); richTextBox1.Text += Environment.NewLine; richTextBox1.Text += curentWord.Translete + " "; label2.Text = curentWord.Word; count = 0; } else { this.Close(); } } }
private void textBox1_TextChanged(object sender, EventArgs e) { string textsearch = textBox1.Text; for (int i = 0; i < words.Count() - 1; i++) { if (words[i].Word.Contains(textsearch)) { addtolist(words[i]); } else { removeFromList(words[i]); } } if (textsearch == string.Empty) { TrainWord temp = new TrainWord(""); for (int i = 0; i < words.Count() - 1; i++) { for (int j = i + 1; j < words.Count(); j++) { if (words[i].Index > words[j].Index) { temp = words[i]; words[i] = words[j]; words[j] = temp; } } } } }
public void addtolist(TrainWord t, bool check = false) { ListViewItem item = new ListViewItem(t.Index.ToString()); item.SubItems.Add(t.Word); item.SubItems.Add(t.Transcription); item.SubItems.Add(t.Translete); item.SubItems.Add(t.PerCent.ToString()); item.SubItems.Add(t.Url); item.Tag = t.Index; if (contain(t.Index.ToString()) == false) { if (check == false) { try { listView1.Invoke(new Action(() => listView1.Items.Add(item))); } catch { listView1.Items.Add(item); } } else { listView1.Invoke(new Action(() => listView1.Items.Insert(t.Index - 1, item))); } } }
private void button2_Click(object sender, EventArgs e) { TrainWord word = new TrainWord(); word.Word = textBox1.Text; word.Translete = textBox2.Text; CreateW(word); newWord(); }
public WordsWriteCoach(List <TrainWord> words) { InitializeComponent(); this.words = words; curentWord = words[0]; words.RemoveAt(0); richTextBox1.Text += curentWord.Translete; label2.Text = curentWord.Word; }
public TrainWord(TrainWord word) { this.Word = word.Word; this.Translete = word.Translete; this.Transcription = word.Transcription; this.PerCent = word.PerCent; this.Url = word.Url; this.BadTries = word.BadTries; this.GoodTries = 0; }
public void removeFromList(TrainWord t) { for (int i = 0; i < listView1.Items.Count - 1; i++) { if ((int)listView1.Items[i].Tag == t.Index) { listView1.Invoke(new Action(() => listView1.Items.RemoveAt(i))); break; } } }
public void addtolist(string s) { TrainWord t = new TrainWord(s, ""); ListViewItem item = new ListViewItem(t.Index.ToString()); item.SubItems.Add(t.Word); item.SubItems.Add(t.Transcription); item.SubItems.Add(t.Translete); item.Tag = t.Index; listView1.Items.Add(item); }
public static void RemoveBadKnowWord(TrainWord word) { for (int i = 0; i < BadKnow.Count; i++) { if (BadKnow[i].Word == word.Word) { BadKnow.RemoveAt(i); Log.Add(word.path, "Word -" + word.Word + "; remove From BadKnowList"); return; } } }
public static void AddBadKnowWord(TrainWord word) { foreach (var item in BadKnow) { if (item.Word == word.Word) { return; } } Log.Add(word.path, "Word -" + word.Word + "; added To BadKnowList"); BadKnow.Add(word); }
private FindNewWords.FindWord FindNewWords_FindWORD(string text) { TrainWord word = translators.IsExistense(text); if (word != null) { return(new FindNewWords.FindWord(word.Word, word.path)); } else { return(null); } }
public void ReplaceWord(TrainWord word) { int index = word.Index - 1; BufferWords[index].Word = word.Word; BufferWords[index].Translete = word.Translete; BufferWords[index].Transcription = word.Transcription; BufferWords[index].PerCent = word.PerCent; if (BufferWords[index].Url != word.Url) { BufferWords[index].Audio(word.Url); } ChangedWord(BufferWords[index], this.Path); }
private void textBox3_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (textBox1.Text != string.Empty && textBox3.Text != string.Empty) { TrainWord word = new TrainWord("") { Word = textBox1.Text, Transcription = textBox2.Text, Translete = textBox3.Text, PerCent = 50 }; Add(word); Reload(); textBox1.Text = textBox2.Text = textBox3.Text = String.Empty; } } }
public void ContWord(String text) { TrainWord word = translators.IsExistense(text); if (word != null) { toolStripTextBox2.Text = word.Translete; toolStripTextBox1.BackColor = Color.Green; } else { toolStripTextBox2.Text = ""; toolStripTextBox1.BackColor = Color.Red; } }
private void textBoxWord_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TrainWord word = new TrainWord(""); word.Index = SelectedItemIndex; word.PerCent = Convert.ToInt32(textBoxColumn.Text); word.Transcription = textBoxTranscription.Text; word.Translete = textBoxTranslate.Text; word.Word = textBoxWord.Text; word.Url = textBox3.Text; replaceWord(word); AddEvent(word); textBoxTranscription.Text = textBoxTranslate.Text = textBoxWord.Text = textBox3.Text = string.Empty; } }
public void sortItem() { TrainWord temp = new TrainWord(""); for (int i = 0; i < words.Count() - 1; i++) { for (int j = i + 1; j < words.Count(); j++) { if (words[i].Index > words[j].Index) { temp = words[i]; words[i] = words[j]; words[j] = temp; } } } }
private void button2_Click(object sender, EventArgs e) { if (toolStripComboBox1.SelectedIndex != -1) { if (textBox4.Text != "" && textBox2.Text != "") { if (!textBox3.Text.Contains("[]")) { textBox3.Text = String.Format("[ {0} ]", textBox3.Text); } string word = String.Format("{0}%{1}%{2}%{3}%50{4}", 0, textBox4.Text, textBox3.Text, textBox2.Text, Environment.NewLine); TrainWord wordss = new TrainWord(new TrainWord(word, Transletors.Path)); if (Transletors.CountLocalWords > 99) { DialogResult res = MessageBox.Show("create newfiel", "d", MessageBoxButtons.YesNo); if (res == DialogResult.No) { Transletors.AddWord(wordss); } else { try { Transletors.AddWord(wordss, true); } catch (Exception ex) { toolStripComboBox1.Items.Add(ex.Message); toolStripComboBox1.SelectedItem = ex.Message; } } } else { Transletors.AddWord(wordss); } textBox4.Text = textBox3.Text = textBox2.Text = ""; } } else { MessageBox.Show("Select file"); } }
public void NextWord(TrainWord word) { textBoxAnswer.Text = textBoxQvestion.Text = ""; currentword = word; textBoxQvestion.Text = word.Translete; Index = 0; Weight = 12; Height = 96; List <char> hh = new List <char>(); hh.AddRange(currentword.Word); while (hh.Count > 0) { int n = rand.Next(0, hh.Count); char r = hh[n]; hh.RemoveAt(n); gg(r); } }
public void RemoveWord(TrainWord word) { for (int j = 0; j < BufferWords.Count; j++) { if (BufferWords[j].Word == word.Word) { BufferWords.RemoveAt(j); break; } } Log.Add(this.Path, "Remove - " + word.Word); CountLocalWords--; int i = 1; foreach (var item in BufferWords) { item.Index = i; i++; } }
private void ChangedWord(TrainWord word, String path) { try { if (path == translators.getTTranslator().Path) { Invoke((MethodInvoker) delegate { foreach (ListViewItem item in WordslistView.Items) { if (item.SubItems[1].Text == word.Word) { item.BackColor = word.GetColor(); return; } } }); } } catch { } }
public void SafeToFile(TrainWord word) { tr.AddWord(word); }
private void setAnsver(int id, bool correct = true) { TrainWord word = BufferWords[id]; if (correct == true && CurrentWordF1 == false) { if (word.PerCent <= 50) { BufferWords[id].PerCent += PercentPlus / 2; } else if (word.PerCent + PercentPlus <= 160) { BufferWords[id].PerCent += PercentPlus; } else { BufferWords[id].PerCent = 160; } AmountCorrectAnswer++; if (word.GoodTries >= 2) { BufferWords[id].GoodTries = 0; if (word.BadTries - 2 >= 0) { BufferWords[id].BadTries -= 2; if (BufferWords[id].BadTries == 0) { TrainingWords.RemoveBadKnowWord(BufferWords[id]); } } } else { BufferWords[id].GoodTries++; } Log.Add(this.Path, "word -" + word.Word + " corect Ansver Percent-" + word.PerCent); } else if (correct == false) { if (word.PerCent - PercentMinus >= 0) { BufferWords[id].PerCent -= PercentMinus; } else { BufferWords[id].PerCent = 0; } CurrentWordF1 = true; AmountF1++; if (BufferWords[id].BadTries < Convert.ToInt32(ConfigurationManager.AppSettings["BadTries"])) { BufferWords[id].BadTries++; if (BufferWords[id].GoodTries > 0) { BufferWords[id].GoodTries = 0; } } else { TrainingWords.AddBadKnowWord(BufferWords[id]); } Log.Add(this.Path, "word -" + word.Word + " bad Ansver Percent-" + word.PerCent); } ChangedWord(BufferWords[id], this.Path); }
public void AddWord(TrainWord word) { AddWord(word, false); }
private void CreateWords_CreateW(TrainWord trainWord) { trainingWords.AddWord(trainWord); }