Skip to main content

Split a string or group a collection of words into a list by matching another list of similar words, to create accurate subtitles from the actual script and inaccurate (generated) subtitles.

Project description

matchingsplit

Split a string or group a collection of words into a list by matching another list of similar words, to create accurate subtitles from the actual script and inaccurate (generated) subtitles.

Example

from matchingsplit import split

>>> split("this must be a good thing", reference=["this", "is", "a", "good", "thing"])
['this', 'must be', 'a', 'good', 'thing']

>>> split("this is a good thing", reference=["this", "must", "be", "a", "good", "thing"])
['this', '', 'is', 'a', 'good', 'thing']

>>> split("a big foo bar", ["a", "big", "ff"])
['a', 'big', 'foo bar']

>>> split("line1.\n\nline2.\nline3.", reference=["1", "2", "3"], preserve_newlines=True)
['line1.\n\n', 'line2.\n', 'line3.']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matchingsplit-0.1.2.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

matchingsplit-0.1.2-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page