Exemple #1
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);
        }
Exemple #2
0
        public void TestNameMatching()
        {
            AliasFinder af = new AliasFinder();

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

            Assert.AreEqual(1, names.Length);
        }
Exemple #3
0
        public void TestCaseInsensitivity()
        {
            AliasFinder af = new AliasFinder();

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

            Assert.AreEqual(1, names.Length);
            Assert.AreEqual(2, names[0].Split(',').Length);
            Assert.IsTrue(names[0].Contains("One Name"));
            Assert.IsTrue(names[0].Contains("one name"));
        }
Exemple #4
0
        public void FindAliases(AliasFinder af)
        {
            ReadUniqueActualReviewers();
            IEnumerable <string> actualReviewers = af.Consolidate(File.ReadAllLines(Path4ActualReviewers))
                                                   .Select(reviewerList => string.Join(",", reviewerList)) // put each reviewer in one string
                                                   .OrderBy(x => x);                                       // sort the resulting reviewers

            using (TextWriter writerActualReviewers = new StreamWriter(Path4ActualReviewers))
                foreach (string oneReviewer in actualReviewers)
                {
                    writerActualReviewers.WriteLine(oneReviewer);
                }

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

            using (TextWriter writerComputedReviewers = new StreamWriter(Path4ComputedReviewers))
                foreach (string oneReviewer in computedReviewers)
                {
                    writerComputedReviewers.WriteLine(oneReviewer);
                }
        }
Exemple #5
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]);
        }
Exemple #6
0
        public void TestSimpleAliasingWithNames2()
        {
            AliasFinder af = new AliasFinder();

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

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

            Assert.AreEqual(3, names.Length);
            Assert.IsTrue(names[0].Contains("Completely different [cdma]"));
            Assert.IsTrue(names[0].Contains("Completely different van mail address [:cdma] <unmapped@address>"));
            Assert.AreEqual(2, names[0].Split(',').Length);
        }
Exemple #7
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);
                }
        }
Exemple #8
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);
        }