fabricatio_anki.actions.topic_analysis

AppendTopicAnalysis adds topic analysis to a CSV file as a new column.

Classes

AppendTopicAnalysis

Appends topic analysis results as a new column to a given CSV file.

Module Contents

class fabricatio_anki.actions.topic_analysis.AppendTopicAnalysis(/, **data: Any)

Bases: fabricatio_core.Action, fabricatio_anki.capabilities.generate_analysis.GenerateAnalysis

Appends topic analysis results as a new column to a given CSV file.

This class reads the specified CSV file, generates topic analysis for each row, and appends it as a new column. The result is either saved in a new file or overwrites the original if no output path is provided.

ctx_override: ClassVar[bool] = True

Whether to override the instance attr by the context variable.

append_col_name: str = 'Topic Analysis'

Name of the column where topic analysis will be appended.

csv_file: str | pathlib.Path

Path to the CSV file where topic analysis should be applied.

output_file: str | pathlib.Path | None = None

Path to the output CSV file. If None, the input file will be overwritten.

separator: str = ','

Separator used in the CSV file. Default is ‘,’.