Skip to main content

Installation from pip3

pip3 install --verbose subtitlecore
python -m spacy download en_core_web_trf
python -m spacy download es_dep_news_trf

Usage

Please refer to api docs.

Excutable usage

  • Get subtitle content
subtitlecore_content --srtfile test.srt --lang en
  • Parse srtfile into sentences with timestamp
subtitlecore_parse2sens --srtfile test.srt --lang en
  • Parse srtfile into plain text
subtitlecore_parse2text --srtfile test.srt --lang en

Package usage

from subtitlecore import Subtitle

def get_subtitle_content(srtfile, lang):
  st = Subtitle(srtfile, lang)
  for line_info in st.content:
    print(line_info)

def parse2sens(srtfile, lang):
  st = Subtitle(srtfile, lang)
  content_sens = st.sentenize()
  for e in content_sens:
    print(e)

def parse2text(srtfile, lang):
  st = Subtitle(srtfile, lang)
  text = st.plaintext()
  print(text)

Development

Clone project

git clone https://github.com/qishe-nlp/subtitlecore.git

Install poetry

Install dependencies

poetry update

Test

poetry run pytest -rP

which run tests under tests/*

Execute

poetry run subtitlecore_content --help
poetry run subtitlecore_parse2sens --help
poetry run subtitlecore_parse2text --help

Create sphinx docs

poetry shell
cd apidocs
sphinx-apidoc -f -o source ../subtitlecore
make html
python -m http.server -d build/html

Host docs on github pages

cp -rf apidocs/build/html/* docs/

Build

  • Change version in pyproject.toml and subtitlecore/__init__.py
  • Build python package by poetry build

Git commit and push

Publish from local dev env

  • Set pypi test environment variables in poetry, refer to poetry doc
  • Publish to pypi test by poetry publish -r test

Publish through CI

git tag [x.x.x]
git push origin master

Release files for subtitlecore 0.1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subtitlecore 0.1.16
File Size Uploaded
subtitlecore-0.1.16.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for subtitlecore 0.1.16
File Interpreter ABI Platform
subtitlecore-0.1.16-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / subtitlecore-0.1.16.tar.gz

Download URL subtitlecore-0.1.16.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
665f1b122ee3fc36b9fd1dedbe76b5ae32c7527ee2402ef120c77457d2e53591
BLAKE2b-256 checksum
How to use checksums
016562a63bdc15494c8f757ddbcf83dd022fcbc92814520d97a42d892a89298c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.0 Linux/6.5.0-1025-azure

Release files / subtitlecore-0.1.16-py3-none-any.whl

Download URL subtitlecore-0.1.16-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
291b6b939ae938f85f6ba0e3bcf75cd3b5184d0ab29ae08cef4a3e7b103b8f30
BLAKE2b-256 checksum
How to use checksums
6c0caa2207530f6d6b32262baf118295f4d1a1e4ac8cc2c6d7313498bd3da6e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.12.0 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.1.16 This release

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.7

2 release files

0.1.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page