Skip to content

Commit 05e8050

Browse files
committed
Update count_phrase analyzer to return dataframe
1 parent be78bb3 commit 05e8050

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ica/analyzers/count_phrase.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import re
44

5+
import pandas as pd
6+
57
import ica
68

79

@@ -16,7 +18,11 @@ def main() -> None:
1618
)
1719
filtered_messages = dfs.messages[~dfs.messages["is_reaction"]]
1820
count = filtered_messages["text"].str.count(phrase, flags=re.IGNORECASE).sum()
19-
print(f"The phrase '{phrase}' appears {count} times.")
21+
ica.output_results(
22+
(pd.DataFrame({"phrase": (phrase,), "count": (count,)}).set_index("phrase")),
23+
format=cli_args.format,
24+
output=cli_args.output,
25+
)
2026

2127

2228
if __name__ == "__main__":

0 commit comments

Comments
 (0)