コード例 #1
0
        public void FindAliasesFromAuthors(string path2AuthorFile)
        {
            AliasFinder af = new AliasFinder();

            af.InitializeMappingFromAuthorList(File.ReadAllLines(path2AuthorFile));
            FindAliases(af);
        }
コード例 #2
0
        public void TestSingleNameMatching()
        {
            AliasFinder af = new AliasFinder();

            af.InitializeMappingFromAuthorList(authorMultiList.Split('\n'));

            Assert.AreEqual("Full Name <email@address>", af.DeanonymizeAuthor("Full Name").Single());
            Assert.AreEqual("Full Name <email@address>", af.DeanonymizeAuthor("email@address").Single());
            Assert.AreEqual("Full Name <email@address>", af.DeanonymizeAuthor("address2@test").Single());
            Assert.AreEqual("Full Name <email@address>", af.DeanonymizeAuthor("Full Name <address2@test>").Single());

            Assert.AreEqual("Not Related", af.DeanonymizeAuthor("unrelated@test").Single());
            Assert.AreEqual("Not Related", af.DeanonymizeAuthor("Absoluteley Not Related").Single());
        }
コード例 #3
0
        public void TestSimpleAliasingWithAuthors()
        {
            AliasFinder af = new AliasFinder();

            af.InitializeMappingFromAuthorList(authorMultiList.Split('\n'));

            string[] names = af.Consolidate(authorTestset.Split('\n'))
                             .Select(reviewerList => string.Join(",", reviewerList)) // put each reviewer in one string
                             .OrderBy(x => x)                                        // sort the resulting reviewers
                             .ToArray();

            Assert.AreEqual(4, names.Length);
            Assert.AreEqual("Completely different", names[0]);
            Assert.AreEqual("Completely different van mail address [:cdma] <unmapped@address>", names[1]);
        }
コード例 #4
0
        public void FindAliasesInAuthors(string path2AuthorFile)
        {
            string[] authors = File.ReadAllLines(path2AuthorFile);

            AliasFinder af = new AliasFinder();

            af.InitializeMappingFromAuthorList(authors);
            IEnumerable <string> reviewers = af.Consolidate(authors)
                                             .Select(reviewerList => string.Join(",", reviewerList)) // put each reviewer in one string
                                             .OrderBy(x => x);                                       // sort the resulting reviewers

            using (TextWriter writerForReviewers = new StreamWriter(path2AuthorFile + "-concise.txt"))
                foreach (string oneReviewer in reviewers)
                {
                    writerForReviewers.WriteLine(oneReviewer);
                }
        }
コード例 #5
0
        public void TestNameDistinction()
        {
            AliasFinder afAuthors = new AliasFinder();

            afAuthors.InitializeMappingFromAuthorList(authorMultiList.Split('\n'));


            string[] namesFromDoubleList = afAuthors.Consolidate((authorTestset + "\n" + authorTestset).Split('\n'))
                                           .Select(reviewerList => string.Join(",", reviewerList)) // put each reviewer in one string
                                           .OrderBy(x => x)                                        // sort the resulting reviewers
                                           .ToArray();

            string[] namesFromNormalList = afAuthors.Consolidate(authorTestset.Split('\n'))
                                           .Select(reviewerList => string.Join(",", reviewerList)) // put each reviewer in one string
                                           .OrderBy(x => x)                                        // sort the resulting reviewers
                                           .ToArray();

            CollectionAssert.AreEquivalent(namesFromNormalList, namesFromDoubleList);
        }
コード例 #6
0
        public void TestMappingMatch()
        {
            AliasFinder afNames = new AliasFinder();

            afNames.InitializeMappingFromNames(nameMappingTest.Split('\n'));

            AliasFinder afAuthors = new AliasFinder();

            afAuthors.InitializeMappingFromAuthorList(authorMultiList.Split('\n'));

            string[] namesFromNames = afNames.Consolidate(authorTestset.Split('\n'))
                                      .Select(reviewerList => string.Join(",", reviewerList)) // put each reviewer in one string
                                      .OrderBy(x => x)                                        // sort the resulting reviewers
                                      .ToArray();

            string[] namesFromAuthors = afAuthors.Consolidate(authorTestset.Split('\n'))
                                        .Select(reviewerList => string.Join(",", reviewerList)) // put each reviewer in one string
                                        .OrderBy(x => x)                                        // sort the resulting reviewers
                                        .ToArray();

            CollectionAssert.AreEquivalent(namesFromAuthors, namesFromNames);
        }
コード例 #7
0
        public AlgorithmComparisonRunner(string sourceUrl, string basepath, IList <AlgorithmBase> algorithmsToEvaluate)
        {
            PredictedIssues = new HashSet <string>();
            Algorithms      = algorithmsToEvaluate;

            SourceManager    = new SourceRepositoryConnector();
            NameConsolidator = new AliasFinder();
            string authorMappingPath = basepath + authorsConsolidated;

            if (File.Exists(authorMappingPath))
            {
                NameConsolidator.InitializeMappingFromAuthorList(File.ReadAllLines(authorMappingPath));
                SourceManager.Deduplicator = NameConsolidator;
                foreach (AlgorithmBase algo in algorithmsToEvaluate)
                {
                    algo.Deduplicator = NameConsolidator;
                }
            }
            else
            {
                Log.Warn("No file exists for " + authorMappingPath);
            }
            InitAlgorithms(sourceUrl);
        }