コード例 #1
0
        //Private Methods
        //Removing of unwanthed characters

        //Calculating final probability document belonging to category

        private double CalculatePCatDoc(CategoryTable tableConservative, double totalUniqueWords, double PCatParty, List <double> PCatPartyDoc)

        {
            double CatLogTotal = 0;

            for (int i = 0; i < fileContents.Count; i++)
            {
                PCatPartyDoc.Add(tableConservative.GetPWordCat(fileContents[i], totalUniqueWords));
            }
            if (PCatPartyDoc.Any())
            {
                PCatPartyDoc.Add(PCatParty);
            }
            else
            {
                PCatPartyDoc.Add(0);
                PCatPartyDoc.Add(PCatParty);
            }

            for (int i = 0; i < PCatPartyDoc.Count() - 1; i++)
            {
                CatLogTotal += PCatPartyDoc[i];
            }
            return(CatLogTotal);
        }