qumin.config package

Module contents

qumin.config.config module

class qumin.config.config.Actions(*values)[source]

Bases: str, Enum

Available actions. Each action triggers a different script.

Parameters:

Changed in version 3.2.0: Actions H and ent_heatmap are replaced by pred and pred_heatmap. They are deprecated starting from 4.0.0.

lattice = 'lattice'
macroclasses = 'macroclasses'
microclasses = 'microclasses'
patterns = 'patterns'
pred = 'pred'
pred_heatmap = 'pred_heatmap'
class qumin.config.config.FeaturesConfig(*, forms=None, lexemes=None)[source]

Bases: object

Add known features to condition predictability computations. Features can be lexeme-level (same value to all forms of the lexeme) or form-level (different values for individual forms).

Typical lexeme-level features are gender, derivational history, etc. Typical form-level features are syllable count, syllable structure, etc.

Parameters:
  • forms (List[str] | None) – names of columns in the forms table that contain the feature.

  • lexemes (List[str] | None) – names of columns in the lexemes table that contain the features.

forms: List[str] | None = None
lexemes: List[str] | None = None
class qumin.config.config.HeatmapConfig(*, label=None, cmap=None, exhaustive_labels=False, dense=False, annotate=False, order=None, cols=None, display=<factory>)[source]

Bases: object

Parameters:
  • label (str | None) – Lexeme column to use as label (for microclass heatmap, eg. inflection_class)

  • cmap (str | None) – Colormap name

  • exhaustive_labels (bool) – by default, seaborn shows only some labels on the heatmap for readability. This forces seaborn to print all labels.

  • dense (bool) – Use initials instead of full labels (only for entropy heatmap)

  • annotate (bool) – Display values on the heatmap. (only for entropy heatmap)

  • order (Any | None) – Priority list for sorting features (for entropy heatmap) ex: [number, case]). If no features-values file available, you can use the key cells to provide an ordered list of cells to display. Special value “autosort” in order to sort by cell similarity.

  • cols (List[str] | None) – List of features to show in columns (for zones heatmap) ex: [Mode, Tense]). All other features will constitute rows.

  • display (HeatmapDisplayConfig) – Options to switch on/off additional heatmaps.

annotate: bool = False
cmap: str | None = None
cols: List[str] | None = None
dense: bool = False
display: HeatmapDisplayConfig
exhaustive_labels: bool = False
label: str | None = None
order: Any | None = None
class qumin.config.config.HeatmapDisplayConfig(*, n_pairs=True, freq_margins=True)[source]

Bases: object

Set to True/False to show or hide detailed information on the heatmap

Parameters:
  • n_pairs (bool) – Whether to display the number of pairs.

  • freq_margins (bool) – Whether to display frequency margins on heatmaps.

freq_margins: bool = True
n_pairs: bool = True
class qumin.config.config.Kind(*values)[source]

Bases: str, Enum

Kind of algorithm for the patterns.

Parameters:
  • phon – phonological distance

  • edits – simple edit distance

edits = 'edits'
phon = 'phon'
class qumin.config.config.LatticeConfig(*, shorten=False, aoc=False, export=<factory>, display=<factory>)[source]

Bases: object

Configuration for the ``lattice`` action.

Parameters:
  • shorten (bool) – Drop redundant columns altogether. Useful for big contexts, but loses information. The lattice shape and stats will be the same. Avoid using with –html

  • aoc (bool) – Only attribute and object concepts. Sometimes faster for large lattices.

  • export (LatticeExportConfig) – Options for lattice export.

  • display (LatticeDisplayConfig) – Options for lattice drawing.

aoc: bool = False
display: LatticeDisplayConfig
export: LatticeExportConfig
shorten: bool = False
class qumin.config.config.LatticeDisplayConfig(*, horizontal=False, topdown=True, layout='qumin')[source]

Bases: object

Export configuration for the ``lattice`` action.

Parameters:
  • horizontal (bool) – direction of the lattice (top->down or left->right).

  • topdown (bool) – Whether to start drawing from top to down or vice-versa.

  • layout (str) – Drawing layout. Supported values are “qumin” for Qumin’s internal algorithm, or the following networkx layouts: ‘dot’ (requires pygraphviz), ‘radial’ (requires pygraphviz), ‘spring’, ‘kamada_kawai’.

horizontal: bool = False
layout: str = 'qumin'
topdown: bool = True
class qumin.config.config.LatticeExportConfig(*, html=True, ctxt=False, stat=False, pdf=True, png=False)[source]

Bases: object

Export configuration for the ``lattice`` action.

Parameters:
  • html (bool) – Export to html

  • ctxt (bool) – Export as a context

  • stat (bool) – Output stats about the lattice

  • pdf (bool) – Export as pdf

  • png (bool) – Export as png

ctxt: bool = False
html: bool = True
pdf: bool = True
png: bool = False
stat: bool = False
class qumin.config.config.MacroclassConfig(*, horizontal=False, square=False, topdown=True)[source]

Bases: object

Configuration for the ``macroclasses`` action.

Parameters:
  • horizontal (bool) – Whether to use a vertical (default) or horizontal layout

  • topdown (bool) – Whether to start drawing from top to down or vice-versa.

  • square (bool) – Controls whether the lattice is drawn with straight or squared lines.

Example:

                        square=True        square=False

                        │  ┌──┴──┐         │    ╱╲
horizontal=False        │  │   ┌─┴─┐       │   ╱  ╲
topdown=True            │  │   │   │       │  ╱   ╱╲
                        │  │   │   │       │ ╱   ╱  ╲
                        │__│___│___│       │╱___╱____╲

                        │─────┐             │⟍
                        │───┐ ├             │  ⟍
