Skip to content

Use 'correlate' #12

Description

@uranusjr

https://pypi.org/project/correlate/

This was presented during PyCon US. It should do a better job than our hand-crafted fuzzy-matcher.

def get_match_ratio(session: Session, path: pathlib.Path) -> float:
return fuzzywuzzy.fuzz.ratio(session.title, path.stem)
def choose_video(session: Session, video_paths: list) -> pathlib.Path:
"""Look through the file list and choose the one that "looks most like it"."""
score, match = max((get_match_ratio(session, p), p) for p in video_paths)
if score < 70:
raise ValueError("no match")
return match

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions