Spaces:
Running
Running
File size: 432 Bytes
d2a63cc e4316f1 d2a63cc 0b9d8c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from typing import Any, Dict, List
from graphgen.bases.base_reader import BaseReader
class TXTReader(BaseReader):
def read(self, file_path: str) -> List[Dict[str, Any]]:
docs = []
with open(file_path, "r", encoding="utf-8") as f:
for line in f:
line = line.strip()
if line:
docs.append({self.text_column: line})
return self.filter(docs)
|