feat: Implement footnote removal and URL normalization in text processing; enhance manual override token normalization

This commit is contained in:
JB
2025-12-01 06:23:30 -08:00
parent b3aaa94831
commit 7eceb601f8
9 changed files with 202 additions and 51 deletions
+3 -2
View File
@@ -7,6 +7,7 @@ from abogen.entity_analysis import (
extract_entities,
merge_override,
normalize_token as normalize_entity_token,
normalize_manual_override_token,
search_tokens as search_entity_tokens,
)
from abogen.pronunciation_store import (
@@ -84,7 +85,7 @@ def collect_pronunciation_overrides(pending: PendingJob) -> List[Dict[str, Any]]
pronunciation_value = str(manual_entry.get("pronunciation") or "").strip()
if not token_value or not pronunciation_value:
continue
normalized = manual_entry.get("normalized") or normalize_entity_token(token_value)
normalized = manual_entry.get("normalized") or normalize_manual_override_token(token_value)
if not normalized:
continue
collected[normalized] = {
@@ -196,7 +197,7 @@ def upsert_manual_override(pending: PendingJob, payload: Mapping[str, Any]) -> D
voice_value = str(payload.get("voice") or "").strip()
notes_value = str(payload.get("notes") or "").strip()
context_value = str(payload.get("context") or "").strip()
normalized = payload.get("normalized") or normalize_entity_token(token_value)
normalized = payload.get("normalized") or normalize_manual_override_token(token_value)
if not normalized:
raise ValueError("Token is required")
+2 -2
View File
@@ -18,8 +18,8 @@
<nav class="top-actions">
{% set endpoint = request.endpoint or '' %}
<a href="{{ url_for('main.index') }}" class="btn{% if endpoint == 'main.index' %} is-active{% endif %}">Dashboard</a>
<a href="{{ url_for('voices.voice_profiles') }}" class="btn{% if endpoint == 'voices.voice_profiles' %} is-active{% endif %}">Voice Mixer</a>
<a href="{{ url_for('entities.entities_page') }}" class="btn{% if endpoint == 'entities.entities_page' %} is-active{% endif %}">Entities</a>
<a href="{{ url_for('voices.voice_profiles') }}" class="btn{% if endpoint == 'voices.voice_profiles' %} is-active{% endif %}">Voice Mixer</a>
<a href="{{ url_for('entities.entities_page') }}" class="btn{% if endpoint == 'entities.entities_page' %} is-active{% endif %}">TTS Overrides</a>
<a href="{{ url_for('books.find_books_page') }}" class="btn{% if endpoint == 'books.find_books_page' %} is-active{% endif %}">Find Books</a>
<a href="{{ url_for('jobs.queue_page') }}" class="btn{% if endpoint in ['jobs.queue_page', 'jobs.job_detail'] %} is-active{% endif %}">Queue</a>
<a href="{{ url_for('settings.settings_page') }}" class="btn{% if endpoint == 'settings.settings_page' %} is-active{% endif %}">Settings</a>
+2 -2
View File
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}abogen · Entities{% endblock %}
{% block title %}abogen · TTS Overrides{% endblock %}
{% block content %}
<section
@@ -9,7 +9,7 @@
data-preview-url="{{ url_for('api.api_entity_pronunciation_preview') }}"
data-language="{{ language }}"
>
<h1 class="card__title">Entities &amp; Pronunciation Overrides</h1>
<h1 class="card__title">TTS Overrides &amp; Pronunciation</h1>
<p class="card__subtitle">Review and refine stored pronunciations so recurring names sound right in every project.</p>
<form class="entity-filter" method="get">
<div class="entity-filter__row">