Skip to content

Commit

Permalink
fix bug of specificity calculation (issue #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasmine969 committed Feb 17, 2024
1 parent 19eb5c3 commit f7fea8c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ word_specificity:

emoji_specificity:
emoji_min_count: 1
top_k: 2
top_k: 5
figsize:
- 10
- 12
Expand All @@ -47,7 +47,7 @@ word_commonality:
- 12

emoji_commonality:
top_k: 2
top_k: 5
figsize:
- 12
- 12
Expand Down
1 change: 1 addition & 0 deletions emoji_specificity.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def emoji_specificity(name1: str = 'person 1', name2: str = 'person 2',
plt.title(f'{name1} Top 5 emojis', fontsize=20)
plt.savefig(f'figs/{name1} emoji specificity.png')
plt.figure(2, figsize=figsize)
all_df.sort_values(by='specificity', ascending=True, inplace=True)
plt.barh(y, -all_df.iloc[:top_k, 3])
plt.yticks(y, all_df.iloc[:top_k, 0].tolist())
plt.xlabel('emoji专属性', fontsize=20)
Expand Down
1 change: 1 addition & 0 deletions word_specificity.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def word_specificity(name1: str = 'person 1', name2: str = 'person 2',
plt.title(f'{name1} Top 25 words', fontsize=20)
plt.savefig(f'figs/{name1} word specificity.png')
plt.figure(2, figsize=figsize)
all_df.sort_values(by='specificity', ascending=True, inplace=True)
plt.barh(y, -all_df.iloc[:top_k, 3])
plt.yticks(y, all_df.iloc[:top_k, 0].tolist())
plt.xlabel('词语专属性', fontsize=20)
Expand Down

0 comments on commit f7fea8c

Please sign in to comment.