text
stringlengths
1
93.6k
get_x_ray_path,
insert_lemma,
save_db,
)
from .deps import download_word_wise_file, install_deps, which_python
from .dump_lemmas import save_spacy_docs, spacy_doc_path
from .epub import EPUB, spacy_to_wiktionary_pos
from .interval import Interval, IntervalTree
from .mediawiki import MediaWiki, Wikidata, Wikimedia_Commons
from .metadata import KFXJson
from .utils import (
CJK_LANGS,
Prefs,
dump_prefs,
get_plugin_path,
get_spacy_model_version,
get_user_agent,
get_wiktionary_klld_path,
insert_installed_libs,
kindle_db_path,
load_languages_data,
load_plugin_json,
run_subprocess,
spacy_model_name,
use_kindle_ww_db,
wiktionary_db_path,
)
from .x_ray import X_Ray
from .x_ray_share import (
NER_LABELS,
CustomXDict,
get_custom_x_path,
load_custom_x_desc,
)
except ImportError:
isfrozen = False
from database import (
create_lang_layer,
create_x_ray_db,
get_ll_path,
get_x_ray_path,
insert_lemma,
save_db,
)
from dump_lemmas import save_spacy_docs, spacy_doc_path
from epub import EPUB, spacy_to_wiktionary_pos
from interval import Interval, IntervalTree
from mediawiki import MediaWiki, Wikidata, Wikimedia_Commons
from metadata import KFXJson
from utils import (
CJK_LANGS,
Prefs,
get_spacy_model_version,
insert_installed_libs,
kindle_db_path,
load_languages_data,
load_plugin_json,
use_kindle_ww_db,
wiktionary_db_path,
)
from x_ray import X_Ray
from x_ray_share import (
NER_LABELS,
CustomXDict,
get_custom_x_path,
load_custom_x_desc,
)
@dataclass
class ParseJobData:
book_id: int = 0
book_path: str = ""
mi: Any = None
book_fmt: str = ""
book_lang: str = "" # 639-2 language code
useragent: str = ""
plugin_path: str | Path = ""
spacy_model: str = ""
create_ww: bool = True
create_x: bool = True
asin: str = ""
acr: str = ""
revision: str = ""
kfx_json: KFXJson | None = None
mobi_html: bytes | None = b""
mobi_codec: str = ""
def do_job(
data: ParseJobData,
abort: Any = None,
log: Any = None,
notifications: Any = None,
) -> ParseJobData:
from .config import prefs
from .metadata import get_asin_etc
set_en_lang = (
True