public static void WriteAllLinesToTmp(this IEnumerable <string> list)
 {
     File.WriteAllLines(GetCurrentTmpFile(), list);
 }
Пример #2
0
 /// <summary>
 /// 写入所有行
 /// </summary>
 /// <param name="path"></param>
 /// <param name="lines"></param>
 static public void SaveAllLines(string path, string[] lines)
 {
     CheckFileSavePath(path);
     File.WriteAllLines(path, lines);
 }
Пример #3
0
 public void WriteOutput(IEnumerable <string> lines)
 {
     File.WriteAllLines(outputFilePath, lines.ToArray());
 }
Пример #4
0
        public void FindAllMatches(Row[] allData, ref ClosedSets newMatches)
        {
            int originalNumberOfMatches = newMatches.NumberOfMatches;

            //******************  SOLID MATCHES   ******************//
            AddMatches("SSN + LAST", allData, r => HardSelector(r, new FieldInclusions
            {
                SSN  = true,
                Last = true,
            }), 0, (r1, r2) =>
                       1, ref newMatches, originalNumberOfMatches);
            AddMatches("SSN + DOB", allData, r => HardSelector(r, new FieldInclusions
            {
                SSN = true,
                DOB = true,
            }), 0, (r1, r2) =>
                       1, ref newMatches, originalNumberOfMatches);
            AddMatches("SSN + PHONE", allData, r => HardSelector(r, new FieldInclusions
            {
                SSN   = true,
                Phone = true,
            }), 0, (r1, r2) =>
                       1, ref newMatches, originalNumberOfMatches);
            AddMatches("SSN + ADDRESS", allData, r => HardSelector(r, new FieldInclusions
            {
                SSN     = true,
                Address = true,
            }), 0, (r1, r2) =>
                       1, ref newMatches, originalNumberOfMatches);

            AddMatches("NAME + DOB strong", allData, r => HardSelector(r, new FieldInclusions
            {
                Name = true,
                DOB  = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN     = true,
                Phone   = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);
            AddMatches("NAME + PHONE (no sr/jr)", allData, r => HardSelector(r, new FieldInclusions
            {
                Name  = true,
                Phone = true
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN = true,
                DOB = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("NAME + ADDRESS (no sr/jr)", allData, r => HardSelector(r, new FieldInclusions
            {
                Name    = true,
                Address = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN = true,
                DOB = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("DOB + PHONE (no twin)", allData, r => HardSelector(r, new FieldInclusions
            {
                First = true,
                DOB   = true,
                Phone = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN     = true,
                Last    = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("DOB + ADDRESS (no twin)", allData, r => HardSelector(r, new FieldInclusions
            {
                DOB     = true,
                Address = true
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN   = true,
                First = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("PHONE + ADDRESS (no twin)", allData, r => HardSelector(r, new FieldInclusions
            {
                Phone   = true,
                Address = true
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN   = true,
                First = true,
            }), ref newMatches, originalNumberOfMatches);


            AddMatches("SSN + soft match", allData, r => HardSelector(r, new FieldInclusions
            {
                SSN = true
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                Name    = true,
                Phone   = true,
                DOB     = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches); // Josh Code Review : Makes many of the SSN matches above redundant.

            //******************  PROBABLY SOLID MATCHES   ******************//

            AddMatches("NAME + PHONE (sr/jr)", allData, r => HardSelector(r, new FieldInclusions
            {
                Name  = true,
                Phone = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                Address = true,
            }), ref newMatches, originalNumberOfMatches);
            AddMatches("NAME + ADDRESS (sr/jr)", allData, r => HardSelector(r, new FieldInclusions
            {
                Name    = true,
                Address = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                Phone = true,
            }), ref newMatches, originalNumberOfMatches);
            AddMatches("DOB + PHONE (twin)", allData, r => HardSelector(r, new FieldInclusions
            {
                DOB   = true,
                Phone = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                Last    = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);
            AddMatches("DOB + ADDRESS (twin)", allData, r => HardSelector(r, new FieldInclusions
            {
                Address = true,
                DOB     = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                Last  = true,
                Phone = true,
            }), ref newMatches, originalNumberOfMatches);
            AddMatches("PHONE + ADDRESS (twin)", allData, r => HardSelector(r, new FieldInclusions
            {
                Phone   = true,
                Address = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                Last = true,
            }), ref newMatches, originalNumberOfMatches);


            //AddMatches("Name + 2 soft", allData, r => HardSelector(r, new FieldInclusions
            //{
            //    Name = true,
            //}), 2, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            //{
            //    SSN = true,
            //    DOB = true,
            //    Phone = true,
            //    Address = true,
            //}), ref newMatches, originalNumberOfMatches);
            //AddMatches("DOB + 2 soft", allData, r => HardSelector(r, new FieldInclusions
            //{
            //    DOB = true,
            //}), 2, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            //{
            //    SSN = true,
            //    First = true,
            //    Phone = true,
            //    Address = true,
            //}), ref newMatches, originalNumberOfMatches);
            AddMatches("Phone + 2 soft", allData, r => HardSelector(r, new FieldInclusions
            {
                Phone = true,
            }), 2, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN     = true,
                First   = true,
                DOB     = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);
            AddMatches("Address + 2 soft", allData, r => HardSelector(r, new FieldInclusions
            {
                Address = true,
            }), 2, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN   = true,
                First = true,
                DOB   = true,
                Phone = true,
            }), ref newMatches, originalNumberOfMatches);  //Josh code review : This could match on address, first name, and DOB.  Maybe it should go in the weaker matches category?

            ////******************  WEAKER MATCHES   ******************//

            //List<int> weakerMatchedIDs = new List<int>();
            //var weak =
            AddMatches("PHONE + soft SSN", allData, r => HardSelector(r, new FieldInclusions
            {
                Phone = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN = true,
            }), ref newMatches, originalNumberOfMatches);
            //weakerMatchedIDs.AddRange(weak);

            //weak =
            AddMatches("NAME + DOB weaker", allData, r => HardSelector(r, new FieldInclusions
            {
                Name = true,
                DOB  = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSNSoft = true,
            }), ref newMatches, originalNumberOfMatches);
            //weakerMatchedIDs.AddRange(weak);

            //weak =
            AddMatches("NAME + PHONE weaker", allData, r => HardSelector(r, new FieldInclusions
            {
                Name  = true,
                Phone = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSNSoft = true,
            }), ref newMatches, originalNumberOfMatches);
            //weakerMatchedIDs.AddRange(weak);

            //weak =
            AddMatches("NAME + ADDRESS weaker", allData, r => HardSelector(r, new FieldInclusions
            {
                Name    = true,
                Address = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSNSoft = true,
            }), ref newMatches, originalNumberOfMatches);
            //weakerMatchedIDs.AddRange(weak);

            //weak =
            AddMatches("PHONE + soft NAME", allData, r => HardSelector(r, new FieldInclusions
            {
                Phone = true
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                Name = true,
            }), ref newMatches, originalNumberOfMatches);
            //weakerMatchedIDs.AddRange(weak);

            //weak =
            AddMatches("PHONE + soft FIRST/DOB", allData, r => HardSelector(r, new FieldInclusions
            {
                Phone = true
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                First = true,
                DOB   = true,
            }), ref newMatches, originalNumberOfMatches);
            //weakerMatchedIDs.AddRange(weak);

            ////******************  NEW SUPER-WEAK MATCHES   ******************//

            AddMatches("FIRST + EMAIL + soft", allData, r => HardSelector(r, new FieldInclusions
            {
                Email = true,
                First = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN   = true,
                DOB   = true,
                Phone = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("EMAIL + soft", allData, r => HardSelector(r, new FieldInclusions
            {
                Email = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN   = true,
                DOB   = true,
                Phone = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("SSN + soft", allData, r => HardSelector(r, new FieldInclusions
            {
                SSN = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                First   = true,
                DOB     = true,
                Phone   = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("NAME + soft", allData, r => HardSelector(r, new FieldInclusions
            {
                Name = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN     = true,
                DOB     = true,
                Phone   = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("Phone + soft", allData, r => HardSelector(r, new FieldInclusions
            {
                Phone = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN     = true,
                Name    = true,
                DOB     = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("DOB + soft", allData, r => HardSelector(r, new FieldInclusions
            {
                DOB = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN     = true,
                Name    = true,
                Phone   = true,
                Address = true,
            }), ref newMatches, originalNumberOfMatches);

            AddMatches("Address + soft", allData, r => HardSelector(r, new FieldInclusions
            {
                Address = true,
            }), 1, (r1, r2) => SoftMatchCount(r1, r2, new FieldInclusions
            {
                SSN   = true,
                Name  = true,
                DOB   = true,
                Phone = true,
            }), ref newMatches, originalNumberOfMatches);


            Console.WriteLine("Done!");
            if (_printActuals)
            {
                File.WriteAllLines("newMatches.txt", _newMatchingRows);
            }
        }