Esempio n. 1
0
 private void tESTINSERTToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Rijec r = new Rijec();
     r.Tekst = "stolica";
     InsertNounsPronouns inp = new InsertNounsPronouns(r);
     inp.Show();
 }
Esempio n. 2
0
 private void insertVerbToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Rijec r = new Rijec();
     r.Tekst = "biti";
     InsertVerbRegularRoot inp = new InsertVerbRegularRoot(r);
     inp.Show();
 }
Esempio n. 3
0
        private void insertVerbToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Rijec r = new Rijec();

            r.Tekst = "biti";
            InsertVerbRegularRoot inp = new InsertVerbRegularRoot(r);

            inp.Show();
        }
Esempio n. 4
0
        private void tESTINSERTToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Rijec r = new Rijec();

            r.Tekst = "stolica";
            InsertNounsPronouns inp = new InsertNounsPronouns(r);

            inp.Show();
        }
Esempio n. 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (ch_root.Checked)
     {
         if (c_type.SelectedIndex == 0 || c_type.SelectedIndex == 2 || c_type.SelectedIndex == 5)
         {
             Rijec r = new Rijec();
             r.Tekst = t_word.Text;
             InsertNounsPronouns inp = new InsertNounsPronouns(r);
             inp.Show();
         }
         if (c_type.SelectedIndex == 1)
         {
             Rijec r = new Rijec();
             r.Tekst = t_word.Text;
             InsertVerbRegularRoot irr = new InsertVerbRegularRoot(r);
             irr.Show();
         }
     }
     try {
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string      q          = "INSERT INTO words(id, word, root, type, irregular) VALUES(nextval('words_id_seq'), ?, ?, ?, false); ";
         OdbcCommand insertText = new OdbcCommand(q, connection);
         Rijec       t          = (Rijec)(c_root.SelectedItem);
         insertText.Parameters.Add("@word", OdbcType.Text).Value = t_word.Text;
         if (ch_root.Checked)
         {
             insertText.Parameters.Add("@root", OdbcType.Int).Value = null;
         }
         else
         {
             insertText.Parameters.Add("@root", OdbcType.Int).Value = t.Id;
         }
         insertText.Parameters.Add("@type", OdbcType.Int).Value = c_type.SelectedIndex + 1;
         if (ch_regular.Checked)
         {
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 1;
         }
         else
         {
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
         }
         insertText.ExecuteNonQuery();
         brojUnesenihRijeci++;
         t_word.Text   = filtrirana_lista_rijeci[brojUnesenihRijeci].Tekst;
         l_InList.Text = brojUnesenihRijeci + 1 + "/" + filtrirana_lista_rijeci.Count.ToString();
         connection.Close();
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
 }
 public InsertNounsPronouns(Rijec r)
 {
     dekl_rijec = r;
     palatalni.Add("ž");
     palatalni.Add("ć");
     palatalni.Add("č");
     palatalni.Add("đ");
     palatalni.Add("dž");
     palatalni.Add("š");
     lista_deklinacija = new List <String>();
     InitializeComponent();
 }
 public InsertNounsPronouns(Rijec r)
 {
     dekl_rijec = r;
     palatalni.Add("ž");
     palatalni.Add("ć");
     palatalni.Add("č");
     palatalni.Add("đ");
     palatalni.Add("dž");
     palatalni.Add("š");
     lista_deklinacija = new List<String>();
     InitializeComponent();
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if(ch_root.Checked) {
         if (c_type.SelectedIndex == 0 || c_type.SelectedIndex == 2 || c_type.SelectedIndex == 5)
         {
             Rijec r = new Rijec();
             r.Tekst = t_word.Text;
             InsertNounsPronouns inp = new InsertNounsPronouns(r);
             inp.Show();
         }
         if (c_type.SelectedIndex == 1)
         {
             Rijec r = new Rijec();
             r.Tekst = t_word.Text;
             InsertVerbRegularRoot irr = new InsertVerbRegularRoot(r);
             irr.Show();
         }
     }
     try {
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string q = "INSERT INTO words(id, word, root, type, irregular) VALUES(nextval('words_id_seq'), ?, ?, ?, false); ";
         OdbcCommand insertText = new OdbcCommand(q, connection);
         Rijec t = (Rijec)(c_root.SelectedItem);
         insertText.Parameters.Add("@word", OdbcType.Text).Value = t_word.Text;
         if(ch_root.Checked)
             insertText.Parameters.Add("@root", OdbcType.Int).Value = null;
         else
             insertText.Parameters.Add("@root", OdbcType.Int).Value = t.Id;
         insertText.Parameters.Add("@type", OdbcType.Int).Value = c_type.SelectedIndex+1;
         if (ch_regular.Checked)
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 1;
         else
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
         insertText.ExecuteNonQuery();
         brojUnesenihRijeci++;
         t_word.Text = filtrirana_lista_rijeci[brojUnesenihRijeci].Tekst;
         l_InList.Text = brojUnesenihRijeci + 1 + "/"+filtrirana_lista_rijeci.Count.ToString();
         connection.Close();
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
 }
 public InsertVerbRegularRoot(Rijec r)
 {
     root = r;
     lista_vremena = new List<string>();
     prezent = new List<string>();
     aorist = new List<string>();
     gpr = new List<string>();
     gpt = new List<string>();
     gps = new List<string>();
     gpp = new List<string>();
     imperativ = new List<string>();
     perfekt = new List<string>();
     pluskvamperfekt = new List<string>();
     futur1 = new List<string>();
     futur2 = new List<string>();
     kondicional = new List<string>();
     samoglasnik = new List<string>();
     InitializeComponent();
 }
 public InsertVerbRegularRoot(Rijec r)
 {
     root            = r;
     lista_vremena   = new List <string>();
     prezent         = new List <string>();
     aorist          = new List <string>();
     gpr             = new List <string>();
     gpt             = new List <string>();
     gps             = new List <string>();
     gpp             = new List <string>();
     imperativ       = new List <string>();
     perfekt         = new List <string>();
     pluskvamperfekt = new List <string>();
     futur1          = new List <string>();
     futur2          = new List <string>();
     kondicional     = new List <string>();
     samoglasnik     = new List <string>();
     InitializeComponent();
 }
Esempio n. 11
0
 private void button1_Click(object sender, EventArgs e)
 {
     lista_rijeci.Clear();
     string t = richTextBox1.Text;
     t = t.Replace('.', ' ');
     t = t.Replace(',', ' ');
     t = t.Replace('!', ' ');
     t = t.Replace('?', ' ');
     t = t.Replace('"', ' ');
     t = t.Replace('-', ' ');
     t = t.Replace('\n', ' ');
     t = t.Replace('„', ' ');
     t = t.Replace('”', ' ');
     t = t.Replace('»', ' ');
     t = t.Replace('«', ' ');
     t = t.Replace('–', ' ');
     t = t.ToLower();
     t = t.Trim();
     RegexOptions options = RegexOptions.None;
     Regex regex = new Regex(@"[ ]{2,}", options);
     t = regex.Replace(t, @" ");
     richTextBox1.Text = t;
     int j = 0;
     string[] rijec = t.Split(' ');
     progressBar1.Maximum = rijec.Length;
     while (j < rijec.Length)
     {
         int duz = lista_rijeci.Count;
         int i;
         if (j == 0)
         {
             Rijec r1 = new Rijec();
             r1.Tekst = rijec[j];
             r1.Korijen = "";
             r1.Ponavljanje = 1;
             r1.Tip = 0;
             lista_rijeci.Add(r1);
             j++;
         }
         for(i=0;i<lista_rijeci.Count;i++)
         {
             duz = lista_rijeci.Count;
             if (lista_rijeci[i].Tekst.Equals(rijec[j]))
             {
                 lista_rijeci[i].Ponavljanje++;
                 break;
             }
             else if(i==duz-1)
             {
                 Rijec r1 = new Rijec();
                 r1.Tekst = rijec[j];
                 r1.Korijen = "";
                 r1.Ponavljanje = 1;
                 r1.Tip = 0;
                 lista_rijeci.Add(r1);
                 break;
             }
         }
         j++;
         progressBar1.Value = j;
         label1.Text = j+"/"+ rijec.Length;
         label1.Refresh();
     }
     MessageBox.Show("Analizirano!");
 }
Esempio n. 12
0
        private void InsertWords_Load(object sender, EventArgs e)
        {
            try
            {
                OdbcConnection connection = new OdbcConnection();
                connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
                connection.Open();
                string         q           = "SELECT id, word, root, type, irregular FROM words WHERE (root IS NULL) OR (root = 0)";
                OdbcCommand    getAllTexts = new OdbcCommand(q, connection);
                OdbcDataReader odr         = getAllTexts.ExecuteReader();
                lista_svih_rijeci_koje_su_root.Clear();
                while (odr.Read())
                {
                    Rijec t = new Rijec();
                    t.Tekst     = odr.GetString(1);
                    t.Korijen   = odr.GetString(1);
                    t.Tip       = odr.GetInt32(3);
                    t.Irregular = odr.GetBoolean(4);
                    t.Id        = odr.GetInt32(0);
                    lista_svih_rijeci_koje_su_root.Add(t);
                }

                /*  c_root.DropDownStyle = ComboBoxStyle.DropDown;
                 * c_root.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                 * c_root.AutoCompleteSource = AutoCompleteSource.ListItems;*/
                c_root.DataSource = null;
                c_root.DataSource = lista_svih_rijeci_koje_su_root;
                q = "SELECT id, type FROM word_types";
                odr.Close();
                OdbcCommand    getAllTypes = new OdbcCommand(q, connection);
                OdbcDataReader odr1        = getAllTypes.ExecuteReader();
                int            i           = 1;
                while (odr1.Read())
                {
                    TipRijeci t = new TipRijeci();
                    t.Id    = i;
                    t.Naziv = odr1.GetValue(1).ToString();
                    lista_tipova.Add(t);
                    i++;
                }
                c_type.DataSource = null;
                c_type.DataSource = lista_tipova;
                odr1.Close();
                q = "SELECT DISTINCT word, COALESCE(root,0), type, irregular,id FROM words";
                OdbcCommand    getAllWords = new OdbcCommand(q, connection);
                OdbcDataReader odr2        = getAllWords.ExecuteReader();
                lista_svih_rijeci.Clear();
                while (odr2.Read())
                {
                    Rijec t = new Rijec();
                    t.Tekst     = odr2.GetString(0);
                    t.Korijen   = odr2.GetString(1);
                    t.Tip       = odr2.GetInt32(2);
                    t.Irregular = odr2.GetBoolean(3);
                    t.Id        = odr2.GetInt32(4);
                    lista_svih_rijeci.Add(t);
                }
                odr2.Close();
                connection.Close();
                int  broj_poznatih = 0;
                bool dodaj         = true;
                foreach (Rijec r in lista_rijeci)
                {
                    foreach (Rijec r1 in lista_svih_rijeci)
                    {
                        if (r1.Tekst == r.Tekst)
                        {
                            broj_poznatih++;
                            dodaj = false;
                            break;
                        }
                    }
                    if (dodaj)
                    {
                        filtrirana_lista_rijeci.Add(r);
                    }
                    dodaj = true;
                }
                l_words.Text  = lista_svih_rijeci_koje_su_root.Count.ToString();
                t_word.Text   = filtrirana_lista_rijeci[0].Tekst;
                l_InList.Text = "1/" + filtrirana_lista_rijeci.Count.ToString();
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         lista_deklinacija.Clear();
         lista_deklinacija.Add(t_nom_jed.Text);
         lista_deklinacija.Add(t_gen_jed.Text);
         lista_deklinacija.Add(t_dat_jed.Text);
         lista_deklinacija.Add(t_akuz_jed.Text);
         lista_deklinacija.Add(t_vok_jed.Text);
         lista_deklinacija.Add(t_inst_jed.Text);
         lista_deklinacija.Add(t_lok_jed.Text);
         lista_deklinacija.Add(t_nom_mno.Text);
         lista_deklinacija.Add(t_gen_mno.Text);
         lista_deklinacija.Add(t_dat_mno.Text);
         lista_deklinacija.Add(t_aku_mno.Text);
         lista_deklinacija.Add(t_vok_mno.Text);
         lista_deklinacija.Add(t_inst_mno.Text);
         lista_deklinacija.Add(t_lok_mno.Text);
         int Id = 0;
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string q = "INSERT INTO words(id, word, root, type, irregular) VALUES(nextval('words_id_seq'), ?, ?, ?, false); ";
         OdbcCommand insertRootText = new OdbcCommand(q, connection);
         OdbcCommand insertText = new OdbcCommand(q, connection);
         Rijec root = new Rijec();
         root.Tekst = lista_deklinacija[0];
         root.Tip = 1;
         root.Korijen = "";
         root.Irregular = false;
         root.Ponavljanje = 1;
         root.Id = 2;
         insertRootText.Parameters.Add("@word", OdbcType.Text).Value = root.Tekst;
         insertRootText.Parameters.Add("@root", OdbcType.Int).Value = 0;
         insertRootText.Parameters.Add("@type", OdbcType.Int).Value = root.Tip;
         insertRootText.Parameters.Add("@irregular", OdbcType.Int).Value = false;
         insertRootText.ExecuteNonQuery();
         string q1 = "SELECT id FROM words WHERE word=?";
         OdbcCommand getRootId = new OdbcCommand(q1, connection);
         getRootId.Parameters.Add("@word", OdbcType.Text).Value = lista_deklinacija[0];
         OdbcDataReader odr = getRootId.ExecuteReader();
         while (odr.Read())
         {
             Id = odr.GetInt32(0);
         }
         lista_deklinacija.RemoveAt(0);
         foreach(String s in lista_deklinacija)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 1;
             t.Korijen = lista_deklinacija[0];
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = false;
             insertText.ExecuteNonQuery();
         }
     }
     catch (Exception es)
     {
         MessageBox.Show(es.Message);
     }
 }
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         lista_deklinacija.Clear();
         lista_deklinacija.Add(t_nom_jed.Text);
         lista_deklinacija.Add(t_gen_jed.Text);
         lista_deklinacija.Add(t_dat_jed.Text);
         lista_deklinacija.Add(t_akuz_jed.Text);
         lista_deklinacija.Add(t_vok_jed.Text);
         lista_deklinacija.Add(t_inst_jed.Text);
         lista_deklinacija.Add(t_lok_jed.Text);
         lista_deklinacija.Add(t_nom_mno.Text);
         lista_deklinacija.Add(t_gen_mno.Text);
         lista_deklinacija.Add(t_dat_mno.Text);
         lista_deklinacija.Add(t_aku_mno.Text);
         lista_deklinacija.Add(t_vok_mno.Text);
         lista_deklinacija.Add(t_inst_mno.Text);
         lista_deklinacija.Add(t_lok_mno.Text);
         int            Id         = 0;
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string      q = "INSERT INTO words(id, word, root, type, irregular) VALUES(nextval('words_id_seq'), ?, ?, ?, false); ";
         OdbcCommand insertRootText = new OdbcCommand(q, connection);
         OdbcCommand insertText     = new OdbcCommand(q, connection);
         Rijec       root           = new Rijec();
         root.Tekst       = lista_deklinacija[0];
         root.Tip         = 1;
         root.Korijen     = "";
         root.Irregular   = false;
         root.Ponavljanje = 1;
         root.Id          = 2;
         insertRootText.Parameters.Add("@word", OdbcType.Text).Value     = root.Tekst;
         insertRootText.Parameters.Add("@root", OdbcType.Int).Value      = 0;
         insertRootText.Parameters.Add("@type", OdbcType.Int).Value      = root.Tip;
         insertRootText.Parameters.Add("@irregular", OdbcType.Int).Value = false;
         insertRootText.ExecuteNonQuery();
         string      q1        = "SELECT id FROM words WHERE word=?";
         OdbcCommand getRootId = new OdbcCommand(q1, connection);
         getRootId.Parameters.Add("@word", OdbcType.Text).Value = lista_deklinacija[0];
         OdbcDataReader odr = getRootId.ExecuteReader();
         while (odr.Read())
         {
             Id = odr.GetInt32(0);
         }
         lista_deklinacija.RemoveAt(0);
         foreach (String s in lista_deklinacija)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 1;
             t.Korijen     = lista_deklinacija[0];
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = false;
             insertText.ExecuteNonQuery();
         }
     }
     catch (Exception es)
     {
         MessageBox.Show(es.Message);
     }
 }
