Ejemplo n.º 1
0
        private void FrmMyClauses_Load(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();
            clauses = servRef.GetClauses(clientID, secret, Globals.sqlCon, string.Empty);
            if (clauses.Rows.Count == 0 || clauses == null)
            {
                MessageBox.Show("No Clauses Found..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ld.Close();

                this.Close();
                return;
            }
            foreach (DataRow row in clauses.Rows)
            {
                string tagOne = row["TagOne"].ToString();
                clause.Items.Add(tagOne);
            }
            threshold.Text       = "80";
            clause.SelectedIndex = 0;

            int thresholdOut = 1;

            while (thresholdOut < 101)
            {
                threshold.Items.Add(thresholdOut.ToString());
                thresholdOut++;
            }

            ld.Close();
        }
Ejemplo n.º 2
0
        private void files_SelectedIndexChanged(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();
            try
            {
                string          xmlPath = Path.Combine(savePath, files.Text + ".xml");
                XmlDataDocument xmldoc  = new XmlDataDocument();
                XmlNodeList     xmlnode;
                int             i              = 0;
                string          digitisedText  = string.Empty;
                string          translatedText = string.Empty;
                string          language       = string.Empty;
                string          nlpData        = string.Empty;
                FileStream      fs             = new FileStream(xmlPath, FileMode.Open, FileAccess.Read);
                xmldoc.Load(fs);
                xmlnode = xmldoc.GetElementsByTagName("Run");
                for (i = 0; i <= xmlnode.Count - 1; i++)
                {
                    xmlnode[i].ChildNodes.Item(0).InnerText.Trim();
                    digitisedText       = xmlnode[i].ChildNodes.Item(0).InnerText.Trim();
                    translatedText      = xmlnode[i].ChildNodes.Item(1).InnerText.Trim();
                    DigitisedText.Text  = digitisedText;
                    TranslatedText.Text = translatedText;
                    Fields.Text         = xmlnode[i].ChildNodes.Item(2).InnerText.Trim();
                    Clauses.Text        = xmlnode[i].ChildNodes.Item(3).InnerText.Trim();
                    label3.Text         = "Language: " + xmlnode[i].ChildNodes.Item(6).InnerText.Trim();
                    string type = Path.GetExtension(xmlnode[i].ChildNodes.Item(4).InnerText.Trim());
                    label8.Text = "File Extension: " + type + " Date Run: " + xmlnode[i].ChildNodes.Item(5).InnerText.Trim();

                    //NLP
                    nlpData = "ner: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(7).InnerText.Trim() + Environment.NewLine +
                              "tokenize: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(8).InnerText.Trim() + Environment.NewLine +
                              "ssplit: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(10).InnerText.Trim() + Environment.NewLine +
                              "pos: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(11).InnerText.Trim() + Environment.NewLine +
                              "lemma: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(12).InnerText.Trim() + Environment.NewLine +
                              "regexner: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(13).InnerText.Trim() + Environment.NewLine +
                              "parse: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(14).InnerText.Trim() + Environment.NewLine +
                              "natlog: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(17).InnerText.Trim() + Environment.NewLine +
                              "entitylink: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(18).InnerText.Trim() + Environment.NewLine +
                              "kbp: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(19).InnerText.Trim() + Environment.NewLine +
                              "relation: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(20).InnerText.Trim() + Environment.NewLine +
                              "quote: " + Environment.NewLine + xmlnode[i].ChildNodes.Item(21).InnerText.Trim();
                    NLPData.Text = nlpData;
                }
                fs.Close();
                ld.Close();
            }
            catch
            {
                ld.Close();
                MessageBox.Show("Unable to load report..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void FrmFieldsToExtract_Load(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();
            string fields = servRef.GetFieldNames(Globals.sqlCon, clientid, secret);

            if (fields.Length == 0)
            {
                MessageBox.Show("No Fields to show..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ld.Close();

                this.Close();
                return;
            }
            string[] fieldArr = fields.Split(',');
            if (fields.Length == 1)
            {
                if (fieldArr[0].ToString().Trim().Equals("0"))
                {
                    MessageBox.Show("No Fields to show..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ld.Close();

                    this.Close();
                    return;
                }
            }


            foreach (string field in fieldArr)
            {
                FieldsToExtract.Items.Add(field);
            }

            if (!string.IsNullOrEmpty(GetConfiguration.GetConfigurationValueFields()))
            {
                string[] split = GetConfiguration.GetConfigurationValueFields().Split(',');
                foreach (string field in split)
                {
                    for (int i = 0; i < FieldsToExtract.Items.Count; i++)
                    {
                        string strItem = FieldsToExtract.Items[i].ToString();
                        if (strItem.Equals(field))
                        {
                            FieldsToExtract.SetItemChecked(i, true);
                        }
                    }
                }
            }
            ld.Close();
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(richTextBox1.Text.Trim()))
            {
                MessageBox.Show("Please enter a clause..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(Tag1.Text.Trim()))
            {
                MessageBox.Show("Please enter at least Tag 1..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string thresholdOut = threshold.Text;

            if (string.IsNullOrEmpty(thresholdOut.Trim()))
            {
                MessageBox.Show("Please enter a threshold..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Loading ld = new Loading();

            ld.Show();
            string clauseSend = servRef.CreateClause(Globals.sqlCon, clientID, secret, richTextBox1.Text.Trim(), Tag1.Text.Trim(), Tag2.Text.Trim(), Tag3.Text.Trim(), Tag4.Text.Trim(), Tag5.Text.Trim(), thresholdOut);

            ld.Close();
            MessageBox.Show("Clasue: " + Tag1.Text + " has been added.", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Ejemplo n.º 5
0
        private void clause_SelectedIndexChanged(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();

            tagOneTemp        = string.Empty;
            Tag1.Text         = string.Empty;
            Tag2.Text         = string.Empty;
            Tag3.Text         = string.Empty;
            Tag4.Text         = string.Empty;
            Tag5.Text         = string.Empty;
            richTextBox1.Text = string.Empty;
            threshold.Text    = string.Empty;
            string tagOne = clause.Text;

            foreach (DataRow row in clauses.Rows)
            {
                if (row["TagOne"].ToString().Equals(tagOne))
                {
                    tagOneTemp        = row["TagOne"].ToString();
                    Tag1.Text         = row["TagOne"].ToString();
                    Tag2.Text         = row["TagTwo"].ToString();
                    Tag3.Text         = row["TagThree"].ToString();
                    Tag4.Text         = row["TagFour"].ToString();
                    Tag5.Text         = row["TagFive"].ToString();
                    richTextBox1.Text = row["Letter"].ToString();
                    threshold.Text    = row["P(A)"].ToString();
                }
            }
            ld.Close();
        }
Ejemplo n.º 6
0
        private void FrmHome_Load(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();
            ld.Activate();
            DataTable languageTable = null;

            try
            {
                languageTable = servRef.GetLanguages(clientID, secret);
            }
            catch (Exception exe)
            {
                if (exe.ToString().Contains("Document Limit Reached"))
                {
                    MessageBox.Show("Document Limit Reached. You must purchase a license to continue, please visit www.QuillDigital.co.uk", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                    System.Windows.Forms.Application.Exit();
                    return;
                }
            }


            languages.Items.Add("NONE");
            foreach (DataRow langRow in languageTable.Rows)
            {
                languages.Items.Add(langRow[0].ToString());
            }
            languages.Text = "NONE";

            string pages = servRef.GetPagesLeft(clientID, secret);

            label8.Text           = "Pages left: " + pages;
            extractFields.Checked = true;
            savePath.Text         = GetConfiguration.GetConfigurationValueSaveLocation();
            if (string.IsNullOrEmpty(savePath.Text.Trim()))
            {
                string runDir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
                if (!Directory.Exists(Path.Combine(runDir, "TEMPS")))
                {
                    Directory.CreateDirectory(Path.Combine(runDir, "TEMPS"));
                }
                savePath.Text = Path.Combine(runDir, "TEMPS");
                GetConfiguration.ConfigurationValueSaveLocation(Path.Combine(runDir, "TEMPS"));
            }
            else
            {
                savePath.Text = GetConfiguration.GetConfigurationValueSaveLocation();
            }

            Globals.ocrType = GetConfiguration.GetConfigurationValueOCR();
            Globals.meta    = GetConfiguration.GetConfigurationValueMeta();
            Globals.dpi     = GetConfiguration.GetConfigurationValueDPI();
            string refreshDate = servRef.GetRefreshDate(clientID, secret);

            label5.Text = refreshDate;
            ld.Close();
        }
Ejemplo n.º 7
0
        private void FrmMyFields_Load(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();

            types.Items.Add("Number");
            types.Items.Add("Currency");
            types.Items.Add("Date");
            types.Items.Add("Percentage");
            types.Items.Add("Phone Number");
            types.Items.Add("Email");
            types.Items.Add("URL");
            types.Text = "Number";
            int count = 1;

            while (count != 101)
            {
                precisionIn.Items.Add(count.ToString());
                count++;
            }
            precisionIn.Text = "80";
            count            = 1;
            while (count != 5000)
            {
                pForward.Items.Add(count.ToString());
                count++;
            }
            count = 1;
            while (count != 5000)
            {
                pBack.Items.Add(count.ToString());
                count++;
            }
            pBack.Text    = "250";
            pForward.Text = "250";
            string fields = servRef.GetFieldNames(Globals.sqlCon, clientid, secret);

            string[] fieldArr = fields.Split(',');
            foreach (string fieldIn in fieldArr)
            {
                Fields.Items.Add(fieldIn);
            }

            dtFields = servRef.GetFields(Globals.sqlCon, clientid, secret);
            if (dtFields.Rows.Count == 0 || dtFields == null)
            {
                MessageBox.Show("No Fields set up yet.", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            Fields.SelectedIndex = 0;
            ld.Close();
        }
Ejemplo n.º 8
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (TimeOut == true)
     {
         MessageBox.Show("Command Timeout.. Make sure you are connected to the internet and try again", "Command Timeout", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     if (LoggedIn == true)
     {
         label4.Text         = "";
         maskedTextBox1.Text = "";
         ld.Close();
         FrmHome home = new FrmHome(clientID, secret, servRef);
         home.Show();
         this.Hide();
     }
     else
     {
         label4.Text         = "";
         maskedTextBox1.Text = "";
         ld.Close();
         MessageBox.Show("Invalid Login. Please try again, or to update your credentials visit https://www.quilldigital.co.uk", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 9
0
        private void button4_Click(object sender, EventArgs e)
        {
            DialogResult delete = MessageBox.Show("Delete Field: " + Fields.Text.Trim() + "?", "Quill", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (delete == DialogResult.Yes)
            {
                Loading ld = new Loading();
                ld.Show();
                string deleteOUT = servRef.DeleteField(Globals.sqlCon, clientid, secret, Fields.Text.Trim());
                dgvWords.Rows.Clear();
                dgvPhrases.Rows.Clear();
                Fields.Items.Remove(Fields.Text.Trim());
                ld.Close();
            }
        }
Ejemplo n.º 10
0
        private void FrmClausesToExtract_Load(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();
            clauses = servRef.GetClauses(clientid, secret, Globals.sqlCon, string.Empty);
            if (clauses.Rows.Count <= 0 || clauses == null)
            {
                MessageBox.Show("No Clauses to show..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ld.Close();

                this.Close();
                return;
            }
            foreach (DataRow row in clauses.Rows)
            {
                ClausesToExtract.Items.Add(row["TagOne"].ToString());
            }

            if (!string.IsNullOrEmpty(GetConfiguration.GetConfigurationValueClauses()))
            {
                string[] split = GetConfiguration.GetConfigurationValueClauses().Split(',');
                foreach (string clause in split)
                {
                    for (int i = 0; i < ClausesToExtract.Items.Count; i++)
                    {
                        string strItem = ClausesToExtract.Items[i].ToString();
                        if (strItem.Equals(clause))
                        {
                            ClausesToExtract.SetItemChecked(i, true);
                        }
                    }
                }
            }
            ld.Close();
        }
Ejemplo n.º 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult updateClause = MessageBox.Show("Update Clause: " + Tag1.Text + "?", "Quill", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (updateClause == DialogResult.Yes)
            {
                string tempTagOne = clause.Text;
                if (string.IsNullOrEmpty(richTextBox1.Text.Trim()))
                {
                    MessageBox.Show("Please enter a clause..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrEmpty(Tag1.Text.Trim()))
                {
                    MessageBox.Show("Please enter at least Tag 1..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                string thresholdOut = threshold.Text;
                if (string.IsNullOrEmpty(thresholdOut.Trim()))
                {
                    MessageBox.Show("Please enter a threshold..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                Loading ld = new Loading();
                ld.Show();
                string outPut     = servRef.DeleteClause(Globals.sqlCon, clientID, secret, tagOneTemp);
                string clauseSend = servRef.CreateClause(Globals.sqlCon, clientID, secret, richTextBox1.Text.Trim(), Tag1.Text.Trim(), Tag2.Text.Trim(), Tag3.Text.Trim(), Tag4.Text.Trim(), Tag5.Text.Trim(), thresholdOut);
                int    counter    = 0;
                foreach (DataRow row in clauses.Rows)
                {
                    if (tagOneTemp.Equals(row["TagOne"].ToString()))
                    {
                        clauses.Rows[counter]["TagOne"]   = Tag1.Text.Trim();
                        clauses.Rows[counter]["TagTwo"]   = Tag2.Text.Trim();
                        clauses.Rows[counter]["TagThree"] = Tag3.Text.Trim();
                        clauses.Rows[counter]["TagFour"]  = Tag4.Text.Trim();
                        clauses.Rows[counter]["TagFive"]  = Tag5.Text.Trim();
                        clauses.Rows[counter]["Letter"]   = richTextBox1.Text.Trim();
                        clauses.Rows[counter]["P(A)"]     = thresholdOut;
                    }
                    counter++;
                }
                MessageBox.Show(tempTagOne + " Updated", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ld.Close();
            }
        }
Ejemplo n.º 12
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Fields.Text.Trim()))
            {
                MessageBox.Show("Please enter a field name..", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (regex.Checked == true)
            {
                if (!types.Text.Trim().Equals("Text (Generic)"))
                {
                    MessageBox.Show("You cannot have a Custom Regex for any other Field Type than Text (Generic)", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            DialogResult addField = MessageBox.Show("Save field: " + Fields.Text.Trim(), "Quill", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (addField == DialogResult.Yes)
            {
                string depupeIN = "TRUE";
                if (dedupe.Checked == false)
                {
                    depupeIN = "FALSE";
                }
                string currSymbolOnlyIN = "FALSE";
                if (currSymbol.Checked == true)
                {
                    currSymbolOnlyIN = "TRUE";
                }
                string fieldName = Fields.Text.Trim().Replace("'", "").ToUpper();
                string delete    = servRef.DeleteField(Globals.sqlCon, clientid, secret, fieldName);

                bool   findAllIn = findAll.Checked;
                string temp      = "FALSE";
                string fieldType = types.Text.Trim();
                if (findAllIn == true)
                {
                    temp = "TRUE";
                }
                if (findAllIn == true)
                {
                    Loading ld = new Loading();
                    ld.Show();
                    string add        = servRef.AddField(Globals.sqlCon, fieldName, fieldType, temp, clientid, secret);
                    string depDupeOut = servRef.UpdateFieldDeDupe(Globals.sqlCon, fieldName, depupeIN, clientid, secret);
                    if (currSymbolOnlyIN.Equals("TRUE"))
                    {
                        string currSymbolOnly = servRef.UpdateFieldCurrencySymbolOnly(Globals.sqlCon, fieldName, currSymbolOnlyIN, clientid, secret);
                    }
                    if (regex.Checked == true)
                    {
                        string regexIN = strRegex.Text.Trim();
                        servRef.UpdateFieldRegex(Globals.sqlCon, fieldName, regexIN, clientid, secret);
                    }
                    dtFields = servRef.GetFields(Globals.sqlCon, clientid, secret);

                    ld.Close();
                    MessageBox.Show("Field: " + fieldName + " Saved.", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    if (dgvWords.Rows.Count == 1)
                    {
                        MessageBox.Show("Unless you use Find All, you must enter at least one word.", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    if (dgvPhrases.Rows.Count == 1)
                    {
                        MessageBox.Show("Unless you use Find All, you must enter at least one phrase.", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    Loading ld = new Loading();
                    ld.Show();
                    string add = servRef.AddField(Globals.sqlCon, fieldName, fieldType, temp, clientid, secret);
                    foreach (DataGridViewRow word in dgvWords.Rows)
                    {
                        if (word != null)
                        {
                            try
                            {
                                if (!string.IsNullOrEmpty(word.Cells["Word"].Value.ToString().Trim()))
                                {
                                    string wordIN    = word.Cells["Word"].Value.ToString().Trim();
                                    string forward   = word.Cells["Forward"].Value.ToString().Trim();
                                    string backwards = word.Cells["Backward"].Value.ToString().Trim();
                                    string addWord   = servRef.UpdateFieldWords(Globals.sqlCon, fieldName, wordIN, clientid, secret, forward, backwards);
                                }
                            }
                            catch
                            {
                                //skip as cannot be added
                            }
                        }
                    }
                    foreach (DataGridViewRow phrase in dgvPhrases.Rows)
                    {
                        if (phrase != null)
                        {
                            try
                            {
                                if (!string.IsNullOrEmpty(phrase.Cells["Phrase"].Value.ToString().Trim()))
                                {
                                    string phraseIN  = phrase.Cells["Phrase"].Value.ToString().Trim();
                                    string percision = phrase.Cells["Precision"].Value.ToString().Trim();
                                    string addPhrase = servRef.UpdateFieldPhrases(Globals.sqlCon, clientid, secret, fieldName, phraseIN, percision);
                                }
                            }
                            catch
                            {
                                //skip as cannot be added
                            }
                        }
                    }
                    string depDupeOut = servRef.UpdateFieldDeDupe(Globals.sqlCon, fieldName, depupeIN, clientid, secret);
                    if (currSymbolOnlyIN.Equals("TRUE"))
                    {
                        string currSymbolOnly = servRef.UpdateFieldCurrencySymbolOnly(Globals.sqlCon, fieldName, currSymbolOnlyIN, clientid, secret);
                    }
                    if (regex.Checked == true)
                    {
                        string regexIN = strRegex.Text.Trim();
                        servRef.UpdateFieldRegex(Globals.sqlCon, fieldName, regexIN, clientid, secret);
                    }
                    dtFields = servRef.GetFields(Globals.sqlCon, clientid, secret);
                    ld.Close();
                    MessageBox.Show("Field Saved.", "Quill", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Ejemplo n.º 13
0
        private void Fields_SelectedIndexChanged(object sender, EventArgs e)
        {
            Loading ld = new Loading();

            ld.Show();

            dgvWords.Rows.Clear();
            dgvPhrases.Rows.Clear();
            string field = Fields.Text;

            regex.Checked = false;
            strRegex.Text = "";
            //get data from master table
            foreach (DataRow words in dtFields.Rows)
            {
                if (field.ToUpper().Trim().Equals(words["Field_Name"].ToString().ToUpper().Trim()))
                {
                    if (words["Field_Type"].ToString().Trim().ToUpper().Equals("CURRENCY"))
                    {
                        currSymbol.Visible = true;
                        if (words["CurrSymbol"].ToString().Trim().ToUpper().Equals("TRUE"))
                        {
                            currSymbol.Checked = true;
                        }
                    }
                    else
                    {
                        currSymbol.Visible = false;
                        currSymbol.Checked = false;
                    }
                    if (words["Check_All"].ToString().Trim().Equals("1"))
                    {
                        findAll.Checked      = true;
                        types.Text           = words["Field_Type"].ToString().Trim();
                        pForward.Enabled     = false;
                        pBack.Enabled        = false;
                        precisionIn.Enabled  = false;
                        richTextBox1.Text    = "";
                        richTextBox1.Enabled = false;
                        button1.Enabled      = false;
                        button2.Enabled      = false;

                        button3.Enabled = false;
                        if (!words["Regex"].ToString().Trim().Contains("No Regex found for"))
                        {
                            if (!string.IsNullOrEmpty(words["Regex"].ToString().Trim()))
                            {
                                regex.Checked = true;
                                strRegex.Text = words["Regex"].ToString().Trim();
                            }
                        }
                        if (words["DeDupe"].ToString().Trim().ToUpper().Equals("TRUE"))
                        {
                            dedupe.Checked = true;
                        }
                        else
                        {
                            dedupe.Checked = false;
                        }
                        ld.Close();
                        return;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(words["Regex"].ToString().Trim()))
                        {
                            regex.Checked = true;
                            strRegex.Text = words["Regex"].ToString().Trim();
                        }
                        findAll.Checked      = false;
                        types.Text           = words["Field_Type"].ToString().Trim();
                        pForward.Enabled     = true;
                        pBack.Enabled        = true;
                        precisionIn.Enabled  = true;
                        richTextBox1.Text    = "";
                        richTextBox1.Enabled = true;
                        button1.Enabled      = true;
                        button2.Enabled      = true;
                        button3.Enabled      = true;
                        try
                        {
                            string surroundingWords = words["SURROUNDING_WORDS"].ToString().Trim();
                            surroundingWords = surroundingWords.Replace("[", "").Replace("]", "");
                            string[] surroundingWordsArr = surroundingWords.Split(',');

                            foreach (string word in surroundingWordsArr)
                            {
                                dgvWords.Rows.Add(word, words["PForward"].ToString().Trim(), words["PBack"].ToString().Trim());
                            }
                        }
                        catch
                        {
                            //assume no words
                        }
                        try
                        {
                            string surroundingPhrases = words["SURROUNDING_PHRASES"].ToString().Trim();
                            surroundingPhrases = surroundingPhrases.Replace("[", "").Replace("]", "");
                            string[] surroundingPhrasesArr = surroundingPhrases.Split(',');
                            char[]   delimiterChars        = { '(', '#' };
                            foreach (string phrase in surroundingPhrasesArr)
                            {
                                string[] temp       = phrase.Split(delimiterChars);
                                string   tempPhrase = temp[0];
                                string   tempTwo    = temp[2];
                                dgvPhrases.Rows.Add(tempPhrase, tempTwo);
                            }
                        }
                        catch
                        {
                            //assume no phrases
                        }
                        if (words["DeDupe"].ToString().Trim().ToUpper().Equals("TRUE"))
                        {
                            dedupe.Checked = true;
                        }
                        else
                        {
                            dedupe.Checked = false;
                        }
                    }
                }
            }
            ld.Close();
        }