Welcome to autotweet’s documentation!¶
Contents:
autotweet
— Library for machine learning your tweet¶
autotweet.answer
— Answering module¶
This module can auto answering to mentions to you or auto mentioning to others tweet.
autotweet.command
— CLI interface¶
This module provides command line interface.
autotweet.database
— Database structure¶
This module provides methods to get session, get answer, etc.
-
exception
autotweet.database.
NoAnswerError
(msg)¶ Raises when autotweet can not found best answer to a question.
Parameters: msg ( str
) – A message for the exception
-
autotweet.database.
get_count
(session)¶ Get count of
Document
.Parameters: session ( sqlalchemt.orm.Session
) – DB session
-
autotweet.database.
get_session
(url)¶ Get db session.
Parameters: url ( str
) – URL for connect with DBReturns: A sqlalchemy db session Return type: sqlalchemy.orm.Session
-
autotweet.database.
add_document
(session, question, answer)¶ Add question answer set to DB.
Parameters:
-
autotweet.database.
get_best_answer
(session, query)¶ Get best answer to a question.
Parameters: - session (
sqlalchemt.orm.Session
) – DB session - query (
str
) – A question to get an answer
Returns: An answer to a question
Return type: Raises: NoAnswerError
when can not found answer to a question- session (
-
autotweet.database.
recreate_grams
(session)¶ Re-create grams for database.
In normal situations, you never need to call this method. But after migrate DB, this method is useful.
Parameters: session ( sqlalchemt.orm.Session
) – DB session
-
autotweet.database.
recalc_idfs
(session, grams=None)¶ Re-calculate idfs for database.
calculating idfs for gram is taking long time. So I made it calculates idfs for some grams. If you want make accuracy higher, use this with grams=None.
Parameters: - session (
sqlalchemt.orm.Session
) – DB session - grams (A set of
Gram
) – grams that you want to re-calculating idfs
- session (
autotweet.learn
— Learning your tweets¶
This module learns your tweets and store it to database.
autotweet.twitter
— Twitter utilities¶
This module contains Twitter API key and some useful methods.
-
autotweet.twitter.
CONSUMER_KEY
= '62yWrV2RhpGgWOKlqvJPNQ'¶ Consumer key for autoweet.
-
autotweet.twitter.
CONSUMER_SECRET
= 'Je6NLI7AN3c1BJP9kHaq1p8GBkMyKs5GhX954dWJ6I'¶ Consumer secret key for autotweet.
Authorize to twitter.
Use PIN authentification.
Returns: Token for authentificate with Twitter. Return type: autotweet.twitter.OAuthToken