Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies = [
"matplotlib>=3.10.8",
"scipy>=1.17.0",
"seaborn>=0.13.2",
"sentence-transformers>=5.3.0",
]

[build-system]
Expand Down Expand Up @@ -102,8 +101,6 @@ module = [
"seaborn.*",
"matplotlib",
"matplotlib.*",
"sentence_transformers",
"sentence_transformers.*"
]
ignore_missing_imports = true

Expand Down
8 changes: 4 additions & 4 deletions src/voice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"""

from voice.comparison import (
make_embedding_comparison,
make_stylometric_comparison,
make_comparison,
stylometric_distribution,
)
from voice.datasets import DatasetSpec, get_dataset
from voice.stylometry import get_groups, get_metrics
Expand All @@ -17,6 +17,6 @@
"get_metrics",
"get_groups",
"get_dataset",
"make_embedding_comparison",
"make_stylometric_comparison",
"stylometric_distribution",
"make_comparison",
]
33 changes: 6 additions & 27 deletions src/voice/stylometry/_defaults.py → src/voice/_defaults.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Defaults for the stylometry module.
Defaults for the VOICE project.

This module contains defaults for stylometric analysis
This module contains defaults for the VOICE project
e.g. default parameters for parameterised metrics
"""

Expand All @@ -14,19 +14,15 @@ class MetricGroup(str, Enum):
Enumeration of stylometric metric groups.

Metrics within the same group are expected to be correlated;
the group is the unit of analysis for Bonferroni correction.
groups are the unit of aggregation for the alignment score.

.. attribute :: WORD_LENGTH_DISTRIBUTION

Moments of the word length distribution (mean, std, skew, kurtosis).

.. attribute :: LEXICAL_RICHNESS
.. attribute :: VOCABULARY_RICHNESS

Type-token ratio and its moving-average variant.

.. attribute :: LEGOMENA

Hapax, dis and tri legomena ratios.
Type-token ratio, its moving-average variant, and legomena ratios.

.. attribute :: FUNCTION_WORDS

Expand All @@ -42,8 +38,7 @@ class MetricGroup(str, Enum):
"""

WORD_LENGTH_DISTRIBUTION = "word_length_distribution"
LEXICAL_RICHNESS = "lexical_richness"
LEGOMENA = "legomena"
VOCABULARY_RICHNESS = "vocabulary_richness"
FUNCTION_WORDS = "function_words"
CHAR_NGRAM_DIVERSITY = "char_ngram_diversity"
TEXT_LENGTH = "text_length"
Expand Down Expand Up @@ -116,22 +111,6 @@ class CalibrationDefaults:
CALIBRATION_DEFAULTS: CalibrationDefaults = CalibrationDefaults()


@dataclass(frozen=True)
class ComparisonDefaults:
"""
Default parameters for comparing stylometric distributions.

.. attribute :: alpha

Significance level for hypothesis testing.
"""

alpha: float = 0.05


COMPARISON_DEFAULTS: ComparisonDefaults = ComparisonDefaults()


@dataclass(frozen=True)
class PlottingDefaults:
"""
Expand Down
8 changes: 3 additions & 5 deletions src/voice/comparison/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
- Functions for comparing distributions of stylometric metrics
"""

from voice.comparison.embedding_comparison import make_embedding_comparison
from voice.comparison.stylometric_comparison import (
make_stylometric_comparison,
from voice.comparison.comparison import (
make_comparison,
stylometric_distribution,
)

__all__: list[str] = [
"make_stylometric_comparison",
"make_embedding_comparison",
"stylometric_distribution",
"make_comparison",
]
2 changes: 1 addition & 1 deletion src/voice/comparison/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import numpy as np

from voice.stylometry._defaults import CALIBRATION_DEFAULTS
from voice._defaults import CALIBRATION_DEFAULTS

# -----------------------------------------------------------------------------
# Calibrated percentile
Expand Down
Loading
Loading