horizontal=True         │   ├─┘             │⟍ ⟋
topdown=True            │───┘               │⟋
                        │____________       │____________
horizontal: bool = False
square: bool = False
topdown: bool = True
class qumin.config.config.OverabundantPatternsConfig(*, keep=False, freq=True, tags=None)[source]

Bases: object

Configuration for the processing of overabundant forms.

Parameters:
  • keep (bool) – Whether to keep overabundant entries

  • freq (bool) – Whether to prioritize overabundant forms by frequency (fallback on file order)

  • tags (List[str] | None) – Tags to prefer when dropping overabundance (fallback on freq)

freq: bool = True
keep: bool = False
tags: List[str] | None = None
class qumin.config.config.PatternsConfig(*, kind=Kind.phon, defective=False, gap_proportion=0.4, optim_mem=False, overabundant=<factory>)[source]

Bases: object

Configuration for the patterns action.

Parameters:
  • kind (Kind) – Options are (see docs): phon, edits

  • defective (bool) – Whether to keep defective entries

  • gap_proportion (float) – Proportion of the median score used to set the gap score

  • optim_mem (bool) – Attempt to use a little bit less memory

  • overabundant (OverabundantPatternsConfig) – Configuration for overabundance

defective: bool = False
gap_proportion: float = 0.4
kind: Kind = 'phon'
optim_mem: bool = False
overabundant: OverabundantPatternsConfig
class qumin.config.config.PredictabilityConfig(*, vis=True, n=<factory>, features=<factory>, importResults=None, exportApplicable=False, export_log=False, token_freq=<factory>)[source]

Bases: object

Configuration for entropy calculations.

Parameters:
  • vis (bool) – Whether to create a heatmap of the metrics and of interpredictability zones.

  • n (List[int]) – Compute entropy for prediction from with n predictors.

  • features (FeaturesConfig) – Feature column in the Lexeme table. Features will be considered known in conditional probabilities: P(X~Y|X,f1,f2…)

  • importResults (str | None) – Import previous entropy computation results. with any file, use to compute entropy heatmap with n-1 predictors, allows for acceleration on nPreds entropy computation.

  • exportApplicable (bool) – whether to export applicable patterns for further entropy computations with different settings.

  • export_log (bool) – whether to export a full human readable markdown log of intermediate calculations (competition classes of alternation patterns and their respective probabilities)

  • token_freq (TokenFreqConfig) – Whether to use token frequencies for…

exportApplicable: bool = False
export_log: bool = False
features: FeaturesConfig
importResults: str | None = None
n: List[int]
token_freq: TokenFreqConfig
vis: bool = True
class qumin.config.config.QuminConfig(*, action=Actions.patterns, data, patterns=None, pos=None, lexemes=None, cells=None, sample_lexemes=None, sample_cells=None, force_random=False, seed=1, force=False, cpus=1, resegment=False, checkSegments=True, pats=<factory>, lattice=<factory>, macroclasses=<factory>, heatmap=<factory>, pred=<factory>)[source]

Bases: object

Parameters:
  • action (Actions) – Action, one of: patterns, pred, lattice, macroclasses, microclasses, pred_heatmap

  • data (str) – Path to paralex.package.json paradigms, segments

  • cells (List[str] | None) – Cells to use (subset)

  • pos (List[str] | None) – Parts of speech to use (subset)

  • patterns (str | None) – Path to pattern computation metadata. If null, will compute patterns.

  • lexemes (str | None) – Lexemes to use (subset), path to a file with one lexeme id per row

  • sample_lexemes (int | None) – A number of lexemes to sample, for debug purposes.

  • sample_cells (int | None) – A number of cells to sample, for debug purposes. Samples by frequency if possible, otherwise randomly.

  • force_random (bool) – Whether to force random sampling.

  • seed (int) – Random seed for reproducible random effects.

  • force (bool) – Whether to overpass RAM usage security (2GB)

  • cpus (int) – Number of cpus to use for big computations Defaults to 1. 0 sets the number of available cpus to the maximum - 2.

  • resegment (bool) – Whether to ignore spaces in phon forms and re-compute phonemic segmentation

  • checkSegments (bool) – Whether to control if all forms contain licit segments.

  • pats (PatternsConfig) – Configuration for the patterns action.

  • lattice (LatticeConfig) – Configuration for the lattice action.

  • heatmap (HeatmapConfig) – Configuration for the microclasses and pred_heatmap action.

  • pred (PredictabilityConfig) – Configuration for the pred action.

  • entropy – deprecated.

  • macroclasses (MacroclassConfig)

Changed in version 3.2.0: Namespace entropy is replaced by pred.

action: Actions = 'patterns'
cells: List[str] | None = None
checkSegments: bool = True
cpus: int = 1
data: str
force: bool = False
force_random: bool = False
heatmap: HeatmapConfig
lattice: LatticeConfig
lexemes: str | None = None
macroclasses: MacroclassConfig
pats: PatternsConfig
patterns: str | None = None
pos: List[str] | None = None
pred: PredictabilityConfig
resegment: bool = False
sample_cells: int | None = None
sample_lexemes: int | None = None
seed: int = 1
class qumin.config.config.TokenFreqConfig(*, patterns=False, predictors=False, overabundant=False, cells=False)[source]

Bases: object

Whether to use token frequencies for…

Parameters:
  • patterns (bool) – The probability of the patterns.

  • predictors (bool) – The probability of the predictor classes and of the predictor forms.

  • overabundant (bool) – The weighting of overabundant cellmates

  • cells (bool) – The weighting of the measures across different cells.

cells: bool = False
overabundant: bool = False
patterns: bool = False
predictors: bool = False
qumin.config.config.register_config()[source]

Registering the Config class with the name ‘qumin’.