There was an error while loading. Please reload this page.
1 parent 41ad77b commit 8206167Copy full SHA for 8206167
1 file changed
main.py
@@ -65,6 +65,12 @@ def read_table_from_postgres(settings: PostgresSettings) -> pd.DataFrame:
65
return pd.read_sql(query, engine)
66
67
68
+def parse_pg_array(val):
69
+ if isinstance(val, str):
70
+ return val.strip("{}").split(",")
71
+ return val
72
+
73
74
@entrypoint(LDATopicModeling)
75
def lda_topic_modeling(settings):
76
logger.info("Starting LDA topic modeling pipeline…")
@@ -75,7 +81,7 @@ def lda_topic_modeling(settings):
81
preprocessed_docs = [
82
PreprocessedDocument(
77
83
doc_id=row["doc_id"],
78
- tokens=row["tokens"]
84
+ tokens=parse_pg_array(row["tokens"])
79
85
)
80
86
for _, row in normalized_docs.iterrows()
87
]
0 commit comments