public override void Compute()
        {
            string[] models = new string[] { "VSM", "JS" };
            string[] processes = new string[] { "raw", "noun", "smooth", "both" };

            List<DataSet> list = new List<DataSet>();
            DataSet ds = new DataSet
            {
                Name = "Dataset",
                Metrics = new DataSetPairsCollection(),
                SourceArtifacts = "",
                TargetArtifacts = "",
                Oracle = "",
            };

            foreach (string model in models)
            {
                foreach (string process in processes)
                {
                    foreach (DataSetPairs dsp in (DataSetPairsCollection)Workspace.Load(model + "_" + process + "_metrics"))
                    {
                        dsp.Name = model + " (" + process + ")@" + dsp.Name;
                        ds.Metrics.Add(dsp);
                    }
                }
            }

            list.Add(ds);
            Workspace.Store("ListOfDatasets", list);
        }
Esempio n. 2
0
        /// <summary>
        /// Imports INFORMATION about corpora from an XML file.
        /// For use with a loop importer.
        /// </summary>
        /// <param name="XMLfile">File location object</param>
        /// <returns>List of dataset information</returns>
        public static List<DataSet> ImportDatasets(FilePath XMLfile)
        {
            XmlDocument XMLdoc = new XmlDocument();
            XMLdoc.Load(XMLfile.Absolute);

            string[] s = XMLfile.Absolute.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
            StringBuilder path = new StringBuilder();
            for (long i = 0; i < s.Length - 1; i++)
            {
                path.Append(s[i]);
                path.Append("\\");
            }
            path.Append(XMLdoc.GetElementsByTagName("Datasets")[0].Attributes["Directory"].Value.Replace('/', '\\'));

            List<DataSet> datasets = new List<DataSet>();
            XmlNodeList nodelist = XMLdoc.GetElementsByTagName("Dataset");

            foreach (XmlNode node in nodelist)
            {
                DataSet dataset = new DataSet();
                dataset.SourceArtifacts = path + node["Corpus"]["SourceArtifacts"].InnerText;
                dataset.TargetArtifacts = path + node["Corpus"]["TargetArtifacts"].InnerText;
                dataset.Oracle = path + node["Corpus"]["Oracle"].InnerText;
                dataset.Name = node.Attributes["Name"].Value;
                datasets.Add(dataset);
            }

            return datasets;
        }