-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support the Condorcet Election Format as input #58
Comments
Since CIVS already has a format, one easy initial step would be write a converter from this format to the CIVS input format. I guess there's some some PHP code to parse this? And interpret it? Not the language I'd pick for the job, to be honest. |
There is one here:
But it is strongly coupled with the Condorcet library of the same project. It is therefore not a pure parser, as its purpose is to convert into an Election object but not expose raw data into data structure. However, it would be easy to add a tiny wrapper to export it in Civs format. This is less elegant than a more agnostic parser. And possibly a PERL one. And also, some protection must be planned, because the Condorcet PHP can manage billions of votes. |
The CIVS input format does support weighting votes. The tabulation algorithms don't, but that is a separate problem. |
With the CondorcetElectionFormat, you have: Weight: Quantifier: Both: Weight can be unsupported with a warning (or better: silently converted to a quantifier, because it s the same for the results calculation). |
The main problem should be that Civs format uses an order to identify a candidate, but Cef format uses the candidate's name. Another problem is the ties, Cef supports ties on a rank. And also: implicit ranking. How absence of choice is implemented. An illustration of the conversion could be: Cef:#/Candidates: A ; B ; C ; D
#/Weight allowed: true
#/Implicit Ranking: true
A > B > C * 2
C > B > A ^2
B > A > C ^2 *2 Civs:2X1,2,3,4
2X3,2,1,4
4X2,1,3,4 Or if Cef set: Civs:2X1,2,3,-
2X3,2,1,-
4X2,1,3,- But the following, I don't know how to do it: Cef:#/Candidates: A ; B ; C ; D
A > B = C > D |
CIVS will let you specify ties. Your example would be 1,2,2,3 |
Is there a comment system, where I can put additional information, such as the identity of the candidates? |
Lines beginning with a # are treated as comments and ignored. |
Just wrote a PR to add a Converter (export only) to the Civs format inside the Condorcet project: julien-boudry/Condorcet#134 Can you read, especially the test file, and validate it? Then, it should be easy to write a conversion routine from Cef to Civs. $election = (new CondorcetElectionFormat(<string or file input>))->setDataToAnElection();
CivsFormat::createFromElection(election: $election, file: null); // return string unless file is set Or, a little bit more ambitious: add a Converter command to the Condorcet command line version. |
Condorcet v4.4 just release with support of exporting to Civs format. https://www.condorcet.io/2.AsCommandLineApplication/3.ImportFromElectionFormat?id=convert-formats As command line application: condorcet convert --from-condorcet-election-format --to-civs-format pathToInput pathToOutput As PHP library: $election = (new CondorcetElectionFormat(<string or file input>))->setDataToAnElection();
CivsFormat::createFromElection(election: $election, file: null); // return string unless file is set Examples of conversions can be seen in the test file: Better: should be the first alternative implementation in Perl of this standard. |
The Condorcet Election Format (.cvotes) is a tentative to standardize election input (configuration & vote data) in a human-readable and editable format, but also a precise definition that is easy to parse for a program.
https://github.com/CondorcetVote/CondorcetElectionFormat
The text was updated successfully, but these errors were encountered: