Remove unused Entry to Jsonl converter from text to entry class, tests

This was earlier used when the index was plaintext jsonl file. Now
that documents are indexed in a DB this func is not required.

Simplify org,md,pdf,plaintext to entries tests by removing the entry
to jsonl conversion step
This commit is contained in:
Debanjum Singh Solanky
2024-02-09 17:03:36 +05:30
parent 28105ee027
commit a627f56a64
9 changed files with 21 additions and 87 deletions

View File

@@ -123,8 +123,3 @@ class MarkdownToEntries(TextToEntries):
logger.debug(f"Converted {len(parsed_entries)} markdown entries to dictionaries")
return entries
@staticmethod
def convert_markdown_maps_to_jsonl(entries: List[Entry]):
"Convert each Markdown entry to JSON and collate as JSONL"
return "".join([f"{entry.to_json()}\n" for entry in entries])

View File

@@ -146,8 +146,3 @@ class OrgToEntries(TextToEntries):
)
return entries
@staticmethod
def convert_org_entries_to_jsonl(entries: Iterable[Entry]) -> str:
"Convert each Org-Mode entry to JSON and collate as JSONL"
return "".join([f"{entry_dict.to_json()}\n" for entry_dict in entries])

View File

@@ -106,8 +106,3 @@ class PdfToEntries(TextToEntries):
logger.debug(f"Converted {len(parsed_entries)} PDF entries to dictionaries")
return entries
@staticmethod
def convert_pdf_maps_to_jsonl(entries: List[Entry]):
"Convert each PDF entry to JSON and collate as JSONL"
return "".join([f"{entry.to_json()}\n" for entry in entries])

View File

@@ -87,8 +87,3 @@ class PlaintextToEntries(TextToEntries):
)
)
return entries
@staticmethod
def convert_entries_to_jsonl(entries: List[Entry]):
"Convert each entry to JSON and collate as JSONL"
return "".join([f"{entry.to_json()}\n" for entry in entries])

View File

@@ -244,11 +244,6 @@ class TextToEntries(ABC):
return entries_with_ids
@staticmethod
def convert_text_maps_to_jsonl(entries: List[Entry]) -> str:
# Convert each entry to JSON and write to JSONL file
return "".join([f"{entry.to_json()}\n" for entry in entries])
@staticmethod
def clean_field(field: str) -> str:
return field.replace("\0", "") if not is_none_or_empty(field) else ""