Esempio n. 15
0
 private void button3_Click(object sender, EventArgs e)
 {
     try {
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string q = "SELECT id, word, root, type, irregular FROM words WHERE (root IS NULL) OR (root = 0)";
         OdbcCommand getAllTexts = new OdbcCommand(q, connection);
         OdbcDataReader odr = getAllTexts.ExecuteReader();
         lista_svih_rijeci_koje_su_root.Clear();
         while (odr.Read())
         {
             Rijec t = new Rijec();
             t.Tekst = odr.GetString(1);
             t.Korijen = odr.GetString(1);
             t.Tip = odr.GetInt32(3);
             t.Irregular = odr.GetBoolean(4);
             t.Id = odr.GetInt32(0);
             lista_svih_rijeci_koje_su_root.Add(t);
         }
         c_root.DataSource = null;
         c_root.DataSource = lista_svih_rijeci_koje_su_root;
         q = "SELECT id, type FROM word_types";
         odr.Close();
         OdbcCommand getAllTypes = new OdbcCommand(q, connection);
         OdbcDataReader odr1 = getAllTypes.ExecuteReader();
         lista_svih_rijeci_koje_su_root.Clear();
         int i = 1;
         while (odr1.Read())
         {
             TipRijeci t = new TipRijeci();
             t.Id = i;
             t.Naziv = odr1.GetValue(1).ToString();
             lista_tipova.Add(t);
             i++;
         }
         c_type.DataSource = null;
         c_type.DataSource = lista_tipova;
         odr1.Close();
         q = "SELECT DISTINCT word, COALESCE(root,0), type, irregular,id FROM words";
         OdbcCommand getAllWords = new OdbcCommand(q, connection);
         OdbcDataReader odr2 = getAllWords.ExecuteReader();
         lista_svih_rijeci.Clear();
         while (odr2.Read())
         {
             Rijec t = new Rijec();
             t.Tekst = odr2.GetString(0);
             t.Korijen = odr2.GetString(1);
             t.Tip = odr2.GetInt32(2);
             t.Irregular = odr2.GetBoolean(3);
             t.Id = odr2.GetInt32(4);
             lista_svih_rijeci.Add(t);
         }
         odr2.Close();
         connection.Close();
         int broj_poznatih = 0;
         bool dodaj = true;
         filtrirana_lista_rijeci.Clear();
         foreach (Rijec r in lista_rijeci)
         {
             foreach (Rijec r1 in lista_svih_rijeci)
             {
                 if (r1.Tekst == r.Tekst)
                 {
                     broj_poznatih++;
                     dodaj = false;
                     break;
                 }
             }
             if (dodaj)
                 filtrirana_lista_rijeci.Add(r);
             dodaj = true;
         }
         l_words.Text = lista_svih_rijeci_koje_su_root.Count.ToString();
         t_word.Text = filtrirana_lista_rijeci[0].Tekst;
         l_InList.Text = "1/" + filtrirana_lista_rijeci.Count.ToString();
     }
     catch(Exception e3)
     {
         MessageBox.Show(e3.Message);
     }
 }
