mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 05:39:06 +00:00
Use Base TextToJsonl class to standardize <text>_to_jsonl processors
- Start standardizing implementation of the `text_to_jsonl' processors
- `text_to_jsonl; scripts already had a shared structure
- This change starts to codify that implicit structure
- Benefits
- Ease adding more `text_to_jsonl; processors
- Allow merging shared functionality
- Help with type hinting
- Drawbacks
- Lower agility to change. But this was already an implicit issue as
the text_to_jsonl processors got more deeply wired into the app
This commit is contained in:
14
src/processor/text_to_jsonl.py
Normal file
14
src/processor/text_to_jsonl.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Standard Packages
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Iterable
|
||||
|
||||
# Internal Packages
|
||||
from src.utils.rawconfig import TextContentConfig
|
||||
|
||||
|
||||
class TextToJsonl(ABC):
|
||||
def __init__(self, config: TextContentConfig):
|
||||
self.config = config
|
||||
|
||||
@abstractmethod
|
||||
def process(self, previous_entries: Iterable[tuple[int, dict]]=None) -> list[tuple[int, dict]]: ...
|
||||
Reference in New Issue
Block a user