tennis-player-pairing v1.1.2
This is used to pair up tennis players using their names within a sentence. A single pair of names can be processed or a csv file can be processed with output written to a file.
If using a csv file ensure to include the headers "Name" and "gender" as shown below: Name,gender
checkNames(name1, name2): Function checks how well a single pair of names match. How that is calculated is that names are used a sentence such as "Jack matches Jill" and counting from left to right how many times a letter occurs.
So for the above example: J occurs 2 times => 2| a occurs 2 times => 22| c occurs 2 times => 222, and so on until you get this: 22211111112
Now this number is reduced to a 2-digit number by adding the left and right hand numbers. For example: 22211111112 => |221111111, 2+2 = 4 => 4| 2111111, 2+1 = 3 => 43| 11111, 2+1 = 3 => 433, and so on until you get 60. Note if at a point there's only one digit left just append to the resulting sequence. The 60 is how well the names match, above 80% is considered a good match.
processFile(filePath): Function reads through a csv file, separates the players by their gender and checks how well players in a set match against each player in the other set. Note that the sets exclude duplicates. The result for each match is written to a output.txt file.
Results are sorted numerically by percetage first then alphabetically whereever match percentages are equal. All sorting is done in descending order.