<commit_before>multiset
========

This package provides a multiset_ implementation for python.

|pypi| |coverage| |build| |docs|

Overview
--------

A multiset is similar to the builtin set_, but it allows an element to occur multiple times.
It is an unordered collection of element which have to be hashable just like in a set_.
It supports the same methods and operations as set_ does, e.g. membership test, union, intersection, and
(symmetric) difference:

.. code-block:: python
    >>> set1 = Multiset('aab')
    >>> set2 = Multiset('abc')
    >>> sorted(set1 | set2)
    ['a', 'a', 'b', 'c']

Multisets can be used in combination with sets_:

.. code-block:: python
    >>> Multiset('aab') >= {'a', 'b'}
    True

The implementation is based on a dict_ that maps the elements to their multiplicity in the multiset.
Hence, some dictionary operations are supported.

In contrast to the `collections.Counter`_ from the standard library, it has proper support for set
operations and only allows positive counts. Also, elements with a zero multiplicity are automatically
removed from the multiset.

There is currently not immutable version of the multiset, because there is no immutable version of dict_.


Installation
------------

Installing `multiset` is simple with `pip <http://www.pip-installer.org/>`_::<commit_msg>Update README.rst<commit_after>multiset
========

This package provides a multiset_ implementation for python.

|pypi| |coverage| |build| |docs|

Overview
--------

A multiset is similar to the builtin set_, but it allows an element to occur multiple times.
It is an unordered collection of element which have to be hashable just like in a set_.
It supports the same methods and operations as set_ does, e.g. membership test, union, intersection, and
(symmetric) difference::

    >>> set1 = Multiset('aab')
    >>> set2 = Multiset('abc')
    >>> sorted(set1 | set2)
    ['a', 'a', 'b', 'c']

Multisets can be used in combination with sets_::

    >>> Multiset('aab') >= {'a', 'b'}
    True

The implementation is based on a dict_ that maps the elements to their multiplicity in the multiset.
Hence, some dictionary operations are supported.

In contrast to the `collections.Counter`_ from the standard library, it has proper support for set
operations and only allows positive counts. Also, elements with a zero multiplicity are automatically
removed from the multiset.

There is currently not immutable version of the multiset, because there is no immutable version of dict_.


Installation
------------

Installing `multiset` is simple with `pip <http://www.pip-installer.org/>`_::
{'fraction_non_alphanumeric': 0.10544478527607362, 'fraction_numerical': 0.003067484662576687, 'mean_word_length': 4.007677543186181, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2694722', 'n_tokens_mistral': 739, 'n_tokens_neox': 699, 'n_words': 342}