예제 #1
0
        /// <summary>
        /// 4.	The system must demonstrate the use of the Brill Tagger (Tutorial 3).
        /// 5.	The system must demonstrate the use of POS tags for information extraction as follows (Tutorial 3):
        ///a.	From the Wikipedia page on Fish (http://en.wikipedia.org/wiki/Fish) extract
        ///all types of fish that are mentioned (eg. freshwater, typical, shell, star, big) using a regular expression and provided POS tags.
        ///b.	Try your expression on the page for Tree (http://en.wikipedia.org/wiki/Tree). What do you need to change to make it work for tree?
        /// </summary>
        private void btnQuestion45_Click(object sender, EventArgs e)
        {
            //Open the program that processes the POS tagged text with regular expressions and shows outputs
            TaggingForm form = new TaggingForm();

            form.Show();
        }
예제 #2
0
        public static List <Persistence.VO.Transaction> GetTransactions(string[] files, bool allowTagging)
        {
            List <Persistence.VO.Transaction> transactions = new List <Persistence.VO.Transaction>();

            if (files != null && files.Length > 0)
            {
                foreach (string file in files)
                {
                    OFXParser.Parser.OfxEncoding = Encoding.Default;
                    Extract extract = OFXParser.Parser.GenerateExtract(file);

                    if (extract != null)
                    {
                        foreach (var trans in extract.Transactions)
                        {
                            Persistence.VO.Transaction transaction = new Persistence.VO.Transaction();
                            transaction.Id              = trans.Id;
                            transaction.Bank            = extract.BankAccount.Bank.Code.ToString();
                            transaction.Agency          = extract.BankAccount.AgencyCode;
                            transaction.Account         = extract.BankAccount.AccountCode;
                            transaction.TransactionType = trans.Type;
                            transaction.Date            = trans.Date;
                            transaction.Description     = trans.Description.ToUpper();
                            transaction.Value           = trans.TransactionValue;
                            transaction.ValueAbs        = Math.Abs(trans.TransactionValue);
                            transaction.Category        = RecommendationSystem.GetRecommendedCategory(transaction);

                            if (allowTagging)
                            {
                                if (transaction.Category == null)
                                {
                                    TaggingForm form = new TaggingForm();
                                    form.ShowDialog(ref transaction);
                                }
                            }

                            transaction.SubCategory = RecommendationSystem.GetRecommendedSubCategory(transaction);

                            System.Diagnostics.Debug.WriteLine(trans.Description + " > " + trans.Description);

                            // Fix Banco do Brasil transaction type
                            if (transaction.Bank.Equals("1") && transaction.TransactionType.Equals("OTHER"))
                            {
                                if (transaction.Value > 0)
                                {
                                    transaction.TransactionType = "CREDIT";
                                }
                                else
                                {
                                    transaction.TransactionType = "DEBIT";
                                }
                            }

                            // Fix Banco do Brasil account because of Power BI
                            if (transaction.Bank.Equals("1"))
                            {
                                transaction.Account = transaction.Account.Replace("-", "");
                            }

                            transactions.Add(transaction);
                        }
                    }
                }
            }

            return(transactions);
        }