setup textblob for sentiment analysis
This commit is contained in:
parent
82787cc428
commit
4e1e586123
@ -8,7 +8,7 @@ Head to https://www.originprotocol.com/developers to learn more about what we're
|
|||||||
- Bans users for posting messagses matching specified patterns
|
- Bans users for posting messagses matching specified patterns
|
||||||
- Bans users with usernames matching specified patterns
|
- Bans users with usernames matching specified patterns
|
||||||
- Records logs of converstations
|
- Records logs of converstations
|
||||||
- Translates foreign languages to English using Google Translate
|
- Logs an English translation of any foreign languages using Google Translate
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
19
bin/install_textblob_corpora
Normal file
19
bin/install_textblob_corpora
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source $BIN_DIR/utils
|
||||||
|
|
||||||
|
echo "-----> Starting corpora installation"
|
||||||
|
|
||||||
|
# Assumes NLTK_DATA environment variable is already set
|
||||||
|
# $ heroku config:set NLTK_DATA='/app/nltk_data'
|
||||||
|
|
||||||
|
# Install the default corpora to NLTK_DATA directory
|
||||||
|
python -m textblob.download_corpora
|
||||||
|
|
||||||
|
# Open the NLTK_DATA directory
|
||||||
|
cd ${NLTK_DATA}
|
||||||
|
|
||||||
|
# Delete all of the zip files in the NLTK DATA directory
|
||||||
|
find . -name "*.zip" -type f -delete
|
||||||
|
|
||||||
|
echo "-----> Finished corpora installatio"
|
9
bin/post_compile
Normal file
9
bin/post_compile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -f bin/install_textblob_corpora ]; then
|
||||||
|
echo "-----> Running install_textblob_corpora"
|
||||||
|
chmod +x bin/install_textblob_corpora
|
||||||
|
bin/install_textblob_corpora
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "-----> Post-compile done"
|
3
model.py
3
model.py
@ -30,9 +30,10 @@ class Message(Base):
|
|||||||
language_code = Column(String)
|
language_code = Column(String)
|
||||||
english_message = Column(String)
|
english_message = Column(String)
|
||||||
chat_id = Column(BigInteger)
|
chat_id = Column(BigInteger)
|
||||||
|
polarity = Column(Numeric)
|
||||||
|
subjectivity = Column(Numeric)
|
||||||
time = Column(DateTime, default=func.now())
|
time = Column(DateTime, default=func.now())
|
||||||
|
|
||||||
|
|
||||||
class MessageHide(Base):
|
class MessageHide(Base):
|
||||||
__tablename__ = 'telegram_message_hides'
|
__tablename__ = 'telegram_message_hides'
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
|
@ -4,3 +4,4 @@ SQLAlchemy==1.2.2
|
|||||||
configparser==3.5.0
|
configparser==3.5.0
|
||||||
Unidecode==1.0.22
|
Unidecode==1.0.22
|
||||||
googletrans==2.4.0
|
googletrans==2.4.0
|
||||||
|
textblob
|
||||||
|
Loading…
Reference in New Issue
Block a user