sitcom_simulator.script.integrations.fakeyou.character_extractor

Functions

calculate_star_rating(model[, curated_voices])

Estimates the true ratio of positive to negative reviews.

generate_character_list(prompt[, ...])

Uses a large language model to generate a list of possible famous characters related to the prompt.

load_curated_voices()

Loads the curated voices from the 'curated_voices.csv' file in the same directory as this script.

normalize_string(s)

pure_character_name(raw_name)

Returns just the character's true name from a FakeYou listing.

pure_name_to_model(models_list)

Given a list of models from FakeYou, returns a dictionary mapping the pure name of the character to the list of models matching that name.

sitcom_simulator.script.integrations.fakeyou.character_extractor.normalize_string(s)
sitcom_simulator.script.integrations.fakeyou.character_extractor.load_curated_voices()

Loads the curated voices from the ‘curated_voices.csv’ file in the same directory as this script. Important for when fakeyou’s ratings get wiped (which has happened before), we still have our own records.

sitcom_simulator.script.integrations.fakeyou.character_extractor.generate_character_list(prompt, custom_instructions=None)

Uses a large language model to generate a list of possible famous characters related to the prompt.

Parameters:
  • prompt (str) – The user-submitted prompt

  • custom_instructions (str | None) – A string containing custom instructions for the language model. Must contain the placeholder ‘{prompt}’.

Return type:

List[Character]

sitcom_simulator.script.integrations.fakeyou.character_extractor.pure_name_to_model(models_list)

Given a list of models from FakeYou, returns a dictionary mapping the pure name of the character to the list of models matching that name.

A pure name is the name of the character without any parenthetical information, e.g., “Velma (Scooby Doo)” -> “Velma”

Parameters:

models_list (list[dict]) – A list of models from FakeYou

sitcom_simulator.script.integrations.fakeyou.character_extractor.pure_character_name(raw_name)

Returns just the character’s true name from a FakeYou listing.

FakeYou names are typically formatted like “True Name (source)” e.g., Velma (Scooby Doo)

Parameters:

raw_name (str) – The raw name of the character from FakeYou

sitcom_simulator.script.integrations.fakeyou.character_extractor.calculate_star_rating(model, curated_voices=None)

Estimates the true ratio of positive to negative reviews. Intuition: 5 stars from 10 reviews is worse than 4.8 stars from 1000 reviews.

Parameters:

curated_voices (dict[str, float] | None)