Esempio n. 16
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         Gramatika = true;
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string         q           = "SELECT DISTINCT word, COALESCE(root,0), type, irregular,id FROM words ORDER BY word";
         OdbcCommand    getAllWords = new OdbcCommand(q, connection);
         OdbcDataReader odr2        = getAllWords.ExecuteReader();
         lista_rijeci_gramatika.Clear();
         while (odr2.Read())
         {
             Rijec t = new Rijec();
             t.Tekst     = odr2.GetString(0);
             t.Korijen   = odr2.GetString(1);
             t.Tip       = odr2.GetInt32(2);
             t.Irregular = odr2.GetBoolean(3);
             t.Id        = odr2.GetInt32(4);
             lista_rijeci_gramatika.Add(t);
         }
         odr2.Close();
         connection.Close();
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
     lista_rijeci_poslije_gramatike.Clear();
     foreach (Rijec r in lista_rijeci)
     {
         foreach (Rijec r1 in lista_rijeci_gramatika)
         {
             if (r.Tekst == r1.Tekst)
             {
                 if (!r1.Korijen.Equals("0"))
                 {
                     foreach (Rijec r3 in lista_rijeci_gramatika)
                     {
                         if (r3.Id.ToString().Equals(r1.Korijen))
                         {
                             foreach (Rijec r4 in lista_rijeci)
                             {
                                 if (r4.Tekst == r3.Tekst)
                                 {
                                     r4.Ponavljanje += r.Ponavljanje;
                                     r.Irregular     = true;
                                     break;
                                 }
                             }
                             break;
                         }
                     }
                     break;
                 }
             }
         }
     }
     foreach (Rijec r in lista_rijeci)
     {
         if (r.Irregular == false)
         {
             lista_rijeci_poslije_gramatike.Add(r);
         }
     }
     dataGridView1.DataSource = lista_rijeci_poslije_gramatike;
     chart1.Series["Rijec"].Points.Clear();
     MessageBox.Show(Convert.ToString(dataGridView1.RowCount));
     dataGridView1.Sort(dataGridView1.Columns[2], ListSortDirection.Ascending);
     for (int i = 0; i < lista_rijeci_poslije_gramatike.Count; i++)
     {
         chart1.Series["Rijec"].Points.AddXY(lista_rijeci[i].Ponavljanje, i);
     }
     label1.Text = "Ukupno riječi: " + lista_rijeci_poslije_gramatike.Count;
     chart1.Series["Rijec"].Points.Clear();
     for (int i = 0; i < lista_rijeci_poslije_gramatike.Count; i++)
     {
         chart1.Series["Rijec"].Points.AddXY(i + 1, lista_rijeci_poslije_gramatike[i].Ponavljanje);
     }
     chart1.ChartAreas[0].AxisX.Maximum = 80;
     chart1.ChartAreas[0].AxisX.Minimum = 0;
     chart1.ChartAreas[0].AxisY.Maximum = Convert.ToDouble(dataGridView1.Rows[0].Cells[2].Value);
     chart1.ChartAreas[0].AxisY.Minimum = 0;
     label1.Text = "Ukupno riječi: " + lista_rijeci_poslije_gramatike.Count;
 }
 private void GenerisiVremena(Rijec r)
 {
     //Prezent za "sti"
     if (r.Tekst.Substring(r.Tekst.Length - 3) == "sti")
     {
     }//prezent za "ći"
     else if (r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
     {
     }
     else //prezent za ti
     {
         prezent.Clear();
         string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
         prezent.Add(baza + "m");
         prezent.Add(baza + "š");
         prezent.Add(baza);
         prezent.Add(baza + "mo");
         prezent.Add(baza + "te");
         prezent.Add(baza + "ju");
     }
     //Aorist za "ti"
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
     {
         aorist.Clear();
         string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
         if (!samoglasnik.Contains(baza.Substring(baza.Length - 1).ToUpper()))
         {
             aorist.Add(baza + "oh");
             aorist.Add(baza + "e");
             aorist.Add(baza + "e");
             aorist.Add(baza + "osmo");
             aorist.Add(baza + "oste");
             aorist.Add(baza + "oše");
         }
         else
         {
             aorist.Add(baza + "h");
             aorist.Add(baza);
             aorist.Add(baza);
             aorist.Add(baza + "smo");
             aorist.Add(baza + "ste");
             aorist.Add(baza + "še");
         }
     }
     //Aorist za "ći"
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
     {
         aorist.Clear();
         string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
         baza += "k";
         aorist.Add(baza + "oh");
         aorist.Add(baza + "e");
         aorist.Add(baza + "e");
         aorist.Add(baza + "osmo");
         aorist.Add(baza + "oste");
         aorist.Add(baza + "oše");
     }
     //Glagolski pridjev radni za "ti"
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
     {
         gpr.Clear();
         string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
         gpr.Add(baza + "o");
         gpr.Add(baza + "la");
         gpr.Add(baza + "lo");
         gpr.Add(baza + "li");
         gpr.Add(baza + "le");
         gpr.Add(baza + "la");
     }
     //GPR za "ći"
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
     {
         gpr.Clear();
         string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
         baza += "k";
         gpr.Add(baza + "o");
         gpr.Add(baza + "la");
         gpr.Add(baza + "lo");
         gpr.Add(baza + "li");
         gpr.Add(baza + "le");
         gpr.Add(baza + "la");
     }
     //Glagolski pridjev trpni za "ti"
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
     {
         gpt.Clear();
         string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
         gpt.Add(baza + "n");
         gpt.Add(baza + "na");
         gpt.Add(baza + "no");
         gpt.Add(baza + "ni");
         gpt.Add(baza + "ne");
         gpt.Add(baza + "na");
     }
     //GPT za "ći"
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
     {
         gpt.Clear();
         string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
         baza += "k";
         gpt.Add(baza + "n");
         gpt.Add(baza + "na");
         gpt.Add(baza + "no");
         gpt.Add(baza + "ni");
         gpt.Add(baza + "ne");
         gpt.Add(baza + "na");
     }
     //Imperativ bez "a"
     if (!(r.Tekst.Substring(r.Tekst.Length - 3) == "ati"))
     {
         imperativ.Clear();
         string baza = prezent[5].Substring(0, prezent[5].Length - 1);
         imperativ.Add(baza);
         imperativ.Add(baza + "i");
         imperativ.Add(baza);
         imperativ.Add(baza + "imo");
         imperativ.Add(baza + "ite");
         imperativ.Add(baza);
     }
     //Imperativ sa "a"
     if ((r.Tekst.Substring(r.Tekst.Length - 3) == "ati"))
     {
         imperativ.Clear();
         string baza = prezent[5].Substring(0, prezent[5].Length - 2);
         imperativ.Add(baza);
         imperativ.Add(baza + "j");
         imperativ.Add(baza);
         imperativ.Add(baza + "jmo");
         imperativ.Add(baza + "jte");
         imperativ.Add(baza);
     }
     //Gl. prilog sadašnji
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
     {
         gps.Clear();
         string baza = prezent[5];
         gps.Add(baza + "ći");
     }
     //Gl. prilog prošli
     if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
     {
         gpp.Clear();
         string baza = prezent[5];
         gpp.Add(baza + "vši");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         int            Id         = 0;
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string      q = "INSERT INTO words(id, word, root, type, irregular) VALUES(nextval('words_id_seq'), ?, ?, ?, false); ";
         OdbcCommand insertRootText = new OdbcCommand(q, connection);
         OdbcCommand insertText     = new OdbcCommand(q, connection);
         Rijec       root           = new Rijec();
         root.Tekst       = t_infinitiv.Text;
         root.Tip         = 2;
         root.Korijen     = "";
         root.Irregular   = false;
         root.Ponavljanje = 1;
         root.Id          = 2;
         insertRootText.Parameters.Add("@word", OdbcType.Text).Value     = root.Tekst;
         insertRootText.Parameters.Add("@root", OdbcType.Int).Value      = 0;
         insertRootText.Parameters.Add("@type", OdbcType.Int).Value      = root.Tip;
         insertRootText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
         insertRootText.ExecuteNonQuery();
         string      q1        = "SELECT id FROM words WHERE word=?";
         OdbcCommand getRootId = new OdbcCommand(q1, connection);
         getRootId.Parameters.Add("@word", OdbcType.Text).Value = t_infinitiv.Text;
         OdbcDataReader odr = getRootId.ExecuteReader();
         while (odr.Read())
         {
             Id = odr.GetInt32(0);
         }
         foreach (string s in prezent)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in aorist)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gpr)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gpt)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gps)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gpp)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in imperativ)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in perfekt)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in pluskvamperfekt)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in futur1)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in futur2)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in kondicional)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst       = s;
             t.Tip         = 2;
             t.Korijen     = t_infinitiv.Text;
             t.Irregular   = false;
             t.Ponavljanje = 1;
             t.Id          = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value     = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value      = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value      = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         connection.Close();
         MessageBox.Show("Snimljeno!");
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
 }
        private void GenerisiVremena(Rijec r)
        {
            //Prezent za "sti"
            if(r.Tekst.Substring(r.Tekst.Length-3)=="sti")
            {

            }//prezent za "ći"
            else if(r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
            {

            }
            else //prezent za ti
            {
                prezent.Clear();
                string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
                prezent.Add(baza + "m");
                prezent.Add(baza + "š");
                prezent.Add(baza);
                prezent.Add(baza + "mo");
                prezent.Add(baza + "te");
                prezent.Add(baza + "ju");
            }
            //Aorist za "ti"
            if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
            {
                aorist.Clear();
                string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
                if (!samoglasnik.Contains(baza.Substring(baza.Length-1).ToUpper())) {
                    aorist.Add(baza + "oh");
                    aorist.Add(baza + "e");
                    aorist.Add(baza + "e");
                    aorist.Add(baza + "osmo");
                    aorist.Add(baza + "oste");
                    aorist.Add(baza + "oše");
                }
                else
                {
                    aorist.Add(baza + "h");
                    aorist.Add(baza);
                    aorist.Add(baza);
                    aorist.Add(baza + "smo");
                    aorist.Add(baza + "ste");
                    aorist.Add(baza + "še");
                }
            }
            //Aorist za "ći"
            if (r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
            {
                aorist.Clear();
                string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
                baza += "k";
                aorist.Add(baza + "oh");
                aorist.Add(baza + "e");
                aorist.Add(baza + "e");
                aorist.Add(baza + "osmo");
                aorist.Add(baza + "oste");
                aorist.Add(baza + "oše");
            }
            //Glagolski pridjev radni za "ti"
            if(r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
            {
                gpr.Clear();
                string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
                gpr.Add(baza + "o");
                gpr.Add(baza + "la");
                gpr.Add(baza + "lo");
                gpr.Add(baza + "li");
                gpr.Add(baza + "le");
                gpr.Add(baza + "la");
            }
            //GPR za "ći"
            if (r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
            {
                gpr.Clear();
                string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
                baza += "k";
                gpr.Add(baza + "o");
                gpr.Add(baza + "la");
                gpr.Add(baza + "lo");
                gpr.Add(baza + "li");
                gpr.Add(baza + "le");
                gpr.Add(baza + "la");
            }
            //Glagolski pridjev trpni za "ti"
            if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
            {
                gpt.Clear();
                string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
                gpt.Add(baza + "n");
                gpt.Add(baza + "na");
                gpt.Add(baza + "no");
                gpt.Add(baza + "ni");
                gpt.Add(baza + "ne");
                gpt.Add(baza + "na");
            }
            //GPT za "ći"
            if (r.Tekst.Substring(r.Tekst.Length - 2) == "ći")
            {
                gpt.Clear();
                string baza = r.Tekst.Substring(0, r.Tekst.Length - 2);
                baza += "k";
                gpt.Add(baza + "n");
                gpt.Add(baza + "na");
                gpt.Add(baza + "no");
                gpt.Add(baza + "ni");
                gpt.Add(baza + "ne");
                gpt.Add(baza + "na");
            }
            //Imperativ bez "a"
            if (!(r.Tekst.Substring(r.Tekst.Length - 3) == "ati"))
            {
                imperativ.Clear();
                string baza = prezent[5].Substring(0, prezent[5].Length - 1);
                imperativ.Add(baza);
                imperativ.Add(baza + "i");
                imperativ.Add(baza);
                imperativ.Add(baza + "imo");
                imperativ.Add(baza + "ite");
                imperativ.Add(baza);
            }
            //Imperativ sa "a"
            if ((r.Tekst.Substring(r.Tekst.Length - 3) == "ati"))
            {
                imperativ.Clear();
                string baza = prezent[5].Substring(0, prezent[5].Length - 2);
                imperativ.Add(baza);
                imperativ.Add(baza + "j");
                imperativ.Add(baza);
                imperativ.Add(baza + "jmo");
                imperativ.Add(baza + "jte");
                imperativ.Add(baza);
            }
            //Gl. prilog sadašnji
            if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
            {
                gps.Clear();
                string baza = prezent[5];
                gps.Add(baza + "ći");
            }
            //Gl. prilog prošli
            if (r.Tekst.Substring(r.Tekst.Length - 2) == "ti")
            {
                gpp.Clear();
                string baza = prezent[5];
                gpp.Add(baza + "vši");
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         int Id = 0;
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string q = "INSERT INTO words(id, word, root, type, irregular) VALUES(nextval('words_id_seq'), ?, ?, ?, false); ";
         OdbcCommand insertRootText = new OdbcCommand(q, connection);
         OdbcCommand insertText = new OdbcCommand(q, connection);
         Rijec root = new Rijec();
         root.Tekst = t_infinitiv.Text;
         root.Tip = 2;
         root.Korijen = "";
         root.Irregular = false;
         root.Ponavljanje = 1;
         root.Id = 2;
         insertRootText.Parameters.Add("@word", OdbcType.Text).Value = root.Tekst;
         insertRootText.Parameters.Add("@root", OdbcType.Int).Value = 0;
         insertRootText.Parameters.Add("@type", OdbcType.Int).Value = root.Tip;
         insertRootText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
         insertRootText.ExecuteNonQuery();
         string q1 = "SELECT id FROM words WHERE word=?";
         OdbcCommand getRootId = new OdbcCommand(q1,connection);
         getRootId.Parameters.Add("@word", OdbcType.Text).Value = t_infinitiv.Text;
         OdbcDataReader odr = getRootId.ExecuteReader();
         while(odr.Read())
         {
             Id = odr.GetInt32(0);
         }
         foreach (string s in prezent)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in aorist)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gpr)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gpt)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gps)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in gpp)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in imperativ)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in perfekt)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in pluskvamperfekt)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in futur1)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in futur2)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         foreach (string s in kondicional)
         {
             insertText.Parameters.Clear();
             Rijec t = new Rijec();
             t.Tekst = s;
             t.Tip = 2;
             t.Korijen = t_infinitiv.Text;
             t.Irregular = false;
             t.Ponavljanje = 1;
             t.Id = 2;
             insertText.Parameters.Add("@word", OdbcType.Text).Value = t.Tekst;
             insertText.Parameters.Add("@root", OdbcType.Int).Value = Id;
             insertText.Parameters.Add("@type", OdbcType.Int).Value = t.Tip;
             insertText.Parameters.Add("@irregular", OdbcType.Int).Value = 0;
             insertText.ExecuteNonQuery();
         }
         connection.Close();
         MessageBox.Show("Snimljeno!");
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
 }
