예제 #1
0
        private void analyzeWordEvolution(string word)
        {
            //string rootFolder = Application.ExecutablePath.ToString().Replace(@"\LACE\LACE\bin\Debug\LACE.EXE", @"\LACE\LACE\bin\Debug\Input\" + cbxSystems.SelectedItem.ToString());
            string[] filePaths = Directory.GetFiles(rootFolder, "*.txt", SearchOption.AllDirectories);

            //Hold release vs frequency
            double[] x = new double[filePaths.Length];
            double[] y = new double[filePaths.Length];

            int i = 0;

            foreach (string fileName in filePaths)
            {
                List <word> words = Utili.loadFrequencyData(fileName);
                x[i] = i;
                y[i] = 0;



                for (int j = 0; j < words.Count; j++)
                {
                    if (words[j].text == word)
                    {
                        y[i] = words[j].frequency / Utili.getFrequencySum(words);
                    }
                }

                i++;
            }

            generateFrequency(word, x, y);
        }
예제 #2
0
        private void getReleaseDeadWords(List <word> wordsCurrent, string previousRelease)
        {
            List <word> wordsPrev = Utili.loadFrequencyData(previousRelease);

            for (int i = 0; i < wordsPrev.Count; i++)
            {
                if (!wordsCurrent.Exists(x => (x.text == wordsPrev[i].text)))
                {
                    listView1.Items.Add(new ListViewItem(new string[] { wordsPrev[i].text, "0", "Dead" }));
                }
            }
        }
예제 #3
0
        private void DeathAnaysis()
        {
            //string rootFolder = Application.ExecutablePath.ToString().Replace(@"\LACE\LACE\bin\Debug\LACE.EXE", @"\LACE\LACE\bin\Debug\Input\" + cbxSystems.SelectedItem.ToString());
            string[]    filePaths = Directory.GetFiles(rootFolder, "*.txt", SearchOption.AllDirectories);
            List <word> words;

            deathRate = new double[filePaths.Length];
            List <List <word> > releasesData = new List <List <word> >();
            double death = 0;

            //Skip the first release
            for (int i = 0; i < filePaths.Length; i++)
            {
                words = Utili.loadFrequencyData(filePaths[i]);
                releasesData.Add(words);
            }

            deathRate[0] = 0;

            for (int i = 0; i < releasesData.Count - 1; i++)
            {
                death = 0;

                for (int j = 0; j < releasesData[i].Count; j++)
                {
                    if (!releasesData[i + 1].Exists(x => (x.text == releasesData[i][j].text)))
                    {
                        death++;

                        //Force Analysis


                        // txtInfo.Text += releasesData[i][j].text + Environment.NewLine;
                        //MessageBox.Show((i+1) + " " + releasesData[i][j].text);
                    }
                }


                // txtInfo.Text += "------------------"+ Environment.NewLine;



                //MessageBox.Show(death.ToString());
                deathRate[i + 1] = death / releasesData[i].Count;

                //MessageBox.Show("Death: " + releasesData[i][j].text);
            }
        }
예제 #4
0
        private void cbxSystemReleases_SelectedIndexChanged(object sender, EventArgs e)
        {
            listView1.Items.Clear();
            //chart3.Series.Clear();

            string fileName = (cbxSystemReleases.SelectedItem as ComboBoxItem).Value.ToString();


            List <word> words = Utili.loadFrequencyData(fileName);

            lstViewItem.AddRange(words);

            words.Sort();
            string newTxt;

            for (int i = 0; i < words.Count; i++)
            {
                if (words[i].isnew)
                {
                    newTxt = "true";
                }
                else
                {
                    newTxt = "";
                }

                if (cbxOnlyNew.Checked && newTxt == "true")
                {
                    listView1.Items.Add(new ListViewItem(new string[] { words[i].text, words[i].frequency.ToString(), newTxt }));
                }

                else if (!cbxOnlyNew.Checked)
                {
                    listView1.Items.Add(new ListViewItem(new string[] { words[i].text, words[i].frequency.ToString(), newTxt }));
                }
            }


            if (cbxSystemReleases.SelectedIndex > 0)
            {
                string previousRelease = (cbxSystemReleases.Items[cbxSystemReleases.SelectedIndex - 1] as ComboBoxItem).Value.ToString();
                getReleaseDeadWords(words, previousRelease);
            }
        }
예제 #5
0
        private void BirthDeathAnalysis()
        {
            //Read the frequency data of all system releases from the data folder



            string[]    filePaths = Directory.GetFiles(rootFolder, "*.txt", SearchOption.AllDirectories);
            List <word> words;
            double      birth;

            List <string> sortedPaths = new List <string>();

            sortedPaths.AddRange(filePaths);
            sortedPaths.Sort();
            birthRate    = new double[filePaths.Length];
            birthRate[0] = 0; //First release always birth rate is 1

            for (int i = 1; i < sortedPaths.Count; i++)
            {
                // MessageBox.Show(sortedPaths[i]);

                words = new List <word>();
                //MessageBox.Show(Utili.loadFrequencyData(filePaths[i]).Count.ToString());
                words.AddRange(Utili.loadFrequencyData(sortedPaths[i]));
                birth = Utili.getBirthSum(words);

                //MessageBox.Show(filePaths[i] + " " + birth + " "  + words.Count);



                birthRate[i] = birth / words.Count;
            }


            DeathAnaysis();
        }