Easy way to analyze your text.
18 |This is an open source project managed by Rohit Saini .
19 |├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── proposal.md
├── config.yml
└── pull_request_template.md
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── CONTRIBUTORS.md
├── LICENSE
├── Procfile
├── README.md
├── db.sqlite3
├── manage.py
├── mysite
├── __init__.py
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py
├── requirements.txt
├── screenshots
├── Find a word.png
├── Find image.png
├── Find images result page.png
├── Generate Password.png
├── Home.png
├── Password Generated.png
├── Remove punctuations.png
├── Text analyzer.png
└── word found or not found.png
├── static
├── css
│ ├── about.css
│ ├── analyze.css
│ ├── articles.css
│ ├── books.css
│ ├── home.css
│ ├── index.css
│ ├── index2.css
│ ├── style.css
│ └── youtube.css
├── images
│ └── favicon.png
└── js
│ └── Script.js
├── templates
├── about.html
├── analyze.html
├── articles.html
├── base.html
├── books.html
├── gallery.html
├── home.html
├── index.html
├── index2.html
├── pdf.html
└── youtube.html
├── textAnalyzer.sh
└── textanalyzer
├── __init__.py
├── admin.py
├── apps.py
├── migrations
├── 0001_initial.py
├── 0002_auto_20210323_1217.py
└── __init__.py
├── models.py
├── tests.py
├── urls.py
└── views.py
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | ----
12 | - A clear and concise description of what the bug is.
13 |
14 |
15 | **To Reproduce**
16 | ----
17 | - Steps to reproduce the behavior:
18 | 1. Go to '...'
19 | 2. Click on '....'
20 | 3. Scroll down to '....'
21 | 4. See error
22 |
23 | **Expected behavior**
24 | -----
25 | - A clear and concise description of what you expected to happen.
26 |
27 | **Possible solution**
28 | ----
29 | - Describe the solution you thought of.
30 |
31 | **Screenshots**
32 | ----
33 | - If applicable, add screenshots to help explain your problem.
34 |
35 | **Additional context**
36 | ----
37 | - Add any other context about the problem here.You can also mention your system environment in which you are running it.
38 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: feature
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | ----
12 | - A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13 |
14 | **Describe the solution you'd like**
15 | ----
16 | - A clear and concise description of what you want to happen.
17 |
18 | **Describe alternatives you've considered**
19 | ----
20 | - A clear and concise description of any alternative solutions or features you've considered.
21 |
22 | **Additional context**
23 | ----
24 | - Add any other context or screenshots about the feature request here.
25 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/proposal.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 💥 Proposal
3 | about: Propose a non-trivial change
4 | labels: "proposal"
5 | ---
6 |
7 | ## 💥 Proposal
8 |
9 | (A clear and concise description of what the proposal is.)
10 |
11 | ### Have you read the *Contributing Guidelines on Pull Requests* ?
12 |
13 | (Write your answer here.)
14 |
15 |
--------------------------------------------------------------------------------
/.github/config.yml:
--------------------------------------------------------------------------------
1 | # Configuration for welcome - https://github.com/behaviorbot/welcome
2 |
3 | # Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
4 | # Comment to be posted to on first time issues
5 |
6 | newIssueWelcomeComment: >
7 | Hello there!👋 Welcome to the project!🚀⚡
8 |
9 |
10 | Thank you and congrats🎉 for opening your very first issue in this project. Text Analyzer is used to perform some operations like capitalize, lower, upper and remove punctuation. This project is created using Django.
11 | Please adhere to our [Code of Conduct](https://github.com/rockingrohit9639/TextAnalyzer/blob/master/CODE_OF_CONDUCT.md).
12 | Please make sure not to start working on the issue, unless you get assigned to it.😄
13 |
14 |
15 | # Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
16 | # Comment to be posted to on PRs from first time contributors in your repository
17 |
18 | newPRWelcomeComment: >
19 | Hello there!👋 Welcome to the project!💖
20 |
21 |
22 | Thank you and congrats🎉 for opening your first pull request. Text Analyzer is used to perform some operations like capitalize, lower, upper and remove punctuation. This project is created using Django.
23 | Please adhere to our [Code of Conduct](https://github.com/rockingrohit9639/TextAnalyzer/blob/master/CODE_OF_CONDUCT.md).🙌🙌 We will get back to you as soon as we can 😄.
24 |
25 |
26 | # Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
27 | # Comment to be posted to on pull requests merged by a first time user
28 |
29 | firstPRMergeComment: >
30 | Congrats on merging your first pull request! 🎉 All the best for your amazing open source journey ahead 🚀.
31 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ## Related Issuse
2 | - Info about Issue or bug
3 |
4 | Closes: #[issue number that will be closed through this PR]
5 |
6 | #### Describe the changes you've made
7 | A clear and concise description of what you have done to successfully close your assigned issue. Any new files? or anything you feel to let us know!
8 |
9 | ## Type of change
10 |
11 |
15 | - [ ] Bug fix (non-breaking change which fixes an issue)
16 | - [ ] New feature (non-breaking change which adds functionality)
17 | - [ ] Code style update (formatting, local variables)
18 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
19 | - [ ] This change requires a documentation update
20 |
21 | ## How Has This Been Tested?
22 |
23 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
24 |
25 | #### Describe if there is any unusual behaviour of your code(Write `NA` if there isn't)
26 | A clear and concise description of it.
27 |
28 | ## Checklist:
29 |
33 | - [ ] My code follows the style guidelines of this project.
34 | - [ ] I have performed a self-review of my own code.
35 | - [ ] I have commented my code, particularly in hard-to-understand areas.
36 | - [ ] I have made corresponding changes to the documentation.
37 | - [ ] My changes generate no new warnings.
38 | - [ ] I have added tests that prove my fix is effective or that my feature works.
39 | - [ ] New and existing unit tests pass locally with my changes.
40 |
41 | ## Screenshots
42 |
43 | Original | Updated
44 | :--------------------: |:--------------------:
45 | **original screenshot** | updated screenshot |
46 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Django ###
2 | *.log
3 | *.pot
4 | *.pyc
5 | __pycache__/
6 | local_settings.py
7 | db.sqlite3
8 | db.sqlite3-journal
9 | media
10 |
11 | # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
12 | # in your Git repository. Update and uncomment the following line accordingly.
13 | #
97 |
98 |
7 | We are the makers/contributors of this project text analyzer where
8 | you can perform operations like capitalize, transform to lowercase/uppercase
9 | and remove punctuation. This is created using Python Django. It is
10 | completely open source hence you too can contribute anything to this project
11 | if you want. All your new ideas are welcome here, we will implement it
12 | together.
13 | {{ data.login }} You chose : {{purpose}} symbol at the top right corner.
37 |
38 | **2.** Clone the forked repository. Open terminal and type:
39 |
40 | ```bash
41 | git clone https://github.com/
99 | [](https://github.com/rockingrohit9639/TextAnalyzer.git)
100 |
101 |
](https://crosswoc.ieeedtu.in/)
27 |
28 | Join our [Discord](https://discord.gg/GycEMxYm) server for more details.
29 |
30 | # SCREENSHOTS
31 |
32 |
33 |
34 | ## HOME
35 |
36 |
37 |
38 | 
39 |
40 |
41 |
42 | ## Text Analyzer
43 |
44 |
45 |
46 | 
47 |
48 |
49 |
50 | ## Remove Punctuations
51 |
52 |
53 |
54 | 
55 |
56 |
57 |
58 | ## Find A Word
59 |
60 |
61 |
62 | 
63 |
64 |
65 |
66 | ## Word Found/Not Found
67 |
68 |
69 |
70 | 
71 |
72 |
73 |
74 | ## Find Images
75 |
76 |
77 |
78 | 
79 |
80 |
81 |
82 | ## Images Gallery
83 |
84 |
85 |
86 | 
87 |
88 |
89 |
90 | ## Generate A Password
91 |
92 |
93 |
94 | 
95 |
96 |
97 |
98 | ## Password Generator Result
99 |
100 |
101 |
102 | 
103 |
104 |
105 | ## Some awesome Contributors ✨
106 |
107 |
108 |
132 |
133 |
--------------------------------------------------------------------------------
/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/db.sqlite3
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 |
4 | def main():
5 | """Run administrative tasks."""
6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError as exc:
10 | raise ImportError(
11 | "Couldn't import Django. Are you sure it's installed and "
12 | "available on your PYTHONPATH environment variable? Did you "
13 | "forget to activate a virtual environment?"
14 | ) from exc
15 | execute_from_command_line(sys.argv)
16 |
17 | if __name__ == '__main__':
18 | main()
19 |
--------------------------------------------------------------------------------
/mysite/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/mysite/__init__.py
--------------------------------------------------------------------------------
/mysite/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for mysite project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/mysite/settings.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 | import os
3 |
4 | BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
5 |
6 | SECRET_KEY = 'iifx8c69qh&zr(tt*#y=@m9)+riru@w+z#uvt2!yda=s35579!'
7 |
8 | DEBUG = True
9 |
10 | ALLOWED_HOSTS = ['*']
11 |
12 |
13 | INSTALLED_APPS = [
14 | 'textanalyzer',
15 | 'django.contrib.admin',
16 | 'django.contrib.auth',
17 | 'django.contrib.contenttypes',
18 | 'django.contrib.sessions',
19 | 'django.contrib.messages',
20 | 'django.contrib.staticfiles',
21 | ]
22 |
23 | MIDDLEWARE = [
24 | 'django.middleware.security.SecurityMiddleware',
25 | 'whitenoise.middleware.WhiteNoiseMiddleware',
26 | 'django.contrib.sessions.middleware.SessionMiddleware',
27 | 'django.middleware.common.CommonMiddleware',
28 | 'django.middleware.csrf.CsrfViewMiddleware',
29 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
30 | 'django.contrib.messages.middleware.MessageMiddleware',
31 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
32 | ]
33 |
34 | ROOT_URLCONF = 'mysite.urls'
35 |
36 | TEMPLATES = [
37 | {
38 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
39 | 'DIRS': ['templates'],
40 | 'APP_DIRS': True,
41 | 'OPTIONS': {
42 | 'context_processors': [
43 | 'django.template.context_processors.debug',
44 | 'django.template.context_processors.request',
45 | 'django.contrib.auth.context_processors.auth',
46 | 'django.contrib.messages.context_processors.messages',
47 | ],
48 | },
49 | },
50 | ]
51 |
52 | WSGI_APPLICATION = 'mysite.wsgi.application'
53 |
54 | DATABASES = {
55 | 'default': {
56 | 'ENGINE': 'django.db.backends.sqlite3',
57 | 'NAME': BASE_DIR / 'db.sqlite3',
58 | }
59 | }
60 |
61 |
62 | AUTH_PASSWORD_VALIDATORS = [
63 | {
64 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
65 | },
66 | {
67 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
68 | },
69 | {
70 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
71 | },
72 | {
73 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
74 | },
75 | ]
76 |
77 | LANGUAGE_CODE = 'en-us'
78 |
79 | TIME_ZONE = 'UTC'
80 |
81 | USE_I18N = True
82 |
83 | USE_L10N = True
84 |
85 | USE_TZ = True
86 |
87 |
88 | STATIC_URL = '/static/'
89 | STATICFILES_DIRS = [
90 | os.path.join(BASE_DIR,'static')
91 | ]
92 |
93 | STATIC_ROOT = os.path.join(BASE_DIR,'staticfiles')
94 |
95 |
--------------------------------------------------------------------------------
/mysite/urls.py:
--------------------------------------------------------------------------------
1 | """mysite URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/3.1/topics/http/urls/
5 | """
6 |
7 | from django.contrib import admin
8 | from django.urls import path, include
9 | from django.conf import settings
10 | from django.conf.urls.static import static
11 |
12 | urlpatterns = [
13 | path("",include("textanalyzer.urls")),
14 | path('admin/', admin.site.urls),
15 | ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
--------------------------------------------------------------------------------
/mysite/wsgi.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from django.core.wsgi import get_wsgi_application
4 |
5 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
6 |
7 | application = get_wsgi_application()
8 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | Django==3.1.7
2 | heroku==0.1.4
3 | requests==2.23.0
4 | requests-oauthlib==1.3.0
5 | nltk
6 | gunicorn
7 | django_heroku
8 | bs4
9 | PyDictionary
10 | textblob
11 | gingerit==0.8.1
12 | python-youtube==0.7.0
13 | xhtml2pdf==0.2.5
14 | wordcloud==1.8.1
15 | date-extractor==5.1.5
16 | python-dateutil==2.8.1
17 |
--------------------------------------------------------------------------------
/screenshots/Find a word.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Find a word.png
--------------------------------------------------------------------------------
/screenshots/Find image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Find image.png
--------------------------------------------------------------------------------
/screenshots/Find images result page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Find images result page.png
--------------------------------------------------------------------------------
/screenshots/Generate Password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Generate Password.png
--------------------------------------------------------------------------------
/screenshots/Home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Home.png
--------------------------------------------------------------------------------
/screenshots/Password Generated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Password Generated.png
--------------------------------------------------------------------------------
/screenshots/Remove punctuations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Remove punctuations.png
--------------------------------------------------------------------------------
/screenshots/Text analyzer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/Text analyzer.png
--------------------------------------------------------------------------------
/screenshots/word found or not found.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/screenshots/word found or not found.png
--------------------------------------------------------------------------------
/static/css/about.css:
--------------------------------------------------------------------------------
1 | .about-section {
2 | width: 100%;
3 | height: 125vh;
4 | display: flex;
5 | flex-direction: column;
6 | margin-top: 3rem;
7 | align-items: center;
8 | padding: 4rem;
9 | box-sizing: border-box;
10 | }
11 |
12 | p{
13 | font-size: 20px;
14 | }
15 |
16 | .mentor h2{
17 | text-align: center;
18 | }
19 |
20 | .mentor a {
21 | margin-bottom: 20px;
22 | }
23 |
24 | .mentor a:hover {
25 | color: rgba(0, 0, 0, 0.53);
26 | font-size: 35px;
27 | }
28 |
29 | .contributors h2 {
30 | text-align: center;
31 | margin-bottom: 20px;
32 | margin-top: 30px;
33 | }
34 |
35 | .contributor {
36 | display: flex;
37 | justify-content: space-around;
38 | align-items: center;
39 | }
40 |
41 | .contributor img{
42 | width: 50px;
43 | height: 50px;
44 | margin-right: 15px;
45 | }
46 |
47 | table {
48 | display: flex;
49 | flex-wrap: wrap;
50 | justify-content: center;
51 | text-align: center;
52 | border-collapse: collapse;
53 | width: 900px;
54 | }
55 |
56 | tr {
57 | transition: all .2s ease-in;
58 | cursor: pointer;
59 | float: left;
60 | width: 33%;
61 | padding-right: 10px;
62 | background-color: var(--primary-color);
63 | color: var(--secondary-color);
64 | }
65 |
66 | td {
67 | padding: 12px;
68 | text-align: left;
69 | border-bottom: 1px solid #ddd;
70 | }
71 |
72 | tr:hover {
73 | background-color: var(--secondary-color);
74 | color: var(--primary-color);
75 | transform: scale(1.02);
76 | box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.2), -1px -1px 8px rgba(0, 0, 0, 0.2);
77 | }
78 |
79 | .contributor:hover a{
80 | color: var(--primary-color);
81 | }
--------------------------------------------------------------------------------
/static/css/analyze.css:
--------------------------------------------------------------------------------
1 | .analyze-result {
2 | width: 100%;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: center;
6 | align-items: center;
7 | padding: 4rem;
8 | margin-top: 5rem;
9 | }
--------------------------------------------------------------------------------
/static/css/articles.css:
--------------------------------------------------------------------------------
1 | .articles-section {
2 | width: 100%;
3 | height: 100vh;
4 | display: flex;
5 | flex-direction: column;
6 | margin-top: 6rem;
7 | align-items: center;
8 | }
9 |
10 | .ArticlesClass h2 {
11 | text-align: center;
12 | }
13 |
14 | tbody{
15 | display: flex;
16 | flex-wrap: wrap;
17 | justify-content: center;
18 | align-items: center;
19 | }
20 |
21 |
22 | .Articles {
23 | margin-top: 20px;
24 | margin-left: 20px;
25 | max-width: 26rem;
26 | display: grid;
27 | justify-content: space-around;
28 | align-items: center;
29 | padding: 15px;
30 | }
31 |
32 | .Articles:hover{
33 | border: 1px solid rgba(0, 0, 0, 0.5);
34 | border-radius: 5px;
35 | background: #30363d;
36 | box-shadow: 0 5px 14px -8px rgba(0, 0, 0, 0.5);
37 | }
38 |
39 | .Articles:hover a{
40 | color: #fff;
41 | }
42 |
43 | .Articles img{
44 | width: 50px;
45 | height: 50px;
46 | margin-right: 15px;
47 | }
48 |
49 | #btns{
50 | margin-bottom: 10px;
51 | }
52 |
--------------------------------------------------------------------------------
/static/css/books.css:
--------------------------------------------------------------------------------
1 | .books-section {
2 | width: 100%;
3 | height: 100vh;
4 | display: flex;
5 | flex-direction: column;
6 | margin-top: 5rem;
7 | align-items: center;
8 | padding: 20px;
9 | }
10 |
11 | .BooksClass h2 {
12 | text-align: center;
13 | }
14 |
15 | tbody{
16 | display: flex;
17 | flex-wrap: wrap;
18 | justify-content: center;
19 | align-items: center;
20 | }
21 |
22 |
23 | .Books {
24 | margin-top: 20px;
25 | margin-left: 20px;
26 | max-width: 26rem;
27 | display: grid;
28 | justify-content: space-around;
29 | align-items: center;
30 | padding: 15px;
31 | }
32 |
33 | .Books:hover{
34 | border: 1px solid rgba(0, 0, 0, 0.5);
35 | border-radius: 5px;
36 | background: #30363d;
37 | box-shadow: 0 5px 14px -8px rgba(0, 0, 0, 0.5);
38 | }
39 |
40 | .Books:hover a{
41 | color: #fff;
42 | }
43 |
44 | .Books img{
45 | width: 50px;
46 | height: 50px;
47 | margin-right: 15px;
48 | }
49 |
50 | #btns{
51 | margin-bottom: 10px;
52 | }
53 |
--------------------------------------------------------------------------------
/static/css/home.css:
--------------------------------------------------------------------------------
1 | .header {
2 | position: relative;
3 | width: 100%;
4 | height: 100vh;
5 | background: var(--primary-color);
6 | padding: 4rem;
7 | overflow: hidden;
8 | }
9 |
10 | .content {
11 | color: var(--secondary-color);
12 | margin-top: 10rem;
13 | }
14 |
15 | .content h4{
16 | font-size: 2rem;
17 | }
18 |
19 | .content p{
20 | color: var(--secondary-color);
21 | font-size: 15px;
22 | margin-top: 10px;
23 | }
24 |
25 | .buttons {
26 | display: flex;
27 | margin-top: 5rem;
28 | }
29 |
30 | .buttons a:nth-child(1){
31 | border: 2px solid var(--secondary-color);
32 | padding: 10px 20px;
33 | color: var(--secondary-color);
34 | font-weight: bold;
35 | border-radius: 0.3rem;
36 | transition: 0.5s;
37 | }
38 |
39 | .buttons a:nth-child(1):hover {
40 | color: var(--primary-color);
41 | background: var(--secondary-color);
42 | border: 2px solid var(--secondary-color);
43 | transform: scale(0.95,0.95);
44 | }
45 |
46 |
47 | .buttons a:nth-child(2){
48 | background-color: var(--secondary-color);
49 | border: 2px solid var(--secondary-color);
50 | color: var(--primary-color);
51 | padding: 12px 20px;
52 | margin-left: 10px;
53 | font-weight: bold;
54 | border-radius: 0.3rem;
55 | transition: 0.5s;
56 | }
57 |
58 | .buttons a:nth-child(2):hover{
59 | background: transparent;
60 | color: var(--secondary-color);
61 | border: 2px solid var(--secondary-color);
62 | transform: scale(0.95,0.95);
63 | }
64 |
65 | .header__right p{
66 | color: var(--secondary-color);
67 | font-size: 25rem;
68 | font-weight: 700;
69 | animation: skew 3s infinite alternate;
70 | }
71 |
72 | @media screen and (max-width: 768px) {
73 | .header__right, .header__left, .buttons{
74 | align-items: center;
75 | text-align: center;
76 | justify-content: center;
77 | }
78 |
79 | .header__left .content{
80 | margin-top: 5rem;
81 | }
82 |
83 | .header__right p{
84 | font-size: 15rem;
85 | font-weight: 600;
86 | /* margin-left: 2rem; */
87 | }
88 | }
89 |
90 | @keyframes skew {
91 | 0% {
92 | transform: skew(3deg, 3deg) translate(10px,30px) scale(0.8,0.8);
93 | color: grey;
94 | }
95 | 50%{
96 | transform: skew(0deg, 0deg) scale(1,1);
97 | color: white;
98 | }
99 | 100% {
100 | transform: skew(-3deg, -3deg) translate(-10px,-50px) scale(0.8,0.8);
101 | color: grey;
102 | }
103 | }
104 |
105 | .services, .contact {
106 | width: 100%;
107 | /* height: 100vh; */
108 | padding-top: 3rem;
109 | background: var(--secondary-color);
110 | }
111 |
112 | .services .top .icons, .contact .top .icons {
113 | display: flex;
114 | justify-content: space-evenly;
115 | padding: 5px;
116 | }
117 |
118 | .services .top h3, .contact .top h3 {
119 | text-align: center;
120 | font-weight: 600;
121 | font-size: 3rem;
122 | }
123 |
124 | .services .top .icons i, .contact .top .icons i {
125 | padding: 0 10px;
126 | font-size: 2rem;
127 | }
128 |
129 | .services .top .icons hr, .contact .top .icons hr {
130 | width: 10rem;
131 | height: 1px;
132 | color: var(--primary-color);
133 | }
134 |
135 | .cards {
136 | height: 60%;
137 | display: flex;
138 | justify-content: space-evenly;
139 | margin-top: 5rem;
140 | flex-wrap: wrap;
141 | }
142 |
143 | .card-s {
144 | width: 300px;
145 | height: 400px;
146 | background-color: var(--primary-color);
147 | color: var(--secondary-color);
148 | padding: 10px;
149 | text-align: center;
150 | margin-top: 0.5rem;
151 | margin-bottom: 0.5rem;
152 | display: block;
153 | transition: 0.3s ;
154 | border-radius: 1.5rem;
155 | }
156 |
157 | .card-s:hover{
158 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
159 | box-shadow: 10px 6px 20px 10px rgba(0, 0, 0, 0.2), 10px 6px 20px 10px rgba(0, 0, 0, 0.19);
160 | }
161 |
162 | .card-s h3{
163 | font-size: 1.5rem;
164 | padding: 10px;
165 | }
166 |
167 | .card-s .desc {
168 | height: 70%;
169 | padding: 50px;
170 | font-size: large;
171 | font-weight: 100;
172 | }
173 |
174 | .card-s a{
175 | background-color: var(--secondary-color);
176 | border: 2px solid var(--secondary-color);
177 | padding: 5px 35px;
178 | color: var(--primary-color);
179 | border-radius: 0.3rem;
180 | font-weight: bold;
181 | transition: 0.4s;
182 | }
183 |
184 | .card-s a:hover{
185 | background: transparent;
186 | color: var(--secondary-color);
187 | border: 2px solid var(--secondary-color);
188 | }
189 |
190 | /* contact-us */
191 | .contact-form{
192 | width: 100%;
193 | margin: auto;
194 | padding: 0 40px;
195 | margin-top: 50px;
196 | }
197 |
198 | /*common style class*/
199 | .base-form{
200 | width: 100%;
201 | height: 50px;
202 | margin: 10px 0;
203 | background-color: var(--primary-color);
204 | border: none;
205 | outline: none;
206 | padding: 20px;
207 | border-radius: 4px;
208 | color: var(--secondary-color);
209 | }
210 |
211 | /*isolates forms in div for easier styling.*/
212 | .parent-user-form{
213 | display: table;
214 | width: 100%;
215 | }
216 |
217 | /*makes the forms go side by side*/
218 | .child-user-form{
219 | display: table-cell;
220 | }
221 |
222 | /*styles for name*/
223 | .user-name{
224 | padding-right: 10px;
225 | }
226 |
227 | /*Required for aligning email field to end of message field*/
228 | .user-email{
229 | padding-left: 10px;
230 | }
231 |
232 | .messageZone{
233 | min-height: 200px;
234 | resize: vertical;
235 | }
236 |
237 | .contact-form .btn{
238 | width: 180px;
239 | padding: 10px 20px;
240 | color: var(--secondary-color);
241 | font-weight: bold;
242 | font-size: 16px;
243 | margin-left: auto;
244 | cursor: pointer;
245 | transition: .3s linear;
246 | }
247 |
248 | .contact-form .btn:hover{
249 | transform: scale(1.04);
250 | }
251 |
252 | .skewOne {
253 | display: block;
254 | position: absolute;
255 | bottom: -100%;
256 | left: 50%;
257 | width: 100%;
258 | height: 100%;
259 | background: var(--secondary-color);
260 | transform: skewY(-15deg);
261 | transform-origin: top left;
262 | }
263 |
264 |
265 | .skewTwo {
266 | position: absolute;
267 | bottom: -100%;
268 | right: 50%;
269 | width: 100%;
270 | height: 100%;
271 | background: var(--secondary-color);
272 | transform: skewY(15deg);
273 | transform-origin: top right;
274 | }
--------------------------------------------------------------------------------
/static/css/index.css:
--------------------------------------------------------------------------------
1 | .analyze-section {
2 | width: 100%;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: center;
6 | align-items: center;
7 | margin-top: 7rem;
8 | }
--------------------------------------------------------------------------------
/static/css/index2.css:
--------------------------------------------------------------------------------
1 | .generate-section {
2 | width: 100%;
3 | display: flex;
4 | flex-direction: column;
5 | justify-content: center;
6 | align-items: center;
7 | padding: 4rem;
8 | margin-top: 5rem;
9 | }
--------------------------------------------------------------------------------
/static/css/style.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css2?family=Mulish:wght@300&display=swap');
2 | * {
3 | margin: 0;
4 | padding: 0;
5 | box-sizing: border-box;
6 | font-family: 'Mulish', sans-serif;
7 | }
8 |
9 | body{
10 | display: flex;
11 | flex-direction: column;
12 | min-height: 100vh;
13 | }
14 |
15 | :root{
16 | --primary-color: #000;
17 | --secondary-color: #f2f2f2;
18 | }
19 |
20 | /* pre-loader */
21 | #loading{
22 | position: fixed;
23 | width: 100%;
24 | height: 100vh;
25 | background: #5c9dfb url('https://cdn.dribbble.com/users/1193395/screenshots/4348563/speed-data-search-loader.gif') no-repeat center;
26 | z-index: 999;
27 | }
28 |
29 | a {
30 | text-decoration: none;
31 | color: inherit;
32 | }
33 |
34 |
35 | #nav-heading{
36 | animation: text 3s steps(22) infinite alternate;
37 | animation: text 3s linear infinite alternate;
38 | overflow: hidden;
39 | white-space: nowrap;
40 | width: 100%;
41 | align-self: center;
42 | margin: auto;
43 | text-align: center;
44 | }
45 |
46 | @keyframes text{
47 | 0%{
48 | width: 0ch;
49 | }
50 | 100%{
51 | width: 11ch;
52 | }
53 | }
54 |
55 | .nav-bar {
56 | display: flex;
57 | justify-content: space-between;
58 | align-items: center;
59 | background-color: var(--primary-color);
60 | position: fixed;
61 | width: 100%;
62 | height: 4.5rem;
63 | color: var(--secondary-color);
64 | padding: 0 20px;
65 | border-bottom: 2px solid var(--secondary-color);
66 | z-index: 100;
67 | }
68 |
69 | a:hover {
70 | color: var(--secondary-color);
71 | }
72 |
73 |
74 | .footer {
75 | display: flex;
76 | justify-content: space-between;
77 | align-items: center;
78 | padding: 0 20px;
79 | background-color: var(--primary-color);
80 | color: var(--secondary-color);
81 | margin-top: auto;
82 | width: 100%;
83 | margin-top: 10px;
84 | }
85 |
86 | .footer__left {
87 | display: flex;
88 | flex-direction: column;
89 | padding: 10px;
90 | font-size: 14px;
91 | }
92 |
93 | .footer__right{
94 | border: 1px solid var(--secondary-color);
95 | width: 25px;
96 | height: 25px;
97 | display: flex;
98 | align-items: center;
99 | justify-content: center;
100 | cursor: pointer;
101 | }
102 |
103 | .footer__right p {
104 | padding-top: 15px;
105 | }
106 |
107 | .input-field{
108 | width: 100%;
109 | background-color: white;
110 | font-family: 'Poppins', sans-serif;
111 | padding: 10px;
112 | min-height: 100px;
113 | border-radius: 5px;
114 | resize: vertical;
115 | font-size: medium;
116 | }
117 |
118 | .form-input{
119 | width: 20px;
120 | height:20px;
121 | cursor: pointer;
122 | }
123 |
124 | .form-label{
125 | font-size: medium;
126 | }
127 |
128 | .button-container{
129 | display: flex;
130 | justify-content: space-around;
131 | align-items: center;
132 | flex-wrap: wrap;
133 | }
134 |
135 |
136 | button{
137 | width: 200px;
138 | height: 50px;
139 | outline: none;
140 | border: none;
141 | font-family: 'Poppins', sans-serif;
142 | background-color: black;
143 | color: white;
144 | font-size: medium;
145 | cursor: pointer;
146 | transition: all 0.2s;
147 | align-self: center;
148 | margin-top: 20px;
149 | }
150 |
151 |
152 | button:hover{
153 | background-color: rgba(153, 153, 153, 0.267);
154 | color: black;
155 | }
156 |
157 |
158 | button#btns{
159 | margin-left: 0.7em;
160 | margin-top: 3em;
161 | }
162 |
163 | button#btns2{
164 | margin-left: 4em;
165 | margin-top: 3em;
166 | }
167 | form{
168 | display: flex;
169 | flex-direction: column;
170 | width: 50vw;
171 |
172 | }
173 | .input-word{
174 | margin-top: 10px;
175 | border: 1px solid darkgray;
176 | width: 100%;
177 | background-color: white;
178 | font-family: 'Poppins', sans-serif;
179 | padding: 10px;
180 | min-height: 20px;
181 | border-radius: 5px;
182 | }
183 |
184 | #analyzed_text {
185 | color: rgba(252, 81, 95, 0.616);
186 | font-weight: 500;
187 | font-size: 2rem;
188 | word-wrap: break-word;
189 | white-space: pre-line;
190 | padding: 3rem;
191 | }
192 |
193 |
194 | .foo{
195 | width: 80%;
196 | color: var(--secondary-color);
197 | text-align: center;
198 | margin-bottom: 2rem;
199 | }
200 |
201 | .foo h5{
202 | font-size: 25px;
203 | margin-top: 10px;
204 | }
205 |
206 | .foo h5::after{
207 | content: "All of us do not have equal talent. But, all of us have an equal opportunity to develop our talents.";
208 | animation: textanim 10s linear infinite;
209 | }
210 |
211 | @keyframes textanim{
212 | 40%{
213 | content:'If you fail, never give up because FAIL means "First Attempt In Learning".' ;
214 | }
215 | 70%{
216 | content:"No matter what is the environment around you, it is always possible to maintain your brand of integrity." ;
217 | }
218 | }
219 |
--------------------------------------------------------------------------------
/static/css/youtube.css:
--------------------------------------------------------------------------------
1 | .youtube-section {
2 | width: 100%;
3 | height: 100vh;
4 | display: flex;
5 | flex-direction: column;
6 | margin-top: 5rem;
7 | align-items: center;
8 | padding: 20px;
9 | }
10 |
11 | .youtubers h2 {
12 | text-align: center;
13 | }
14 |
15 | tbody{
16 | display: flex;
17 | flex-wrap: wrap;
18 | justify-content: center;
19 | align-items: center;
20 | }
21 |
22 |
23 | .Channels {
24 | margin-top: 20px;
25 | margin-left: 20px;
26 | max-width: 200px;
27 | display: flex;
28 | justify-content: space-around;
29 | align-items: center;
30 | padding: 15px;
31 | }
32 |
33 | .Channels:hover{
34 | border: 1px solid rgba(0, 0, 0, 0.5);
35 | border-radius: 5px;
36 | background: #30363d;
37 | box-shadow: 0 5px 14px -8px rgba(0, 0, 0, 0.5);
38 | }
39 |
40 | .Channels:hover a{
41 | color: #fff;
42 | }
43 |
44 | .Channels img{
45 | width: 50px;
46 | height: 50px;
47 | margin-right: 15px;
48 | }
49 |
50 | #btns{
51 | margin-bottom: 10px;
52 | }
--------------------------------------------------------------------------------
/static/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rockingrohit9639/TextAnalyzer/6be2ff7df9ba487a54055307704b91be576d7942/static/images/favicon.png
--------------------------------------------------------------------------------
/static/js/Script.js:
--------------------------------------------------------------------------------
1 |
2 | function copyToClipboard(elementId) {
3 |
4 | // Create an auxiliary hidden input
5 | var aux = document.createElement("input");
6 |
7 | // Get the text from the element passed into the input
8 | aux.setAttribute("value", document.getElementById(elementId).innerHTML);
9 |
10 | // Append the aux input to the body
11 | document.body.appendChild(aux);
12 |
13 | // Highlight the content
14 | aux.select();
15 |
16 | // Execute the copy command
17 | document.execCommand("copy");
18 |
19 | // Remove the input from the body
20 | document.body.removeChild(aux);
21 | }
22 |
23 | console.log("This is injected")
24 |
25 |
26 |
27 | /*===== SCROLL REVEAL ANIMATION =====*/
28 | const sr = ScrollReveal({
29 | origin: 'top',
30 | distance: '80px',
31 | duration: 2000,
32 | reset: true
33 | })
34 |
35 | /*===== SCROLL REVEAL ANIMATION-CARDS =====*/
36 | sr.reveal('.generate-password', {})
37 | sr.reveal('.sentiment-analysis', {delay: 200})
38 | sr.reveal('.search-images', { delay: 400})
39 |
40 | /*===== SCROLL REVEAL ANIMATION-HEADER =====*/
41 | sr.reveal('.header__left', {origin:'left'})
42 | sr.reveal('.header__right', {origin:'right'})
43 |
44 |
45 | /*===== SCROLL REVEAL ANIMATION-CONTACT FORM =====*/
46 | sr.reveal('.contact-form', {})
47 | sr.reveal('.icons', {})
48 |
49 | /*===== SCROLL REVEAL ANIMATION-CONTRIBUTER =====*/
50 | sr.reveal('.user-names', {})
51 | sr.reveal('.rounded-circle', {delay: 200})
--------------------------------------------------------------------------------
/templates/about.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %} {% load static %} {% block content %}
2 |
3 |
4 |
5 |
109 |
111 |
110 |
Rohit Kumar Saini (Author)
💻
112 |
119 |
113 |
Akash20x
💻
114 |
Arbaz Alam
💻
115 |
Achyut Kumar Panda
💻
116 |
Shudhanshu Singh
💻
117 |
Muthu Annamalai.V
💻
118 |
Ayush Rastogi
💻
120 |
127 |
121 |
tharunc
💻
122 |
Amit Kumar Mishra
💻
123 |
Priya Nagda
💻
124 |
pranabprohit
💻
125 |
Ashutosh Kumar
💻
126 |
Yashasvi
💻
128 |
131 |
129 |
Mansi
💻
130 |
Yashasvi
💻Our Contributors
23 |
24 |
27 | {% for data in userData %}
28 |
47 | {% endif %}
48 |
29 |
45 | {% endfor %}
46 |
30 |
44 |
36 |
Text Analyzed Successfully 🎉
25 | Result :
27 |
28 | {% if highlight %}
29 | {{ highlight }}
30 | {% endif %}
31 |
32 | {{analyzed_text|safe}}
Words : {{ wordcount }}
81 | 82 | {% if analyze_text %} 83 | 84 | {% endif %} 85 | 86 | {% if generate_text %} 87 | 88 | {% endif %} 89 | 90 | 91 | 92 | 93 | {% endblock %} 94 | 95 | -------------------------------------------------------------------------------- /templates/articles.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% load static %} 4 | 5 | {% block content %} 6 | 7 | 8 | 9 | 10 |22 | 35 | | 36 |
22 |
23 |
33 | {{ i.title }} 29 |{{i.description_text}} 30 | 32 | |
34 |
This is an open source project managed by Rohit Saini .
19 |T.
29 |Generate a random password by entering some text.
58 |Analyze the sentiments of any text given by you.
70 |Search images for any word entered by you.
81 |Add your text below to perform desired operations on it
13 | 14 | 96 |14 | Add your text below to perform desired operations on it 15 |
16 | 61 | 62 |
22 |
23 |
33 | {{ i.channel_name }} 30 | 32 | |
34 |
' + html + '') 57 | return response 58 | 59 | 60 | def index(request): 61 | 62 | return render(request, 'home.html') 63 | 64 | def about(request): 65 | 66 | api_url='https://api.github.com/repos/rockingrohit9639/TextAnalyzer/contributors' 67 | 68 | response = requests.get(api_url).json() 69 | 70 | context = { 71 | "userData": response 72 | } 73 | 74 | return render(request, 'about.html', context) 75 | 76 | def youtube(request): 77 | api=Api(api_key="AIzaSyDHAS3sDLVtUqM1vx-kxykrBHMVSi0BLJI") 78 | query = request.session['user-input'] 79 | res=api.search_by_keywords(q=query,search_type=["channel"],count=25,limit=8) 80 | res=res.to_dict() 81 | res_items=res["items"] 82 | result=[] 83 | 84 | for data in res_items: 85 | temp={ 86 | "channel_name":data["snippet"]["title"], 87 | "channel_url":"https:/www.youtube.com/channel/"+str(data["snippet"]["channelId"]), 88 | "channel_logo":data["snippet"]["thumbnails"]["default"]["url"] 89 | } 90 | 91 | result.append(temp) 92 | 93 | context = { 94 | "result": result, 95 | "text":query 96 | } 97 | 98 | return render(request, 'youtube.html', context) 99 | 100 | def searchBook(request): 101 | GOOGLE_BOOKS_API_KEY="AIzaSyDmymOgoPKQZfhMmd3gd9Be-mM6cb8okeM" 102 | query = request.session['user-input'] 103 | payload = { 104 | "key": GOOGLE_BOOKS_API_KEY, 105 | "maxResults": 6, 106 | "q": query, 107 | } 108 | 109 | resp = requests.get("https://www.googleapis.com/books/v1/volumes", params=payload).json() 110 | res_items = resp["items"] 111 | arr=[] 112 | 113 | 114 | for data in res_items: 115 | try: 116 | temp={ 117 | 'title':data["volumeInfo"]["title"], 118 | 'link':data["volumeInfo"]["infoLink"], 119 | 'description_text':"".join(data["volumeInfo"]["description"].split(".")[0]), 120 | 'thumbnail':data["volumeInfo"]["imageLinks"]["smallThumbnail"], 121 | } 122 | except: 123 | temp={ 124 | 'title':data["volumeInfo"]["title"], 125 | 'link':data["volumeInfo"]["infoLink"], 126 | 'description_text':"Description Not Available", 127 | 'thumbnail':data["volumeInfo"]["imageLinks"]["smallThumbnail"], 128 | } 129 | 130 | arr.append(temp) 131 | 132 | context = { 133 | "result": arr, 134 | "text":query 135 | } 136 | 137 | return render(request, 'books.html', context) 138 | 139 | def articles(request): 140 | Base_string = "https://medium.com/tag/" 141 | query = request.session['user-input'] 142 | url=Base_string + query 143 | res = requests.get(url) 144 | soup = BeautifulSoup(res.text, 'html.parser') 145 | 146 | logo=[] 147 | writer=[] 148 | publisher=[] 149 | title=[] 150 | link=[] 151 | 152 | start = soup.find_all('div',class_='streamItem streamItem--postPreview js-streamItem') 153 | for span in start: 154 | start1=span.find_all('img')[0]['src'] 155 | logo.append(start1) 156 | start2=span.find_all('div',class_='postMetaInline postMetaInline-authorLockup ui-captionStrong u-flex1 u-noWrapWithEllipsis') 157 | for span2 in start2: 158 | start3=span2.find_all('a')[0].text 159 | writer.append(start3) 160 | start4=span2.find_all('a')[1].text 161 | publisher.append(start4) 162 | start5 = span.find_all('h3',class_='graf graf--h3 graf-after--figure graf--title') 163 | for span2 in start5: 164 | start6=span2.text.replace("\xa0",' ') 165 | title.append(start6) 166 | start7=span.find_all('a')[3]['href'] 167 | link.append(start7) 168 | 169 | myDict={"title":[],"writer":[],"publisher":[],"logo":[],"link":[]} 170 | myDict['title'].extend(title) 171 | myDict['writer'].extend(writer) 172 | myDict['publisher'].extend(publisher) 173 | myDict['logo'].extend(logo) 174 | myDict['link'].extend(link) 175 | 176 | arr2 = [] 177 | for i in range(0,7): 178 | try: 179 | temp = { 180 | "title": myDict["title"][i], 181 | "writer": myDict["writer"][i], 182 | "publisher": myDict["publisher"][i], 183 | "logo": myDict["logo"][i], 184 | "link":myDict["link"][i] 185 | } 186 | 187 | except: 188 | temp = { 189 | "title": "Not Available", 190 | "writer": " ", 191 | "publisher":" ", 192 | "logo": " ", 193 | "link":" " 194 | } 195 | 196 | arr2.append(temp) 197 | 198 | context = { 199 | "result": arr2, 200 | "text":query 201 | } 202 | 203 | return render(request, 'articles.html', context) 204 | 205 | 206 | def home(request): 207 | 208 | return render(request, 'index.html') 209 | 210 | 211 | def index2(request): 212 | 213 | return render(request, 'index2.html') 214 | 215 | def get_synonyms(word): 216 | try: 217 | synonyms=[] 218 | res = requests.get('https://www.merriam-webster.com/dictionary/'+word) 219 | soup = BeautifulSoup(res.text, 'lxml') 220 | containers=soup.findAll( 221 | 'ul',{'class':'mw-list'})[0].findAll('li') 222 | for con in containers: 223 | synonyms.append(con.find("a").text) 224 | return synonyms 225 | except: 226 | dictionary=PyDictionary() 227 | testdict=dictionary.synonym(word) 228 | return testdict 229 | 230 | def get_example(word): 231 | try: 232 | res = requests.get('https://www.merriam-webster.com/dictionary/'+word) 233 | soup = BeautifulSoup(res.text, 'lxml') 234 | containers=soup.find("div",{'class':'in-sentences'}).text 235 | example=' '.join(containers.split()).split('.')[3].strip() 236 | return example 237 | except: 238 | return None 239 | 240 | 241 | 242 | def get_words_dict(text): 243 | words_raw = text.split() 244 | words = {} 245 | for word in words_raw: 246 | if word in words: 247 | words[word] += 1 248 | else: 249 | words[word] = 1 250 | 251 | return {key: value for key, value in sorted(words.items(), key=lambda item: item[1], reverse=True)} 252 | 253 | def format_spaces(string1, string2, total_chars=40, min_spaces=1): 254 | num_spaces = total_chars - (len(str(string1)) + min_spaces) 255 | if num_spaces < min_spaces: 256 | num_spaces = min_spaces 257 | 258 | return str(string1) + " " * num_spaces + str(string2) 259 | 260 | def gallery(request): 261 | ACCESS_KEY = 'YBBd6J15p1YwXIV3THzl4Zt3eHiD3BGT8unud0VUNQo' 262 | place = request.session['user-input'] 263 | payload = { 264 | 'query': place, 265 | 'client_id': ACCESS_KEY, 266 | 'per_page': 40, 267 | } 268 | url = 'https://api.unsplash.com/search/photos' 269 | r = requests.get(url, params=payload).json() 270 | 271 | package = json.dumps(r, indent=2) 272 | arr = [] 273 | for data in r['results']: 274 | arr.append(data['urls']['regular']) 275 | 276 | place=place.upper()+":" 277 | context = { 278 | 'link': arr, 279 | 'text': place, 280 | } 281 | return render(request, 'gallery.html', context) 282 | 283 | 284 | 285 | def analyze(request): 286 | 287 | puncts = string.punctuation 288 | word_to_find = request.POST.get("word_input") 289 | djText = request.POST.get('text', 'default') 290 | remPunc = request.POST.get('option','removepunc') 291 | cap = request.POST.get('option','capitalize') 292 | small = request.POST.get('option','toSmall') 293 | upper = request.POST.get('option', 'toUpper') 294 | word_find_flag = request.POST.get('option','word_find') 295 | New_Line = request.POST.get('option','New_line') 296 | Emails= request.POST.get('option','Email_Address') 297 | Links = request.POST.get('option','Links') 298 | Passgen=request.POST.get('option', 'Password_Generator') 299 | search_word=request.POST.get('option', 'Search_word') 300 | gallery=request.POST.get('option', 'q') 301 | Suggest_word=request.POST.get('option', 'suggest_word') 302 | Sen_Analysis=request.POST.get('option', 'Sentiment') 303 | Grammar=request.POST.get('option','grammar') 304 | Channel=request.POST.get('option','suggest_youtube') 305 | books=request.POST.get('option','suggest_books') 306 | replace_input = request.POST.get("other") 307 | 308 | if len(djText)==0: 309 | context = { 310 | 'emptyText': True 311 | } 312 | return render(request, 'index.html', context) 313 | 314 | articles=request.POST.get('option','suggest_articles') 315 | lemmitizer=request.POST.get('option','grammar') 316 | start_pdf=request.POST.get('option','generate_pdf') 317 | replace_text = request.POST.get('option', 'replace') 318 | Word_cloud=request.POST.get('option','wordcloud') 319 | Date=request.POST.get('option','date') 320 | Word_frequency=request.POST.get('option','word_frequency') 321 | 322 | 323 | 324 | analyzed_text = "" 325 | word_status = "" 326 | 327 | countword = len(djText.split()) 328 | 329 | if word_find_flag == "word_find": 330 | if word_to_find != "": 331 | if djText.find(word_to_find) != -1: 332 | word_status = "found" 333 | word=djText.replace(word_to_find,f""""""+word_to_find+"") 334 | djText=word 335 | 336 | try: 337 | synonym_01=get_synonyms(word_to_find) 338 | synonyms2=random.sample(synonym_01,4) 339 | 340 | final="" 341 | for f in synonyms2: 342 | final+=f+" , " 343 | 344 | example=get_example(word_to_find) 345 | 346 | synonyms=final+example 347 | 348 | except: 349 | synonyms="Not Available" 350 | 351 | else: 352 | word_status = "not found" 353 | synonyms="Text Not Found" 354 | 355 | analyzed_text = djText 356 | word_find="Find Word = " + word_to_find 357 | synonym=format_html('{}','green',synonyms) 358 | 359 | result = { 360 | "analyzed_text": analyzed_text, 361 | "highlight":"Chosen word is highlighted in red colour and synonyms/examples in green colour", 362 | "purpose": word_find, 363 | "status": word_status, 364 | "synonym":synonym, 365 | "wordcount": countword, 366 | "analyze_text":True, 367 | "findWord":True 368 | } 369 | 370 | 371 | elif New_Line == "New_line": 372 | for char in djText: 373 | if char == '.': 374 | char='\n'; 375 | analyzed_text = analyzed_text + char 376 | result = { 377 | "analyzed_text": analyzed_text, 378 | "purpose": "Changes '.' to New Line", 379 | "analyze_text":True, 380 | "wordcount": countword 381 | } 382 | elif Emails == "Email_Address": 383 | regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$' 384 | lst= re.findall('\S+@+\S+', djText) 385 | tmp="" 386 | for x in lst: 387 | if(re.search(regex,x)): 388 | tmp+=x 389 | tmp+='\n' 390 | result = { 391 | "analyzed_text": tmp, 392 | "purpose": "Find All Emails", 393 | "analyze_text":True, 394 | "wordcount": countword 395 | } 396 | 397 | elif Passgen=="Password_Generator": 398 | stop_words = set(stopwords.words('english')) 399 | chars = "!£$%&*#@" 400 | ucase_letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 401 | text = re.sub(r'[^\w\s]', '', djText) 402 | token = word_tokenize(text) 403 | 404 | filtered_sentence = [] 405 | 406 | for w in token: 407 | if w not in stop_words: 408 | filtered_sentence.append(w) 409 | 410 | if len(filtered_sentence) > 0: 411 | random_word = random.choice(filtered_sentence) 412 | else: 413 | random_word = token[0] 414 | 415 | random_word=random_word.title() 416 | 417 | merge="" 418 | for word in random_word.split(): 419 | merge+=random.choice(chars)+word[:-1]+ word[-1].upper()\ 420 | +random.choice(string.ascii_letters)+"@"+random.choice(ucase_letters)\ 421 | +random.choice(string.digits)+" " 422 | final_text=merge[:-1] 423 | result = { 424 | "analyzed_text": final_text, 425 | "purpose": "Generate password from text", 426 | "generate_text":True, 427 | "wordcount": countword 428 | } 429 | 430 | elif search_word=="Search_word": 431 | url = 'https://www.dictionary.com/browse/' 432 | headers = requests.utils.default_headers() 433 | headers.update({ 434 | 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36' 435 | }) 436 | req = requests.get(url+djText, headers) 437 | soup = BeautifulSoup(req.content, 'html.parser') 438 | mydivs = soup.findAll("div", {"value": "1"})[0] 439 | for tags in mydivs: 440 | meaning = tags.text 441 | wrap = textwrap.TextWrapper(width=100) 442 | word_meaning = wrap.fill(text=meaning) 443 | result = { 444 | "analyzed_text": word_meaning, 445 | "purpose": "Searched Word", 446 | "generate_text":True, 447 | "wordcount": countword 448 | } 449 | 450 | 451 | elif Suggest_word=="suggest_word": 452 | find = requests.get(f"https://www.dictionaryapi.com/api/v3/references/thesaurus/json/{djText}?key={api_key}") 453 | response = find.json() 454 | 455 | if len(response) == 0: 456 | print("Word Not Recognized!") 457 | else: 458 | k=[] 459 | if str(response[0]).count(" ") == 0: 460 | for j in range(len(response)): 461 | k.append(response[j]) 462 | predict=" , ".join(k) 463 | djText=predict 464 | 465 | else: 466 | dictionary=PyDictionary() 467 | testdict=dictionary.synonym(djText) 468 | suggest=" , ".join(testdict) 469 | djText=suggest 470 | wrap = textwrap.TextWrapper(width=100) 471 | suggest = wrap.fill(text=djText) 472 | 473 | result = { 474 | "analyzed_text": suggest, 475 | "purpose": "Suggested Word", 476 | "generate_text":True, 477 | "wordcount": countword 478 | } 479 | 480 | elif Sen_Analysis=="Sentiment": 481 | 482 | djText=' '.join(re.sub("(@[A-Za-z0-9]+)|([^0-9A-Za-z \t])|(\w+:\/\/\S+)", " ", djText).split()) 483 | 484 | analysis = TextBlob(djText) 485 | # set sentiment 486 | if analysis.sentiment.polarity > 0: 487 | final=str(djText)+" (Positive Text)" 488 | elif analysis.sentiment.polarity == 0: 489 | final=str(djText)+" (Neutral Text)" 490 | else: 491 | final=str(djText)+" (Negative Text)" 492 | 493 | result = { 494 | "analyzed_text": final, 495 | "purpose": "Sentiment Analysis", 496 | "analyze_text":True, 497 | "wordcount": countword 498 | } 499 | 500 | elif Grammar=="grammar": 501 | parser = GingerIt() 502 | result = parser.parse(djText) 503 | final=result["result"] 504 | 505 | if final=='': 506 | final="Please write some text to check grammar" 507 | 508 | result = { 509 | "analyzed_text": final, 510 | "grammar":djText, 511 | "purpose": "Spelling & Grammar Check", 512 | "analyze_text":True, 513 | "wordcount": countword 514 | } 515 | 516 | elif lemmitizer=="lemmitize": 517 | wordnet_lemmatizer = WordNetLemmatizer() 518 | tokenization = nltk.word_tokenize(djText) 519 | count=True 520 | for w in tokenization: 521 | k=wordnet_lemmatizer.lemmatize(w,pos ="v") 522 | if w!=k: 523 | result="{} -> {}".format(w, wordnet_lemmatizer.lemmatize(w,pos ="v")) 524 | count=False 525 | if count==True: 526 | final="No need for lemmatization" 527 | if count==False: 528 | final="(Original word) - > (Lemmatized word)" 529 | 530 | result = { 531 | "analyzed_text": result, 532 | "highlight":final, 533 | "purpose": "Lemmatization of text", 534 | "analyze_text":True, 535 | "wordcount": countword 536 | } 537 | 538 | 539 | elif Channel=="suggest_youtube": 540 | request.session['user-input']=djText 541 | result = { 542 | "analyzed_text": djText, 543 | "purpose":"Suggest youtube channels", 544 | "status": "Press Button To View Channel links", 545 | "find_channel": True, 546 | "generate_text":True, 547 | "wordcount": countword 548 | } 549 | 550 | elif books=="suggest_books": 551 | request.session['user-input']=djText 552 | result = { 553 | "analyzed_text": djText, 554 | "purpose":"Search Books", 555 | "status": "Press Button To View Books", 556 | "find_books": True, 557 | "generate_text":True, 558 | "wordcount": countword 559 | } 560 | 561 | 562 | elif articles=="suggest_articles": 563 | request.session['user-input']=djText 564 | result = { 565 | "analyzed_text": djText, 566 | "purpose":"Search Articles", 567 | "status": "Press Button To View Articles", 568 | "find_articles": True, 569 | "generate_text":True, 570 | "wordcount": countword 571 | } 572 | 573 | elif start_pdf=="generate_pdf": 574 | request.session['user-input']=djText 575 | result = { 576 | "analyzed_text": "Check Your Pdf", 577 | "purpose":"Generate Pdf", 578 | "status": "Press Button To View Pdf", 579 | "make_pdf": True, 580 | "generate_text":True, 581 | "wordcount": countword 582 | } 583 | 584 | elif replace_text == "replace": 585 | final_text = re.sub(word_to_find, replace_input, djText) 586 | result = { 587 | "analyzed_text": final_text, 588 | "purpose": "Replacemet of text in sentence", 589 | "analyze_text":True, 590 | "wordcount": countword 591 | } 592 | 593 | elif Word_cloud=="wordcloud": 594 | cloud=WordCloud(background_color="white",max_words=200,stopwords=set(STOPWORDS)) 595 | wc=cloud.generate(djText) 596 | buf=io.BytesIO() 597 | wc.to_image().save(buf,format="png") 598 | data=base64.b64encode(buf.getbuffer()).decode("utf8") 599 | final="data:image/png;base64,{}".format(data) 600 | 601 | result = { 602 | "analyzed_text":" ", 603 | "purpose":"Wordcloud", 604 | "my_wordcloud": final, 605 | "generate_text":True, 606 | "wordcount": countword 607 | } 608 | 609 | elif Date=="date": 610 | final=extract_dates(djText) 611 | final_text=final[0].date() 612 | 613 | result = { 614 | "analyzed_text": final_text, 615 | "purpose": "Extract Dates from text", 616 | "analyze_text":True, 617 | "wordcount": countword 618 | } 619 | 620 | elif Word_frequency=="word_frequency": 621 | input_text = djText.replace("\n", " ") 622 | djText = input_text.lower() 623 | 624 | words_dict = get_words_dict(djText) 625 | # create graph 626 | if len(words_dict)>10: 627 | k=10 628 | else: 629 | k=len(words_dict) 630 | 631 | y_pos = range(0, k) 632 | bars = [] 633 | height = [] 634 | count=0 635 | 636 | # print and save values to graph 637 | format_spaces("word", "occurrences") 638 | for word_str, word_amount in words_dict.items(): 639 | format_spaces(word_str, word_amount) 640 | count+=1 641 | if count<=10: 642 | bars.append(word_str) 643 | height.append(int(word_amount)) 644 | else: 645 | pass 646 | 647 | # # Create bars 648 | plt.bar(y_pos, height) 649 | 650 | # Create names on the x-axis 651 | plt.xticks(y_pos, bars, size=9) 652 | 653 | plt.xticks(rotation='horizontal') 654 | plt.ylabel('Word Frequency',fontsize=12,labelpad=10) 655 | plt.xlabel('Words',fontsize=12,labelpad=10) 656 | 657 | fig=plt.gcf() 658 | 659 | buf=BytesIO() 660 | fig.savefig(buf,format='png') 661 | buf.seek(0) 662 | data=base64.b64encode(buf.read()) 663 | uri=urllib.parse.quote(data) 664 | final="data:image/png;base64,{}".format(uri) 665 | 666 | result = { 667 | "analyzed_text": " ", 668 | "purpose": "Word Frequency for every word in text", 669 | "bar_graph": final, 670 | "analyze_text":True, 671 | "wordcount": countword 672 | } 673 | 674 | 675 | elif gallery=="q": 676 | request.session['user-input']=djText 677 | result = { 678 | "analyzed_text": djText, 679 | "purpose":"Images", 680 | "status": "Press Button To View Images", 681 | "find_image": True, 682 | "generate_text":True, 683 | "wordcount": countword 684 | } 685 | 686 | elif remPunc == 'removepunc': 687 | for char in djText: 688 | if char not in puncts: 689 | analyzed_text = analyzed_text + char 690 | result = { 691 | "analyzed_text": analyzed_text, 692 | "purpose": "Remove Punctuations", 693 | "analyze_text":True, 694 | "wordcount": countword 695 | } 696 | elif cap == "capitalize": 697 | analyzed_text = djText.capitalize() 698 | 699 | result = { 700 | "analyzed_text": analyzed_text, 701 | "purpose": "Capitalize", 702 | "analyze_text":True, 703 | "wordcount": countword 704 | } 705 | 706 | elif small == "toSmall": 707 | analyzed_text = djText.lower() 708 | 709 | result = { 710 | "analyzed_text": analyzed_text, 711 | "purpose": "To Smallercase", 712 | "analyze_text":True, 713 | "wordcount": countword 714 | } 715 | 716 | elif upper == "toUpper": 717 | analyzed_text = djText.upper() 718 | 719 | result = { 720 | "analyzed_text": analyzed_text, 721 | "purpose": "To Uppercase", 722 | "analyze_text":True, 723 | "wordcount": countword 724 | } 725 | elif Links == "Links": 726 | pattern = '(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])' 727 | links = re.findall(pattern, djText, re.IGNORECASE) 728 | analyzed_text="" 729 | 730 | i = 0 731 | for x in links: 732 | i = i + 1 733 | analyzed_text+=f'Link {i}' 734 | analyzed_text+='\n ' 735 | 736 | result = { 737 | "analyzed_text": analyzed_text, 738 | "purpose": "Find All Links", 739 | "analyze_text":True, 740 | "wordcount": countword 741 | } 742 | 743 | else: 744 | return HttpResponse('''''') 745 | 746 | return render(request, 'analyze.html', result) 747 | 748 | 749 | def contact(request): 750 | if request.method=="POST": 751 | name=request.POST['Name'] 752 | email=request.POST['Email'] 753 | message=request.POST['Message'] 754 | user = User_profile.objects.create(name=name,email=email,message=message) 755 | user.save() 756 | return render(request,"home.html") 757 | 758 | --------------------------------------------------------------------------------