<commit_before>#define PY_ARRAY_UNIQUE_SYMBOL rank_filter_PyArray_API
//#define NO_IMPORT_ARRAY


#include <exception>
#include <iostream>
#include <string>
#include <utility>

#include "rank_filter.hxx"

#include <Python.h>
#include <boost/python.hpp>
#include <vigra/numpy_array.hxx>
#include <vigra/numpy_array_converters.hxx>


namespace rank_filter
{

    template < unsigned int N, class SrcPixelType >
    vigra::NumpyAnyArray pythonLineRankOrderFilter(const vigra::NumpyArray< N, vigra::Singleband<SrcPixelType> > & image,
            unsigned long half_length, double rank, int axis = N - 1,
            vigra::NumpyArray< N, vigra::Singleband<SrcPixelType> > res = boost::python::object())
    {
        std::string description("rank order filter over 1-Dimension, axis=");
        description += vigra::asString(axis);

        vigra_precondition((-static_cast<int>(N) <= axis) && (axis < static_cast<int>(N)),
                "lineRankOrderFilter(): Axis out of range.");
<commit_msg>src/rank_filter_py.cxx: Drop the `exception` header as it is unused.<commit_after>#define PY_ARRAY_UNIQUE_SYMBOL rank_filter_PyArray_API
//#define NO_IMPORT_ARRAY


#include <iostream>
#include <string>
#include <utility>

#include "rank_filter.hxx"

#include <Python.h>
#include <boost/python.hpp>
#include <vigra/numpy_array.hxx>
#include <vigra/numpy_array_converters.hxx>


namespace rank_filter
{

    template < unsigned int N, class SrcPixelType >
    vigra::NumpyAnyArray pythonLineRankOrderFilter(const vigra::NumpyArray< N, vigra::Singleband<SrcPixelType> > & image,
            unsigned long half_length, double rank, int axis = N - 1,
            vigra::NumpyArray< N, vigra::Singleband<SrcPixelType> > res = boost::python::object())
    {
        std::string description("rank order filter over 1-Dimension, axis=");
        description += vigra::asString(axis);

        vigra_precondition((-static_cast<int>(N) <= axis) && (axis < static_cast<int>(N)),
                "lineRankOrderFilter(): Axis out of range.");

{'fraction_non_alphanumeric': 0.12783810463968412, 'fraction_numerical': 0.0019743336623889436, 'mean_word_length': 4.448924731182796, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5864015', 'n_tokens_mistral': 671, 'n_tokens_neox': 664, 'n_words': 144}