-
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: better bare row name generation #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,7 @@ def get_cname(code): | |
| f"Genre: {get_gname(g_id)} + Keyword: {normalize_keyword(kw_name)}" | ||
| ) | ||
| if not title: | ||
| title = f"{get_gname(g_id)} {normalize_keyword(kw_name)}" | ||
| title = f"{normalize_keyword(kw_name)} {get_gname(g_id)}" | ||
| # keyword and genre can have same name sometimes, remove if so | ||
| title = " ".join(dict.fromkeys(title.split())) | ||
|
|
||
|
|
@@ -129,7 +129,7 @@ def get_cname(code): | |
| if c_adj: | ||
| title = await gemini_service.generate_content_async(f"Genre: {get_gname(g_id)} + Country: {c_adj}") | ||
| if not title: | ||
| title = f"{get_gname(g_id)} {c_adj}" | ||
| title = f"{c_adj} {get_gname(g_id)}" | ||
| rows.append( | ||
| RowDefinition( | ||
| title=title, | ||
|
|
@@ -152,7 +152,7 @@ def get_cname(code): | |
| decade_str = str(decade_start)[2:] + "s" # "90s" | ||
| title = await gemini_service.generate_content_async(f"Genre: {get_gname(g_id)} + Era: {decade_str}") | ||
| if not title: | ||
| title = f"{get_gname(g_id)} {decade_str}" | ||
| title = f"{decade_str} {get_gname(g_id)}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with the keyword + genre title generation (lines 111-113), you should also handle potential duplicate words here. While it's highly unlikely for a decade string and a genre name to be identical, adding this deduplication logic improves robustness and consistency. This also improves readability by separating the title creation from the deduplication. title = f"{decade_str} {get_gname(g_id)}"
title = " ".join(dict.fromkeys(title.split())) |
||
| rows.append( | ||
| RowDefinition( | ||
| title=title, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the keyword + genre title generation (lines 111-113), you should also handle potential duplicate words here. While it's unlikely for a country adjective and a genre name to be identical, adding the deduplication logic would make the code more robust and consistent. This also improves readability by separating the title creation from the deduplication.