├── Procfile ├── demo └── demo.gif ├── example.docx ├── asset └── logo.png ├── requirements.txt ├── debug.log ├── setup.sh ├── README.md └── app.py /Procfile: -------------------------------------------------------------------------------- 1 | web: sh setup.sh && streamlit run app.py -------------------------------------------------------------------------------- /demo/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meshachdamilare/NLPify-app/HEAD/demo/demo.gif -------------------------------------------------------------------------------- /example.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meshachdamilare/NLPify-app/HEAD/example.docx -------------------------------------------------------------------------------- /asset/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meshachdamilare/NLPify-app/HEAD/asset/logo.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | nltk==3.5 2 | gensim==3.8.3 3 | sumy==0.8.1 4 | streamlit==0.70.0 5 | textblob==0.15.3 6 | -------------------------------------------------------------------------------- /debug.log: -------------------------------------------------------------------------------- 1 | [1202/064359.248:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) 2 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | 2 | mkdir -p ~/.streamlit/ 3 | echo "\ 4 | [general]\n\ 5 | email = \"meshacholuwadamilare@gmail.com\"\n\ 6 | " > ~/.streamlit/credentials.toml 7 | echo "\ 8 | [server]\n\ 9 | headless = true\n\ 10 | enableCORS=false\n\ 11 | port = $PORT\n\ 12 | " > ~/.streamlit/config.toml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## NLPify-app 2 | 3 | **A simple NLP app built with streamlit.** 4 | 5 | The app offers the following: 6 | 7 | - Get tokens of your text 8 | - Get Named Entities of your text 9 | - Get Sentiment analysis of your text 10 | - Get summary of your text 11 | 12 | ## App link 13 | [App url](https://nlpify-app.herokuapp.com/) 14 | 15 | ### App Demo 16 | ![App demo](demo/demo.gif) 17 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | #nltk pkg 3 | import nltk 4 | nltk.download('punkt') 5 | nltk.download('wordnet') 6 | 7 | from textblob import TextBlob 8 | # gensim pkg 9 | from gensim.summarization import summarize 10 | # sumy pkg 11 | from sumy.parsers.plaintext import PlaintextParser 12 | from sumy.nlp.tokenizers import Tokenizer 13 | from sumy.summarizers.lex_rank import LexRankSummarizer 14 | 15 | 16 | def text_analyzer(my_text): 17 | blob = TextBlob(my_text) 18 | zen = blob.words 19 | all_data = ["Tokens: {}, \n Lemma: {}".format(z, z.lemmatize()) for z in zen] 20 | return all_data 21 | 22 | def sumy_sumarizer(docx): 23 | parser = PlaintextParser.from_string(docx, Tokenizer('english')) 24 | lex_summarizer = LexRankSummarizer() 25 | summary = lex_summarizer(parser.document, 3) 26 | summary_list = [str(sentence) for sentence in summary] 27 | result = " ".join(summary_list) 28 | return result 29 | 30 | def main(): 31 | 32 | st.title("NLP-ify with streamlit") 33 | st.subheader("Natural Language Processing on a go") 34 | 35 | # Tokenization 36 | if st.checkbox("Show Tokens and Lemmatization"): 37 | st.subheader("Tokenize your text") 38 | message = st.text_area("Enter Your Text", "Type Here", key = "1") 39 | if st.button("Analyze", key = "1"): 40 | nlp_result = text_analyzer(message) 41 | st.json(nlp_result) 42 | 43 | 44 | # Sentiment Analysis 45 | if st.checkbox("Show Sentiment Analysis"): 46 | st.subheader("Sentiment of Your Text") 47 | message = st.text_area("Enter Your Text", "Type Here", key = "2") 48 | if st.button("Analyze", key ='2'): 49 | blob = TextBlob(message) 50 | result_sentiment = blob.sentiment 51 | st.success(result_sentiment) 52 | 53 | # Text Summarization 54 | 55 | if st.checkbox("Show Text Summarization"): 56 | st.subheader("Summarize Your Text") 57 | message = st.text_area("Enter Your Text", "Type Here", key = "3") 58 | summary = st.selectbox("Choose your summarizer", ('gensim', 'sumy')) 59 | if st.button("Summarize", key='3'): 60 | if summary == 'gensim': 61 | try: 62 | st.text("Using Gensim...") 63 | summary_result = summarize(message) 64 | st.success(summary_result) 65 | except ValueError: 66 | st.error("Input must have more than one sentence.") 67 | elif summary == 'sumy': 68 | try: 69 | st.text("Using Sumy...") 70 | summary_result = sumy_sumarizer(message) 71 | st.success(summary_result) 72 | except: 73 | st.error("Input correct things.") 74 | 75 | st.sidebar.subheader('About the App') 76 | st.sidebar.markdown('## NLP-ify App with Streamlit') 77 | st.sidebar.info("#### Get the Tokens of your text") 78 | st.sidebar.info("#### Get the Named-Entities of your text") 79 | st.sidebar.info("#### Get the Sentiment Analysis of your text") 80 | st.sidebar.info("#### Get the Summary of your text") 81 | 82 | if __name__ == '__main__': 83 | main() 84 | --------------------------------------------------------------------------------