refactor: move pandas processing out of Stat Obj

Also improves error handling and logging
This commit is contained in:
2026-01-29 14:52:43 +00:00
parent 0a45bd6855
commit 64c3422395
2 changed files with 7 additions and 5 deletions

View File

@@ -19,10 +19,7 @@ nltk.download('stopwords')
EXCLUDE_WORDS = set(stopwords.words('english')) | DOMAIN_STOPWORDS
class StatGen:
def __init__(self, posts: list, comments: list) -> None:
posts_df = pd.read_json(posts, lines=True)
comments_df = pd.read_json(comments, lines=True)
def __init__(self, posts_df: pd.DataFrame, comments_df: pd.DataFrame) -> None:
posts_df["type"] = "post"
posts_df["parent_id"] = None