Skip to content

Commit e87fff4

Browse files
committed
Make most_frequent_emojis result count configurable
1 parent 5f1c8e6 commit e87fff4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ica/analyzers/most_frequent_emojis.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
import ica
1010

11-
# The maximum number of most frequent emojis to output in the table
12-
EMOJI_DISPLAY_COUNT = 10
13-
1411

1512
def get_emoji_list() -> list[str]:
1613
"""
@@ -28,7 +25,14 @@ def main() -> None:
2825
Generates count data for the top 10 most frequently used emojis across the
2926
entire conversation
3027
"""
31-
cli_args = ica.get_cli_parser().parse_args()
28+
cli_parser = ica.get_cli_parser()
29+
cli_parser.add_argument(
30+
"--result-count",
31+
type=int,
32+
default=10,
33+
help="the number of emoji results to rank",
34+
)
35+
cli_args = cli_parser.parse_args()
3236
dfs = ica.get_dataframes(
3337
contact_name=cli_args.contact_name,
3438
timezone=cli_args.timezone,
@@ -50,7 +54,7 @@ def main() -> None:
5054
pd.DataFrame({"emoji": matches.value_counts()})
5155
.rename({"emoji": "count"}, axis="columns")
5256
.rename_axis("emoji", axis="index")
53-
.head(EMOJI_DISPLAY_COUNT)
57+
.head(cli_args.result_count)
5458
),
5559
format=cli_args.format,
5660
output=cli_args.output,

0 commit comments

Comments
 (0)