[+] Deploy to pypi
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Stop on error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Remove old build
|
||||||
|
rm -rf dist/*
|
||||||
|
|
||||||
|
# Build
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
|
# Check built files
|
||||||
|
twine check dist/*
|
||||||
|
|
||||||
|
# Upload
|
||||||
|
twine upload dist/*
|
||||||
@@ -223,7 +223,7 @@ def collect_visualize_freq():
|
|||||||
|
|
||||||
# Write JSON
|
# Write JSON
|
||||||
data = {val: {'f': f_means[:, i].tolist(), 'm': m_means[:, i].tolist()} for i, val in enumerate(['Pitch', 'F1', 'F2', 'F3'])}
|
data = {val: {'f': f_means[:, i].tolist(), 'm': m_means[:, i].tolist()} for i, val in enumerate(['Pitch', 'F1', 'F2', 'F3'])}
|
||||||
Path('results/frequency-data.json').write_text(json.dumps(data), 'utf-8')
|
Path('results/vox1_data.json').write_text(json.dumps(data), 'utf-8')
|
||||||
|
|
||||||
|
|
||||||
def collect_visualize_tilt():
|
def collect_visualize_tilt():
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
import sgs
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="speech-gender-statistics",
|
||||||
|
version=sgs.__version__,
|
||||||
|
author="Azalea Gui",
|
||||||
|
author_email="hykilpikonna@gmail.com",
|
||||||
|
description='Using statistical methods to determine speech femininity/masculinity based on phonetic features',
|
||||||
|
license="MIT",
|
||||||
|
install_requires=['praat-parselmouth', 'numpy', 'scipy'],
|
||||||
|
url="https://github.com/hykilpikonna/SpeechGenderAnalysis",
|
||||||
|
packages=['sgs'],
|
||||||
|
include_package_data=True,
|
||||||
|
long_description=Path('README.md').read_text(),
|
||||||
|
long_description_content_type='text/markdown',
|
||||||
|
python_requires='>=3.8',
|
||||||
|
)
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import sgs.api
|
||||||
|
import sgs.calculations
|
||||||
|
|
||||||
|
__version__ = '1.0.0'
|
||||||
@@ -2,10 +2,11 @@ import json
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
|
import pkg_resources
|
||||||
from parselmouth import Sound
|
from parselmouth import Sound
|
||||||
from scipy.stats import gaussian_kde
|
from scipy.stats import gaussian_kde
|
||||||
|
|
||||||
from calculations import calculate_freq_statistics, calculate_freq_info, calculate_tilt
|
from .calculations import calculate_freq_statistics, calculate_freq_info, calculate_tilt
|
||||||
|
|
||||||
Feature = Literal['pitch', 'f1', 'f2', 'f3', 'tilt']
|
Feature = Literal['pitch', 'f1', 'f2', 'f3', 'tilt']
|
||||||
Gender = Literal['f', 'm']
|
Gender = Literal['f', 'm']
|
||||||
@@ -23,8 +24,8 @@ def load_kde() -> dict[Feature, dict[Gender, gaussian_kde]]:
|
|||||||
if _kde_functions:
|
if _kde_functions:
|
||||||
return _kde_functions
|
return _kde_functions
|
||||||
|
|
||||||
data: dict[Feature, dict[Gender, list[float]]] = {**json.loads(Path('results/frequency-data.json').read_text()),
|
data_file = pkg_resources.resource_filename(__name__, 'data/vox1_data.json')
|
||||||
**json.loads(Path('results/tilt-data.json').read_text())}
|
data: dict[Feature, dict[Gender, list[float]]] = json.loads(Path(data_file).read_text())
|
||||||
|
|
||||||
# Lowercase keys
|
# Lowercase keys
|
||||||
data = {k.lower(): data[k] for k in data}
|
data = {k.lower(): data[k] for k in data}
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user