Coder Social home page Coder Social logo

schulze-method's Introduction

schulze-method

A Python implementation of the Schulze method.

To rank candidates, call the compute_ranks method of the schulze module. This method has the following signature and Pydoc:

def compute_ranks(candidate_names, weighted_ranks):
    """Returns the candidates ranked by the Schulze method.

    Parameter candidate_names is a sequence containing all the candidate names.

    Parameter weighted_ranks is a sequence of (ranks, weight) pairs.

    The first element, ranks, is a ranking of the candidates. It is an array of
    arrays so that we can express ties. For example, [[a, b], [c], [d, e]]
    represents a = b > c > d = e.

    The second element, weight, is typically the number of voters that chose
    this ranking.
    """

For example usage, refer to the schulze_test module. From the command line, you can run these tests like so:

$ python -m unittest schulze_test
.....
----------------------------------------------------------------------
Ran 5 tests in 0.002s

OK

schulze-method's People

Contributors

mgp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

schulze-method's Issues

Problem with UTF-8 candidate names

I wrote a small program using schulze.compute_ranks, taking care of the header (-*- coding: utf-8 -*-) and writing into the output file using codecs.open("resultat.txt","w","utf-8"). I attach this file. In the output file, instead of UTF-8 data I get explicit bytes (as in u'r\xc3\xa9flexion/n:pens\xc3\xa9e/n' instead of u'réflexion/n:pensée/n'). Can this be fixed? Thanks in advance

compare-rankings.py.pdf
resultat.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.