Esempio n. 21
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         Gramatika = true;
         OdbcConnection connection = new OdbcConnection();
         connection.ConnectionString = "DSN=PostgreSQL35W;UID=masterwordcounter;PWD=masterwordcounter";
         connection.Open();
         string q = "SELECT DISTINCT word, COALESCE(root,0), type, irregular,id FROM words ORDER BY word";
         OdbcCommand getAllWords = new OdbcCommand(q, connection);
         OdbcDataReader odr2 = getAllWords.ExecuteReader();
         lista_rijeci_gramatika.Clear();
         while (odr2.Read())
         {
             Rijec t = new Rijec();
             t.Tekst = odr2.GetString(0);
             t.Korijen = odr2.GetString(1);
             t.Tip = odr2.GetInt32(2);
             t.Irregular = odr2.GetBoolean(3);
             t.Id = odr2.GetInt32(4);
             lista_rijeci_gramatika.Add(t);
         }
         odr2.Close();
         connection.Close();
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
     lista_rijeci_poslije_gramatike.Clear();
     foreach (Rijec r in lista_rijeci)
     {
         foreach (Rijec r1 in lista_rijeci_gramatika)
         {
             if (r.Tekst == r1.Tekst)
             {
                 if(!r1.Korijen.Equals("0"))
                 {
                     foreach(Rijec r3 in lista_rijeci_gramatika)
                     {
                         if (r3.Id.ToString().Equals(r1.Korijen))
                         {
                             foreach(Rijec r4 in lista_rijeci)
                             {
                                 if(r4.Tekst == r3.Tekst)
                                 {
                                     r4.Ponavljanje += r.Ponavljanje;
                                     r.Irregular = true;
                                     break;
                                 }
                             }
                             break;
                         }
                     }
                     break;
                 }
             }
         }
     }
     foreach(Rijec r in lista_rijeci)
     {
         if(r.Irregular == false)
         {
             lista_rijeci_poslije_gramatike.Add(r);
         }
     }
     dataGridView1.DataSource = lista_rijeci_poslije_gramatike;
     chart1.Series["Rijec"].Points.Clear();
     MessageBox.Show(Convert.ToString(dataGridView1.RowCount));
     dataGridView1.Sort(dataGridView1.Columns[2], ListSortDirection.Ascending);
     for (int i = 0; i < lista_rijeci_poslije_gramatike.Count; i++)
         chart1.Series["Rijec"].Points.AddXY(lista_rijeci[i].Ponavljanje, i);
     label1.Text = "Ukupno riječi: " + lista_rijeci_poslije_gramatike.Count;
     chart1.Series["Rijec"].Points.Clear();
     for (int i = 0; i < lista_rijeci_poslije_gramatike.Count; i++)
         chart1.Series["Rijec"].Points.AddXY(i + 1, lista_rijeci_poslije_gramatike[i].Ponavljanje);
     chart1.ChartAreas[0].AxisX.Maximum = 80;
     chart1.ChartAreas[0].AxisX.Minimum = 0;
     chart1.ChartAreas[0].AxisY.Maximum = Convert.ToDouble(dataGridView1.Rows[0].Cells[2].Value);
     chart1.ChartAreas[0].AxisY.Minimum = 0;
     label1.Text = "Ukupno riječi: " + lista_rijeci_poslije_gramatike.Count;
 }
