Skip to content

Commit

Permalink
Add NLP example to readme (#114)
Browse files Browse the repository at this point in the history
* Added simple usage for NLP package to readme

* Added example grouping sentiment by author

---------

Co-authored-by: Jonas Weich <jns.wch@gmail.com>
  • Loading branch information
smty2018 and joweich authored Nov 4, 2023
1 parent f461fbd commit ba7bb91
Show file tree
Hide file tree
Showing 2 changed files with 1,003 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,28 @@ ax[1] = vis.radar(df, ax=ax[1], color='C1', alpha=0)
<img src="examples/radar.svg">
</p>

## 5. Natural Language Processing

## 5. Command Line Interface
### 5.1 Add Sentiment

```python
from chatminer.nlp import add_sentiment

df_sentiment = add_sentiment(df)
```
### 5.2 Example Plot: Sentiment per Author in Groupchat

```python
df_grouped = df_sentiment.groupby(['author', 'sentiment']).size().unstack(fill_value=0)
ax = df_grouped.plot(kind='bar', stacked=True, figsize=(8, 3))
```

<p align="center">
<img src="examples/nlp.svg">
</p>


## 6. Command Line Interface
The CLI supports parsing chat logs into csv files.
As of now, you **can't** create visualizations from the CLI directly.

Expand Down
Loading

0 comments on commit ba7bb91

Please sign in to comment.