revscoring.datasources.meta

Meta-Features are classes that extend Datasource and implement common operations on other Datasource.

dicts

These meta-datasources operate on revscoring.Datasource‘s that return dict‘s

class revscoring.datasources.meta.dicts.keys(dict_datasource, name=None)[source]

Generates a set of dict keys

Parameters:
dict_datasource : revscoring.Datasource

A datasource that generates a dict

name : str

A name for the new datasource.

class revscoring.datasources.meta.dicts.values(dict_datasource, name=None)[source]

Generates a list of dict values

Parameters:
dict_datasource : revscoring.Datasource

A datasource that generates a dict

name : str

A name for the new datasource.

extractors

These meta-datasources operate on revscoring.Datasource‘s that return str‘s or list ( str ) and extract information from them.

class revscoring.datasources.meta.extractors.regex(regexes, text_datasource, regex_flags=2, name=None)[source]

Generates a list of strings that match any of a set of privided regexes

Parameters:
regexes : list ( str )

A list of regexes to find in the text

text_datasource : revscoring.Datasource

A datasource that returns a str or a list of str

regex_flags : int

A set of regex flags to use in matching

name : str

A name for the new datasource

filters

These meta-datasources operate on revscoring.Datasource‘s that return list‘s and produce sub-lists.

class revscoring.datasources.meta.filters.filter(include, items_datasource, inverse=False, name=None)[source]

Generates a filtered list of items

Parameters:
include : func

A function that returns True when an item should be included

items_datasource : revscoring.Datasource

A datasource that generates a list of items

name : str

A name for the datasource.

class revscoring.datasources.meta.filters.regex_matching(regex, strs_datasource, name=None)[source]

Generates a filtered list of items

Parameters:
regex : str | compiled re

A regular expression to match (case-insensitive if a str is provided)

items_datasource : revscoring.Datasource

A datasource that generates a list of items

name : str

A name for the datasource.

class revscoring.datasources.meta.filters.positive(numbers_datasource, name=None)[source]

Generates a filtered list of positive numbers from a list of numbers.

Parameters:
numbers_datasource : revscoring.Datasource

A datasource that generates the subset of numbers that are positive

name : str

A name for the datasource.

class revscoring.datasources.meta.filters.negative(numbers_datasource, name=None)[source]

Generates a filtered list of negative numbers from a list of numbers.

Parameters:
numbers_datasource : revscoring.Datasource

A datasource that generates the subset of numbers that are negative

name : str

A name for the datasource.

frequencies

These meta-datasources operate on revscoring.Datasource‘s that return list‘s of items and produce frequency tables.

class revscoring.datasources.meta.frequencies.table(items_datasource, name=None)[source]

Generates a frequency table for a list of items generated by another datasource.

Parameters:
items_datasource : revscoring.Datasource

A datasource that generates a list of some hashable item

name : str

A name for the datasource.

class revscoring.datasources.meta.frequencies.delta(old_ft_datasource, new_ft_datasource, name=None)[source]

Generates a frequency table diff by comparing two frequency tables.

Parameters:
old_ft_datasource : revscoring.Datasource

A frequency table datasource

new_ft_datasource : revscoring.Datasource

A frequency table datasource

name : str

A name for the datasource.

class revscoring.datasources.meta.frequencies.prop_delta(old_ft_datasource, delta_datasource, name=None)[source]

Generates a proportional frequency table diff by comparing a frequency table diff with an old frequency table.

Parameters:
old_ft_datasource : revscoring.Datasource

A frequency table datasource

new_ft_datasource : revscoring.Datasource

A frequency table datasource

name : str

A name for the datasource.

mappers

These meta-datasources operate on revscoring.Datasource‘s that return list‘s and apply a specific function to each item.

class revscoring.datasources.meta.mappers.map(apply, items_datasource, name=None)[source]

Returns a revscoring.Datasource that applies a function over a set of items generated by another datasource.

Parameters:
apply : func

A function to apply to each item generated by items_datasource

items_datasource : revscoring.Datasource

A datasource that generates a list of some item

name : str

A name for the datasource.

class revscoring.datasources.meta.mappers.lower_case(strs_datasource, name=None)[source]

Returns a revscoring.Datasource that lower cases a list of str returned by another datasource.

Parameters:
strs_datasource : revscoring.Datasource

A datasource that generates a list of str

name : str

A name for the datasource.

class revscoring.datasources.meta.mappers.abs(numbers_datasource, name=None)[source]

Returns a revscoring.Datasource that converts a list of numeric values into a list of absolute numeric values.

Parameters:
numbers_datasource : revscoring.Datasource

A datasource that generates a list of numeric values

name : str

A name for the datasource.

Revision Scoring

Navigation

Related Topics