Bringing NLP to notion.so with expert.ai.
Do you write your daily journal on Notion?
This app automatically add sentiment analysis, keyword extraction, and emotional traits to your journal entries.
See this live demo of a journal entry with NLP!
The main features of this app are:
- Sentiment analysis: score from -100 to 100
- Emotional traits: see list of emotions here
- Topic extraction: see list of topics here
- Automatic updates for new journal entries with Github Actions
Below is a sample entry of a bad day generated by texti.app
And here's a good day
Here are a couple of limitations of this app:
- journal entries must be in title
- properties must be created beforehand and must match spelling and capitalization, as well as property type
- keyword extraction is not great, some of them don't make sense
Get your Notion Token and database ID for your journal page by following this guide
Sign up for a developer account with expert.ai and save your username and password.
Save replace the placeholders with your credentials in .env.example
file.
NOTION_TOKEN=<NOTION_TOKEN>
NOTION_DATABASE_ID=<YOUR_JOURNAL_DATABASE_ID>
EAI_USERNAME=<YOUR_USERNAME>
EAI_PASSWORD=<YOUR_PASSWORD>
Rename .env.example
to .env
First, the page must have the following properties, note the spelling and capitalization must be exact.
date
- Datesentiment_score
- # numbertopics
- textemotions
- text
Below is an image of the properties
Next, make sure the journal entries have to be the title of the pages.
Create Conda environment
conda env create -n notion-nlp python=3.8
Activate the environment
conda activate notion-nlp
Install requirements
pip install -r requirements.txt
run the script
python main.py --all
You should see that your journal entires are now enriched with sentiment, topics and emotions like below
Tip: you can turn those topics and emotions into tags by switching it's property to multi_select
However, note that to add NLP info to future journal entries, you need to keep it as a text property.
add the secrets from .env
to your repo by going to Settings > Secrets > Actions > New repository secret
pip install -r requirements-dev.txt
pre-commit run --all-files
- therealexpertai/nlapi-python: Python Client for the expert.ai Natural Language API
- ramnes/notion-sdk-py: Official Notion SDK rewritten in Python
- Add tests
- Save api call results in MongoDB
- Build a streamlit app that visualizes knowledge graph of journal entries