Esempio n. 22
0
        private void button1_Click(object sender, EventArgs e)
        {
            lista_rijeci.Clear();
            string t = richTextBox1.Text;

            t = t.Replace('.', ' ');
            t = t.Replace(',', ' ');
            t = t.Replace('!', ' ');
            t = t.Replace('?', ' ');
            t = t.Replace('"', ' ');
            t = t.Replace('-', ' ');
            t = t.Replace('\n', ' ');
            t = t.Replace('„', ' ');
            t = t.Replace('”', ' ');
            t = t.Replace('»', ' ');
            t = t.Replace('«', ' ');
            t = t.Replace('–', ' ');
            t = t.ToLower();
            t = t.Trim();
            RegexOptions options = RegexOptions.None;
            Regex        regex   = new Regex(@"[ ]{2,}", options);

            t = regex.Replace(t, @" ");
            richTextBox1.Text = t;
            int j = 0;

            string[] rijec = t.Split(' ');
            progressBar1.Maximum = rijec.Length;
            while (j < rijec.Length)
            {
                int duz = lista_rijeci.Count;
                int i;
                if (j == 0)
                {
                    Rijec r1 = new Rijec();
                    r1.Tekst       = rijec[j];
                    r1.Korijen     = "";
                    r1.Ponavljanje = 1;
                    r1.Tip         = 0;
                    lista_rijeci.Add(r1);
                    j++;
                }
                for (i = 0; i < lista_rijeci.Count; i++)
                {
                    duz = lista_rijeci.Count;
                    if (lista_rijeci[i].Tekst.Equals(rijec[j]))
                    {
                        lista_rijeci[i].Ponavljanje++;
                        break;
                    }
                    else if (i == duz - 1)
                    {
                        Rijec r1 = new Rijec();
                        r1.Tekst       = rijec[j];
                        r1.Korijen     = "";
                        r1.Ponavljanje = 1;
                        r1.Tip         = 0;
                        lista_rijeci.Add(r1);
                        break;
                    }
                }
                j++;
                progressBar1.Value = j;
                label1.Text        = j + "/" + rijec.Length;
                label1.Refresh();
            }
            MessageBox.Show("Analizirano!");
        }