├── .gitignore ├── Comparison V1.0 ├── ComparisonModule │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── myapp │ ├── admin.py │ ├── apps.py │ ├── models.py │ ├── static │ │ ├── Chart.bundle.js │ │ ├── bootstrap.min.js │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap-theme.css │ │ │ ├── bootstrap-theme.css.map │ │ │ ├── bootstrap-theme.min.css │ │ │ ├── bootstrap-theme.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ ├── bootstrap.min.css.map │ │ │ └── myapp.css │ │ ├── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ ├── bootstrap.min.js.map │ │ │ └── npm.js │ │ └── styles │ │ │ └── bootstrap.min.css │ ├── templates │ │ └── myapp │ │ │ └── Comparison_Form.html │ ├── tests.py │ ├── urls.py │ └── views.py └── readme.md ├── Haystack-with-Whoosh-Search ├── README.md ├── db.sqlite3 ├── haystack │ ├── __init__.py │ ├── __init__.pyc │ ├── admin.py │ ├── admin.pyc │ ├── backends │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── elasticsearch_backend.py │ │ ├── simple_backend.py │ │ ├── solr_backend.py │ │ ├── whoosh_backend.py │ │ └── whoosh_backend.pyc │ ├── constants.py │ ├── constants.pyc │ ├── exceptions.py │ ├── exceptions.pyc │ ├── fields.py │ ├── fields.pyc │ ├── forms.py │ ├── forms.pyc │ ├── indexes.py │ ├── indexes.pyc │ ├── inputs.py │ ├── inputs.pyc │ ├── management │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ └── commands │ │ │ ├── __init__.py │ │ │ ├── __init__.pyc │ │ │ ├── build_solr_schema.py │ │ │ ├── clear_index.py │ │ │ ├── clear_index.pyc │ │ │ ├── haystack_info.py │ │ │ ├── rebuild_index.py │ │ │ ├── rebuild_index.pyc │ │ │ ├── update_index.py │ │ │ └── update_index.pyc │ ├── manager.py │ ├── manager.pyc │ ├── models.py │ ├── models.pyc │ ├── panels.py │ ├── query.py │ ├── query.pyc │ ├── routers.py │ ├── routers.pyc │ ├── signals.py │ ├── signals.pyc │ ├── templates │ │ ├── panels │ │ │ └── haystack.html │ │ └── search_configuration │ │ │ └── solr.xml │ ├── templatetags │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── highlight.py │ │ └── more_like_this.py │ ├── urls.py │ ├── urls.pyc │ ├── utils │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── app_loading.py │ │ ├── app_loading.pyc │ │ ├── decorators.py │ │ ├── geo.py │ │ ├── highlighting.py │ │ ├── highlighting.pyc │ │ ├── loading.py │ │ ├── loading.pyc │ │ ├── log.py │ │ └── log.pyc │ ├── views.py │ └── views.pyc ├── manage.py ├── templates │ └── search │ │ ├── indexes │ │ └── testapp │ │ │ └── note_text.txt │ │ └── search.html ├── testapp │ ├── __init__.py │ ├── __init__.pyc │ ├── admin.py │ ├── admin.pyc │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0001_initial.pyc │ │ ├── __init__.py │ │ └── __init__.pyc │ ├── models.py │ ├── models.pyc │ ├── search_indexes.py │ ├── search_indexes.pyc │ ├── tests.py │ └── views.py ├── testhystack │ ├── __init__.py │ ├── __init__.pyc │ ├── settings.py │ ├── settings.pyc │ ├── urls.py │ ├── urls.pyc │ ├── whoosh_index │ │ ├── MAIN_WRITELOCK │ │ ├── MAIN_xb0ro8ioy77cv3fz.seg │ │ └── _MAIN_2.toc │ ├── wsgi.py │ └── wsgi.pyc └── whoosh │ ├── __init__.py │ ├── __init__.pyc │ ├── analysis │ ├── __init__.py │ ├── __init__.pyc │ ├── acore.py │ ├── acore.pyc │ ├── analyzers.py │ ├── analyzers.pyc │ ├── filters.py │ ├── filters.pyc │ ├── intraword.py │ ├── intraword.pyc │ ├── morph.py │ ├── morph.pyc │ ├── ngrams.py │ ├── ngrams.pyc │ ├── tokenizers.py │ └── tokenizers.pyc │ ├── automata │ ├── __init__.py │ ├── __init__.pyc │ ├── fst.py │ ├── fst.pyc │ ├── glob.py │ └── nfa.py │ ├── classify.py │ ├── classify.pyc │ ├── codec │ ├── __init__.py │ ├── __init__.pyc │ ├── base.py │ ├── base.pyc │ ├── memory.py │ ├── plaintext.py │ ├── whoosh2.py │ ├── whoosh3.py │ └── whoosh3.pyc │ ├── collectors.py │ ├── collectors.pyc │ ├── columns.py │ ├── columns.pyc │ ├── compat.py │ ├── compat.pyc │ ├── externalsort.py │ ├── externalsort.pyc │ ├── fields.py │ ├── fields.pyc │ ├── filedb │ ├── __init__.py │ ├── __init__.pyc │ ├── compound.py │ ├── compound.pyc │ ├── filestore.py │ ├── filestore.pyc │ ├── filetables.py │ ├── filetables.pyc │ ├── gae.py │ ├── structfile.py │ └── structfile.pyc │ ├── formats.py │ ├── formats.pyc │ ├── highlight.py │ ├── highlight.pyc │ ├── idsets.py │ ├── idsets.pyc │ ├── index.py │ ├── index.pyc │ ├── lang │ ├── __init__.py │ ├── __init__.pyc │ ├── dmetaphone.py │ ├── dmetaphone.pyc │ ├── isri.py │ ├── lovins.py │ ├── morph_en.py │ ├── morph_en.pyc │ ├── paicehusk.py │ ├── phonetic.py │ ├── porter.py │ ├── porter.pyc │ ├── porter2.py │ ├── snowball │ │ ├── __init__.py │ │ ├── bases.py │ │ ├── danish.py │ │ ├── dutch.py │ │ ├── english.py │ │ ├── finnish.py │ │ ├── french.py │ │ ├── german.py │ │ ├── hungarian.py │ │ ├── italian.py │ │ ├── norwegian.py │ │ ├── portugese.py │ │ ├── romanian.py │ │ ├── russian.py │ │ ├── spanish.py │ │ └── swedish.py │ ├── stopwords.py │ └── wordnet.py │ ├── legacy.py │ ├── legacy.pyc │ ├── matching │ ├── __init__.py │ ├── __init__.pyc │ ├── binary.py │ ├── binary.pyc │ ├── combo.py │ ├── combo.pyc │ ├── mcore.py │ ├── mcore.pyc │ ├── wrappers.py │ └── wrappers.pyc │ ├── multiproc.py │ ├── qparser │ ├── __init__.py │ ├── __init__.pyc │ ├── common.py │ ├── common.pyc │ ├── dateparse.py │ ├── default.py │ ├── default.pyc │ ├── plugins.py │ ├── plugins.pyc │ ├── syntax.py │ ├── syntax.pyc │ ├── taggers.py │ └── taggers.pyc │ ├── query │ ├── __init__.py │ ├── __init__.pyc │ ├── compound.py │ ├── compound.pyc │ ├── nested.py │ ├── nested.pyc │ ├── positional.py │ ├── positional.pyc │ ├── qcolumns.py │ ├── qcolumns.pyc │ ├── qcore.py │ ├── qcore.pyc │ ├── ranges.py │ ├── ranges.pyc │ ├── spans.py │ ├── spans.pyc │ ├── terms.py │ ├── terms.pyc │ ├── wrappers.py │ └── wrappers.pyc │ ├── reading.py │ ├── reading.pyc │ ├── scoring.py │ ├── scoring.pyc │ ├── searching.py │ ├── searching.pyc │ ├── sorting.py │ ├── sorting.pyc │ ├── spelling.py │ ├── support │ ├── __init__.py │ ├── __init__.pyc │ ├── base85.py │ ├── bench.py │ ├── charset.py │ ├── levenshtein.py │ ├── levenshtein.pyc │ ├── relativedelta.py │ └── unicode.py │ ├── system.py │ ├── system.pyc │ ├── util │ ├── __init__.py │ ├── __init__.pyc │ ├── cache.py │ ├── cache.pyc │ ├── filelock.py │ ├── filelock.pyc │ ├── loading.py │ ├── loading.pyc │ ├── numeric.py │ ├── numeric.pyc │ ├── numlists.py │ ├── numlists.pyc │ ├── testing.py │ ├── text.py │ ├── text.pyc │ ├── times.py │ ├── times.pyc │ ├── varints.py │ ├── varints.pyc │ └── versions.py │ ├── writing.py │ └── writing.pyc ├── README.md ├── Sentiment_Analysis └── Sentiment(V0.1) │ ├── Django_sentiment │ └── sentiment │ │ ├── db.sqlite3 │ │ ├── manage.py │ │ ├── sentiment │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ │ └── tweeter │ │ ├── admin.py │ │ ├── apps.py │ │ ├── models.py │ │ ├── static │ │ ├── Chart.bundle.js │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap-theme.css │ │ │ ├── bootstrap-theme.css.map │ │ │ ├── bootstrap-theme.min.css │ │ │ ├── bootstrap-theme.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ ├── bootstrap.min.js.map │ │ │ └── npm.js │ │ ├── templates │ │ ├── layout.handlebars │ │ └── myapp │ │ │ ├── bar.html │ │ │ ├── chart.html │ │ │ ├── company.html │ │ │ └── index.html │ │ ├── tests.py │ │ ├── urls.py │ │ └── views.py │ ├── Readme.md │ ├── Stock_market_news_feed.ipynb │ ├── Stock_market_news_feed.py │ ├── TWEETER_feed+sentiment.ipynb │ ├── TWEETER_feed+sentiment.py │ ├── server.py │ ├── static │ ├── bootstrap.min.js │ └── styles │ │ └── bootstrap.min.css │ └── templates │ ├── index.html │ ├── neg.html │ └── pos.html ├── _config.yml ├── requirements.txt └── visualization ├── .coverage ├── AAPL.h5 ├── AAPL_close.save ├── AAPL_index.save ├── AAPL_volume.save ├── CompanyData.xlsx ├── Visualisation ├── CompanyData.xlsx ├── __init__.py ├── admin.py ├── apps.py ├── models.py ├── static │ ├── Chart.bundle.js │ ├── css │ │ ├── .DS_Store │ │ ├── bootstrap-grid.css │ │ ├── bootstrap-grid.css.map │ │ ├── bootstrap-grid.min.css │ │ ├── bootstrap-grid.min.css.map │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.css.map │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.min.css.map │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ └── js │ │ ├── bootstrap.bundle.js │ │ ├── bootstrap.bundle.js.map │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ ├── bootstrap.js │ │ ├── bootstrap.js.map │ │ ├── bootstrap.min.js │ │ ├── bootstrap.min.js.map │ │ └── npm.js ├── templates │ ├── layout.handlebars │ └── visualisation │ │ ├── chart.html │ │ ├── company.html │ │ └── index.html ├── tests.py ├── urls.py └── views.py ├── db.sqlite3 ├── elasticsearchapp ├── __init__.py ├── admin.py ├── apps.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_auto_20181208_1912.py │ ├── 0003_company_id.py │ ├── 0004_auto_20181208_2116.py │ └── __init__.py ├── models.py ├── search.py ├── signals.py ├── templates │ ├── details.html │ └── layout.html ├── tests.py ├── urls.py └── views.py ├── manage.py ├── myapp ├── admin.py ├── apps.py ├── models.py ├── static │ ├── Chart.bundle.js │ ├── bootstrap.min.js │ ├── css │ │ ├── bootstrap-grid.css │ │ ├── bootstrap-grid.css.map │ │ ├── bootstrap-grid.min.css │ │ ├── bootstrap-grid.min.css.map │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.css.map │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.min.css.map │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ ├── bootstrap.min.css.map │ │ └── myapp.css │ ├── js │ │ ├── bootstrap.bundle.js │ │ ├── bootstrap.bundle.js.map │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ ├── bootstrap.js │ │ ├── bootstrap.js.map │ │ ├── bootstrap.min.js │ │ ├── bootstrap.min.js.map │ │ └── npm.js │ └── styles │ │ └── bootstrap.min.css ├── templates │ └── myapp │ │ └── Comparison_Form.html ├── tests.py ├── urls.py └── views.py ├── tweeter ├── admin.py ├── apps.py ├── models.py ├── static │ ├── Chart.bundle.js │ ├── css │ │ ├── bootstrap-grid.css │ │ ├── bootstrap-grid.css.map │ │ ├── bootstrap-grid.min.css │ │ ├── bootstrap-grid.min.css.map │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.css.map │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.min.css.map │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ └── js │ │ ├── bootstrap.bundle.js │ │ ├── bootstrap.bundle.js.map │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ ├── bootstrap.js │ │ ├── bootstrap.js.map │ │ ├── bootstrap.min.js │ │ ├── bootstrap.min.js.map │ │ └── npm.js ├── templates │ ├── layout.handlebars │ └── myapp │ │ ├── bar.html │ │ ├── chart.html │ │ ├── company.html │ │ └── index.html ├── tests.py ├── urls.py └── views.py ├── unittestsearch.py ├── unittestvisual.py └── visualization ├── __init__.py ├── requirements.txt ├── settings.py ├── urls.py ├── views.py └── wsgi.py /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.pyc 3 | -------------------------------------------------------------------------------- /Comparison V1.0/ComparisonModule/urls.py: -------------------------------------------------------------------------------- 1 | """ComparisonModule URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('', include('myapp.urls')) 22 | ] 23 | -------------------------------------------------------------------------------- /Comparison V1.0/ComparisonModule/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for ComparisonModule project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ComparisonModule.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /Comparison V1.0/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Comparison V1.0/db.sqlite3 -------------------------------------------------------------------------------- /Comparison V1.0/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ComparisonModule.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 | -------------------------------------------------------------------------------- /Comparison V1.0/myapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post 3 | 4 | admin.site.register(Post) -------------------------------------------------------------------------------- /Comparison V1.0/myapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MyappConfig(AppConfig): 5 | name = 'myapp' 6 | -------------------------------------------------------------------------------- /Comparison V1.0/myapp/models.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import models 3 | from django.utils import timezone 4 | 5 | 6 | class Post(models.Model): 7 | author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) 8 | title = models.CharField(max_length=200) 9 | text = models.TextField() 10 | created_date = models.DateTimeField(default=timezone.now) 11 | published_date = models.DateTimeField(blank=True, null=True) 12 | 13 | def publish(self): 14 | self.published_date = timezone.now() 15 | self.save() 16 | 17 | def __str__(self): 18 | return self.title -------------------------------------------------------------------------------- /Comparison V1.0/myapp/static/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) 3 | * Copyright 2011-2018 The Bootstrap Authors 4 | * Copyright 2011-2018 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /Comparison V1.0/myapp/static/css/myapp.css: -------------------------------------------------------------------------------- 1 | h1 a, h2 a { 2 | color: #C25100; 3 | font-family: 'Lobster'; 4 | } 5 | 6 | .page-header { 7 | background-color: #C25100; 8 | margin-top: 0; 9 | padding: 20px 20px 20px 40px; 10 | } 11 | 12 | .page-header h1, .page-header h1 a, .page-header h1 a:visited, .page-header h1 a:active { 13 | color: #ffffff; 14 | font-size: 36pt; 15 | text-decoration: none; 16 | } 17 | 18 | .content { 19 | margin-left: 40px; 20 | } 21 | 22 | h1, h2, h3, h4 { 23 | font-family: 'Lobster', cursive; 24 | } 25 | 26 | .date { 27 | color: #828282; 28 | } 29 | 30 | .save { 31 | float: right; 32 | } 33 | 34 | .post-form textarea, .post-form input { 35 | width: 100%; 36 | } 37 | 38 | .top-menu, .top-menu:hover, .top-menu:visited { 39 | color: #ffffff; 40 | float: right; 41 | font-size: 26pt; 42 | margin-right: 20px; 43 | } 44 | 45 | .post { 46 | margin-bottom: 70px; 47 | } 48 | 49 | .post h1 a, .post h1 a:visited { 50 | color: #000000; 51 | } -------------------------------------------------------------------------------- /Comparison V1.0/myapp/static/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /Comparison V1.0/myapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Comparison V1.0/myapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | 4 | urlpatterns = [ 5 | path('', views.chart, name='chart'), 6 | path('fetch/', views.fetch, name='fetch'), 7 | path('company/', views.fetch, name='company') 8 | ] -------------------------------------------------------------------------------- /Comparison V1.0/readme.md: -------------------------------------------------------------------------------- 1 | # Comparison Module 2 | 3 | ## Comparison V1.0 4 | 5 | - We created a django project to visualise a dummy data. 6 | 7 | ## Comparison V1.1 8 | 9 | - Still in V1.0 - as we did not changed the base
10 | - We were successfully able to extract data from the 'quandl' api for stock price data in views.py by allowing users to set the company names to compare with start and end date and were successful in plotting it on the web app using chart.js.
11 | - Next we will also calculate returns by stock, growth of the stock over time and other such functionalities. 12 | 13 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/README.md: -------------------------------------------------------------------------------- 1 | # Haystack-with-Whoosh 2 | A sample search engine using django-haystack with Whoosh and SqlLite as DB. 3 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/db.sqlite3 -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | import logging 3 | from django.conf import settings 4 | from django.core.exceptions import ImproperlyConfigured 5 | from haystack.constants import DEFAULT_ALIAS 6 | from haystack import signals 7 | from haystack.utils import loading 8 | 9 | 10 | __author__ = 'Daniel Lindsley' 11 | __version__ = (2, 1, 1, 'dev') 12 | 13 | 14 | # Setup default logging. 15 | log = logging.getLogger('haystack') 16 | stream = logging.StreamHandler() 17 | stream.setLevel(logging.INFO) 18 | log.addHandler(stream) 19 | 20 | 21 | # Help people clean up from 1.X. 22 | if hasattr(settings, 'HAYSTACK_SITECONF'): 23 | raise ImproperlyConfigured('The HAYSTACK_SITECONF setting is no longer used & can be removed.') 24 | if hasattr(settings, 'HAYSTACK_SEARCH_ENGINE'): 25 | raise ImproperlyConfigured('The HAYSTACK_SEARCH_ENGINE setting has been replaced with HAYSTACK_CONNECTIONS.') 26 | if hasattr(settings, 'HAYSTACK_ENABLE_REGISTRATIONS'): 27 | raise ImproperlyConfigured('The HAYSTACK_ENABLE_REGISTRATIONS setting is no longer used & can be removed.') 28 | if hasattr(settings, 'HAYSTACK_INCLUDE_SPELLING'): 29 | raise ImproperlyConfigured('The HAYSTACK_INCLUDE_SPELLING setting is now a per-backend setting & belongs in HAYSTACK_CONNECTIONS.') 30 | 31 | 32 | # Check the 2.X+ bits. 33 | if not hasattr(settings, 'HAYSTACK_CONNECTIONS'): 34 | raise ImproperlyConfigured('The HAYSTACK_CONNECTIONS setting is required.') 35 | if DEFAULT_ALIAS not in settings.HAYSTACK_CONNECTIONS: 36 | raise ImproperlyConfigured("The default alias '%s' must be included in the HAYSTACK_CONNECTIONS setting." % DEFAULT_ALIAS) 37 | 38 | # Load the connections. 39 | connections = loading.ConnectionHandler(settings.HAYSTACK_CONNECTIONS) 40 | 41 | # Load the router(s). 42 | connection_router = loading.ConnectionRouter() 43 | 44 | if hasattr(settings, 'HAYSTACK_ROUTERS'): 45 | if not isinstance(settings.HAYSTACK_ROUTERS, (list, tuple)): 46 | raise ImproperlyConfigured("The HAYSTACK_ROUTERS setting must be either a list or tuple.") 47 | 48 | connection_router = loading.ConnectionRouter(settings.HAYSTACK_ROUTERS) 49 | 50 | # Setup the signal processor. 51 | signal_processor_path = getattr(settings, 'HAYSTACK_SIGNAL_PROCESSOR', 'haystack.signals.BaseSignalProcessor') 52 | signal_processor_class = loading.import_class(signal_processor_path) 53 | signal_processor = signal_processor_class(connections, connection_router) 54 | 55 | 56 | # Per-request, reset the ghetto query log. 57 | # Probably not extraordinarily thread-safe but should only matter when 58 | # DEBUG = True. 59 | def reset_search_queries(**kwargs): 60 | for conn in connections.all(): 61 | conn.reset_queries() 62 | 63 | 64 | if settings.DEBUG: 65 | from django.core import signals as django_signals 66 | django_signals.request_started.connect(reset_search_queries) 67 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/admin.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/admin.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/backends/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/backends/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/backends/whoosh_backend.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/backends/whoosh_backend.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/constants.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from django.conf import settings 3 | 4 | DEFAULT_ALIAS = 'default' 5 | 6 | # Reserved field names 7 | ID = getattr(settings, 'HAYSTACK_ID_FIELD', 'id') 8 | DJANGO_CT = getattr(settings, 'HAYSTACK_DJANGO_CT_FIELD', 'django_ct') 9 | DJANGO_ID = getattr(settings, 'HAYSTACK_DJANGO_ID_FIELD', 'django_id') 10 | 11 | # Default operator. Valid options are AND/OR. 12 | DEFAULT_OPERATOR = getattr(settings, 'HAYSTACK_DEFAULT_OPERATOR', 'AND') 13 | 14 | # Valid expression extensions. 15 | VALID_FILTERS = set(['contains', 'exact', 'gt', 'gte', 'lt', 'lte', 'in', 'startswith', 'range']) 16 | FILTER_SEPARATOR = '__' 17 | 18 | # The maximum number of items to display in a SearchQuerySet.__repr__ 19 | REPR_OUTPUT_SIZE = 20 20 | 21 | # Number of SearchResults to load at a time. 22 | ITERATOR_LOAD_PER_QUERY = getattr(settings, 'HAYSTACK_ITERATOR_LOAD_PER_QUERY', 10) 23 | 24 | # A marker class in the hierarchy to indicate that it handles search data. 25 | class Indexable(object): 26 | haystack_use_for_indexing = True 27 | 28 | # For the geo bits, since that's what Solr & Elasticsearch seem to silently 29 | # assume... 30 | WGS_84_SRID = 4326 31 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/constants.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/constants.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/exceptions.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | 4 | class HaystackError(Exception): 5 | """A generic exception for all others to extend.""" 6 | pass 7 | 8 | class SearchBackendError(HaystackError): 9 | """Raised when a backend can not be found.""" 10 | pass 11 | 12 | class SearchFieldError(HaystackError): 13 | """Raised when a field encounters an error.""" 14 | pass 15 | 16 | class MissingDependency(HaystackError): 17 | """Raised when a library a backend depends on can not be found.""" 18 | pass 19 | 20 | class NotHandled(HaystackError): 21 | """Raised when a model is not handled by the router setup.""" 22 | pass 23 | 24 | class MoreLikeThisError(HaystackError): 25 | """Raised when a model instance has not been provided for More Like This.""" 26 | pass 27 | 28 | class FacetingError(HaystackError): 29 | """Raised when incorrect arguments have been provided for faceting.""" 30 | pass 31 | 32 | class SpatialError(HaystackError): 33 | """Raised when incorrect arguments have been provided for spatial.""" 34 | pass 35 | 36 | class StatsError(HaystackError): 37 | "Raised when incorrect arguments have been provided for stats" 38 | pass 39 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/exceptions.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/exceptions.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/fields.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/fields.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/forms.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/forms.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/indexes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/indexes.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/inputs.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/inputs.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/management/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/management/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/management/commands/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/management/commands/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/build_solr_schema.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from __future__ import unicode_literals 3 | from optparse import make_option 4 | import sys 5 | 6 | from django.core.exceptions import ImproperlyConfigured 7 | from django.core.management.base import BaseCommand 8 | from django.template import loader, Context 9 | from haystack.backends.solr_backend import SolrSearchBackend 10 | from haystack import constants 11 | 12 | 13 | class Command(BaseCommand): 14 | help = "Generates a Solr schema that reflects the indexes." 15 | base_options = ( 16 | make_option("-f", "--filename", action="store", type="string", dest="filename", 17 | help='If provided, directs output to a file instead of stdout.'), 18 | make_option("-u", "--using", action="store", type="string", dest="using", default=constants.DEFAULT_ALIAS, 19 | help='If provided, chooses a connection to work with.'), 20 | ) 21 | option_list = BaseCommand.option_list + base_options 22 | 23 | def handle(self, **options): 24 | """Generates a Solr schema that reflects the indexes.""" 25 | using = options.get('using') 26 | schema_xml = self.build_template(using=using) 27 | 28 | if options.get('filename'): 29 | self.write_file(options.get('filename'), schema_xml) 30 | else: 31 | self.print_stdout(schema_xml) 32 | 33 | def build_context(self, using): 34 | from haystack import connections, connection_router 35 | backend = connections[using].get_backend() 36 | 37 | if not isinstance(backend, SolrSearchBackend): 38 | raise ImproperlyConfigured("'%s' isn't configured as a SolrEngine)." % backend.connection_alias) 39 | 40 | content_field_name, fields = backend.build_schema(connections[using].get_unified_index().all_searchfields()) 41 | return Context({ 42 | 'content_field_name': content_field_name, 43 | 'fields': fields, 44 | 'default_operator': constants.DEFAULT_OPERATOR, 45 | 'ID': constants.ID, 46 | 'DJANGO_CT': constants.DJANGO_CT, 47 | 'DJANGO_ID': constants.DJANGO_ID, 48 | }) 49 | 50 | def build_template(self, using): 51 | t = loader.get_template('search_configuration/solr.xml') 52 | c = self.build_context(using=using) 53 | return t.render(c) 54 | 55 | def print_stdout(self, schema_xml): 56 | sys.stderr.write("\n") 57 | sys.stderr.write("\n") 58 | sys.stderr.write("\n") 59 | sys.stderr.write("Save the following output to 'schema.xml' and place it in your Solr configuration directory.\n") 60 | sys.stderr.write("--------------------------------------------------------------------------------------------\n") 61 | sys.stderr.write("\n") 62 | print(schema_xml) 63 | 64 | def write_file(self, filename, schema_xml): 65 | schema_file = open(filename, 'w') 66 | schema_file.write(schema_xml) 67 | schema_file.close() 68 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/clear_index.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from __future__ import unicode_literals 3 | from optparse import make_option 4 | import sys 5 | 6 | from django.core.management.base import BaseCommand 7 | from django.utils import six 8 | 9 | 10 | class Command(BaseCommand): 11 | help = "Clears out the search index completely." 12 | base_options = ( 13 | make_option('--noinput', action='store_false', dest='interactive', default=True, 14 | help='If provided, no prompts will be issued to the user and the data will be wiped out.' 15 | ), 16 | make_option("-u", "--using", action="append", dest="using", 17 | default=[], 18 | help='Update only the named backend (can be used multiple times). ' 19 | 'By default all backends will be updated.' 20 | ), 21 | ) 22 | option_list = BaseCommand.option_list + base_options 23 | 24 | def handle(self, **options): 25 | """Clears out the search index completely.""" 26 | from haystack import connections 27 | self.verbosity = int(options.get('verbosity', 1)) 28 | 29 | using = options.get('using') 30 | if not using: 31 | using = connections.connections_info.keys() 32 | 33 | if options.get('interactive', True): 34 | print() 35 | print("WARNING: This will irreparably remove EVERYTHING from your search index in connection '%s'." % "', '".join(using)) 36 | print("Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.") 37 | 38 | yes_or_no = six.moves.input("Are you sure you wish to continue? [y/N] ") 39 | print 40 | 41 | if not yes_or_no.lower().startswith('y'): 42 | print("No action taken.") 43 | sys.exit() 44 | 45 | if self.verbosity >= 1: 46 | print("Removing all documents from your index because you said so.") 47 | 48 | for backend_name in using: 49 | backend = connections[backend_name].get_backend() 50 | backend.clear() 51 | 52 | if self.verbosity >= 1: 53 | print("All documents removed.") 54 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/clear_index.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/management/commands/clear_index.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/haystack_info.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from __future__ import unicode_literals 3 | from django.core.management.base import NoArgsCommand 4 | 5 | 6 | class Command(NoArgsCommand): 7 | help = "Provides feedback about the current Haystack setup." 8 | 9 | def handle_noargs(self, **options): 10 | """Provides feedback about the current Haystack setup.""" 11 | from haystack import connections 12 | 13 | unified_index = connections['default'].get_unified_index() 14 | indexed = unified_index.get_indexed_models() 15 | index_count = len(indexed) 16 | print("Number of handled %s index(es)." % index_count) 17 | 18 | for index in indexed: 19 | print(" - Model: %s by Index: %s" % (index.__name__, unified_index.indexes[index])) 20 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/rebuild_index.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from django.core.management import call_command 3 | from django.core.management.base import BaseCommand 4 | from haystack.management.commands.clear_index import Command as ClearCommand 5 | from haystack.management.commands.update_index import Command as UpdateCommand 6 | 7 | 8 | class Command(BaseCommand): 9 | help = "Completely rebuilds the search index by removing the old data and then updating." 10 | option_list = list(BaseCommand.option_list) + \ 11 | [option for option in UpdateCommand.base_options if option.get_opt_string() != '--verbosity'] + \ 12 | [option for option in ClearCommand.base_options if not option.get_opt_string() in ['--using', '--verbosity']] 13 | 14 | def handle(self, **options): 15 | call_command('clear_index', **options) 16 | call_command('update_index', **options) 17 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/rebuild_index.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/management/commands/rebuild_index.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/management/commands/update_index.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/management/commands/update_index.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/manager.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/manager.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/models.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/models.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/panels.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | import datetime 3 | from django.template.loader import render_to_string 4 | from django.utils import six 5 | from django.utils.translation import ugettext_lazy as _ 6 | from haystack import connections 7 | from debug_toolbar.panels import DebugPanel 8 | 9 | 10 | class HaystackDebugPanel(DebugPanel): 11 | """ 12 | Panel that displays information about the Haystack queries run while 13 | processing the request. 14 | """ 15 | name = 'Haystack' 16 | has_content = True 17 | 18 | def __init__(self, *args, **kwargs): 19 | super(self.__class__, self).__init__(*args, **kwargs) 20 | self._offset = dict((alias, len(connections[alias].queries)) for alias in connections.connections_info.keys()) 21 | self._search_time = 0 22 | self._queries = [] 23 | self._backends = {} 24 | 25 | def nav_title(self): 26 | return _('Haystack') 27 | 28 | def nav_subtitle(self): 29 | self._queries = [] 30 | self._backends = {} 31 | 32 | for alias in connections.connections_info.keys(): 33 | search_queries = connections[alias].queries[self._offset[alias]:] 34 | self._backends[alias] = { 35 | 'time_spent': sum(float(q['time']) for q in search_queries), 36 | 'queries': len(search_queries), 37 | } 38 | self._queries.extend([(alias, q) for q in search_queries]) 39 | 40 | self._queries.sort(key=lambda x: x[1]['start']) 41 | self._search_time = sum([d['time_spent'] for d in self._backends.itervalues()]) 42 | num_queries = len(self._queries) 43 | return "%d %s in %.2fms" % ( 44 | num_queries, 45 | (num_queries == 1) and 'query' or 'queries', 46 | self._search_time 47 | ) 48 | 49 | def title(self): 50 | return _('Search Queries') 51 | 52 | def url(self): 53 | return '' 54 | 55 | def content(self): 56 | width_ratio_tally = 0 57 | 58 | for alias, query in self._queries: 59 | query['alias'] = alias 60 | query['query'] = query['query_string'] 61 | 62 | if query.get('additional_kwargs'): 63 | if query['additional_kwargs'].get('result_class'): 64 | query['additional_kwargs']['result_class'] = six.text_type(query['additional_kwargs']['result_class']) 65 | 66 | try: 67 | query['width_ratio'] = (float(query['time']) / self._search_time) * 100 68 | except ZeroDivisionError: 69 | query['width_ratio'] = 0 70 | 71 | query['start_offset'] = width_ratio_tally 72 | width_ratio_tally += query['width_ratio'] 73 | 74 | context = self.context.copy() 75 | context.update({ 76 | 'backends': sorted(self._backends.items(), key=lambda x: -x[1]['time_spent']), 77 | 'queries': [q for a, q in self._queries], 78 | 'sql_time': self._search_time, 79 | }) 80 | 81 | return render_to_string('panels/haystack.html', context) 82 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/query.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/query.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/routers.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from haystack.constants import DEFAULT_ALIAS 3 | 4 | 5 | class BaseRouter(object): 6 | # Reserved for future extension. 7 | pass 8 | 9 | 10 | class DefaultRouter(BaseRouter): 11 | def for_read(self, **hints): 12 | return DEFAULT_ALIAS 13 | 14 | def for_write(self, **hints): 15 | return DEFAULT_ALIAS 16 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/routers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/routers.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/signals.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from django.db import models 3 | from haystack.exceptions import NotHandled 4 | 5 | 6 | class BaseSignalProcessor(object): 7 | """ 8 | A convenient way to attach Haystack to Django's signals & cause things to 9 | index. 10 | 11 | By default, does nothing with signals but provides underlying functionality. 12 | """ 13 | def __init__(self, connections, connection_router): 14 | self.connections = connections 15 | self.connection_router = connection_router 16 | self.setup() 17 | 18 | def setup(self): 19 | """ 20 | A hook for setting up anything necessary for 21 | ``handle_save/handle_delete`` to be executed. 22 | 23 | Default behavior is to do nothing (``pass``). 24 | """ 25 | # Do nothing. 26 | pass 27 | 28 | def teardown(self): 29 | """ 30 | A hook for tearing down anything necessary for 31 | ``handle_save/handle_delete`` to no longer be executed. 32 | 33 | Default behavior is to do nothing (``pass``). 34 | """ 35 | # Do nothing. 36 | pass 37 | 38 | def handle_save(self, sender, instance, **kwargs): 39 | """ 40 | Given an individual model instance, determine which backends the 41 | update should be sent to & update the object on those backends. 42 | """ 43 | using_backends = self.connection_router.for_write(instance=instance) 44 | 45 | for using in using_backends: 46 | try: 47 | index = self.connections[using].get_unified_index().get_index(sender) 48 | index.update_object(instance, using=using) 49 | except NotHandled: 50 | # TODO: Maybe log it or let the exception bubble? 51 | pass 52 | 53 | def handle_delete(self, sender, instance, **kwargs): 54 | """ 55 | Given an individual model instance, determine which backends the 56 | delete should be sent to & delete the object on those backends. 57 | """ 58 | using_backends = self.connection_router.for_write(instance=instance) 59 | 60 | for using in using_backends: 61 | try: 62 | index = self.connections[using].get_unified_index().get_index(sender) 63 | index.remove_object(instance, using=using) 64 | except NotHandled: 65 | # TODO: Maybe log it or let the exception bubble? 66 | pass 67 | 68 | 69 | class RealtimeSignalProcessor(BaseSignalProcessor): 70 | """ 71 | Allows for observing when saves/deletes fire & automatically updates the 72 | search engine appropriately. 73 | """ 74 | def setup(self): 75 | # Naive (listen to all model saves). 76 | models.signals.post_save.connect(self.handle_save) 77 | models.signals.post_delete.connect(self.handle_delete) 78 | # Efficient would be going through all backends & collecting all models 79 | # being used, then hooking up signals only for those. 80 | 81 | def teardown(self): 82 | # Naive (listen to all model saves). 83 | models.signals.post_save.disconnect(self.handle_save) 84 | models.signals.post_delete.disconnect(self.handle_delete) 85 | # Efficient would be going through all backends & collecting all models 86 | # being used, then disconnecting signals only for those. 87 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/signals.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/signals.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/templates/panels/haystack.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {% for query in queries %} 14 | 15 | 20 | 21 | 24 | 25 | 30 | 31 | {% endfor %} 32 | 33 |
{% trans 'Query' %}{% trans 'Backend Alias' %}{% trans 'Timeline' %}{% trans 'Time' %} (ms){% trans 'Kwargs' %}
16 |
17 |
{{ query.query_string|safe }}
18 |
19 |
{{ query.alias }} 22 |   23 | {{ query.time }} 26 | {% for key, value in query.additional_kwargs.items %} 27 | '{{ key }}': {{ value|stringformat:"r" }}
28 | {% endfor %} 29 |
34 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/templatetags/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/templatetags/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/templatetags/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/templatetags/more_like_this.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from django import template 3 | from django.db import models 4 | from haystack.query import SearchQuerySet 5 | 6 | 7 | register = template.Library() 8 | 9 | 10 | class MoreLikeThisNode(template.Node): 11 | def __init__(self, model, varname, for_types=None, limit=None): 12 | self.model = template.Variable(model) 13 | self.varname = varname 14 | self.for_types = for_types 15 | self.limit = limit 16 | 17 | if not self.limit is None: 18 | self.limit = int(self.limit) 19 | 20 | def render(self, context): 21 | try: 22 | model_instance = self.model.resolve(context) 23 | sqs = SearchQuerySet() 24 | 25 | if not self.for_types is None: 26 | intermediate = template.Variable(self.for_types) 27 | for_types = intermediate.resolve(context).split(',') 28 | search_models = [] 29 | 30 | for model in for_types: 31 | model_class = models.get_model(*model.split('.')) 32 | 33 | if model_class: 34 | search_models.append(model_class) 35 | 36 | sqs = sqs.models(*search_models) 37 | 38 | sqs = sqs.more_like_this(model_instance) 39 | 40 | if not self.limit is None: 41 | sqs = sqs[:self.limit] 42 | 43 | context[self.varname] = sqs 44 | except: 45 | pass 46 | 47 | return '' 48 | 49 | 50 | @register.tag 51 | def more_like_this(parser, token): 52 | """ 53 | Fetches similar items from the search index to find content that is similar 54 | to the provided model's content. 55 | 56 | Syntax:: 57 | 58 | {% more_like_this model_instance as varname [for app_label.model_name,app_label.model_name,...] [limit n] %} 59 | 60 | Example:: 61 | 62 | # Pull a full SearchQuerySet (lazy loaded) of similar content. 63 | {% more_like_this entry as related_content %} 64 | 65 | # Pull just the top 5 similar pieces of content. 66 | {% more_like_this entry as related_content limit 5 %} 67 | 68 | # Pull just the top 5 similar entries or comments. 69 | {% more_like_this entry as related_content for "blog.entry,comments.comment" limit 5 %} 70 | """ 71 | bits = token.split_contents() 72 | 73 | if not len(bits) in (4, 6, 8): 74 | raise template.TemplateSyntaxError(u"'%s' tag requires either 3, 5 or 7 arguments." % bits[0]) 75 | 76 | model = bits[1] 77 | 78 | if bits[2] != 'as': 79 | raise template.TemplateSyntaxError(u"'%s' tag's second argument should be 'as'." % bits[0]) 80 | 81 | varname = bits[3] 82 | limit = None 83 | for_types = None 84 | 85 | if len(bits) == 6: 86 | if bits[4] != 'limit' and bits[4] != 'for': 87 | raise template.TemplateSyntaxError(u"'%s' tag's fourth argument should be either 'limit' or 'for'." % bits[0]) 88 | 89 | if bits[4] == 'limit': 90 | limit = bits[5] 91 | else: 92 | for_types = bits[5] 93 | 94 | if len(bits) == 8: 95 | if bits[4] != 'for': 96 | raise template.TemplateSyntaxError(u"'%s' tag's fourth argument should be 'for'." % bits[0]) 97 | 98 | for_types = bits[5] 99 | 100 | if bits[6] != 'limit': 101 | raise template.TemplateSyntaxError(u"'%s' tag's sixth argument should be 'limit'." % bits[0]) 102 | 103 | limit = bits[7] 104 | 105 | return MoreLikeThisNode(model, varname, for_types, limit) 106 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/urls.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | try: 4 | from django.conf.urls import patterns, url 5 | except ImportError: 6 | from django.conf.urls.defaults import patterns, url 7 | 8 | from haystack.views import SearchView 9 | 10 | 11 | urlpatterns = patterns('haystack.views', 12 | url(r'^$', SearchView(), name='haystack_search'), 13 | ) 14 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/urls.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/urls.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | import re 3 | 4 | import django 5 | from django.conf import settings 6 | from django.utils import six 7 | 8 | from haystack.constants import ID, DJANGO_CT, DJANGO_ID 9 | from haystack.utils.highlighting import Highlighter 10 | 11 | try: 12 | from django.utils import importlib 13 | except ImportError: 14 | import importlib 15 | 16 | IDENTIFIER_REGEX = re.compile('^[\w\d_]+\.[\w\d_]+\.\d+$') 17 | 18 | 19 | def default_get_identifier(obj_or_string): 20 | """ 21 | Get an unique identifier for the object or a string representing the 22 | object. 23 | 24 | If not overridden, uses ... 25 | """ 26 | if isinstance(obj_or_string, six.string_types): 27 | if not IDENTIFIER_REGEX.match(obj_or_string): 28 | raise AttributeError(u"Provided string '%s' is not a valid identifier." % obj_or_string) 29 | 30 | return obj_or_string 31 | 32 | return u"%s.%s" % (get_model_ct(obj_or_string), 33 | obj_or_string._get_pk_val()) 34 | 35 | 36 | def _lookup_identifier_method(): 37 | """ 38 | If the user has set HAYSTACK_IDENTIFIER_METHOD, import it and return the method uncalled. 39 | If HAYSTACK_IDENTIFIER_METHOD is not defined, return haystack.utils.default_get_identifier. 40 | 41 | This always runs at module import time. We keep the code in a function 42 | so that it can be called from unit tests, in order to simulate the re-loading 43 | of this module. 44 | """ 45 | if not hasattr(settings, 'HAYSTACK_IDENTIFIER_METHOD'): 46 | return default_get_identifier 47 | 48 | module_path, method_name = settings.HAYSTACK_IDENTIFIER_METHOD.rsplit(".", 1) 49 | 50 | try: 51 | module = importlib.import_module(module_path) 52 | except ImportError: 53 | raise ImportError(u"Unable to import module '%s' provided for HAYSTACK_IDENTIFIER_METHOD." % module_path) 54 | 55 | identifier_method = getattr(module, method_name, None) 56 | 57 | if not identifier_method: 58 | raise AttributeError( 59 | u"Provided method '%s' for HAYSTACK_IDENTIFIER_METHOD does not exist in '%s'." % (method_name, module_path) 60 | ) 61 | 62 | return identifier_method 63 | 64 | 65 | get_identifier = _lookup_identifier_method() 66 | 67 | 68 | if django.VERSION >= (1, 7): 69 | def get_model_ct_tuple(model): 70 | return (model._meta.app_label, model._meta.model_name) 71 | else: 72 | def get_model_ct_tuple(model): 73 | return (model._meta.app_label, model._meta.module_name) 74 | 75 | def get_model_ct(model): 76 | return "%s.%s" % get_model_ct_tuple(model) 77 | 78 | 79 | def get_facet_field_name(fieldname): 80 | if fieldname in [ID, DJANGO_ID, DJANGO_CT]: 81 | return fieldname 82 | 83 | return "%s_exact" % fieldname 84 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/utils/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/app_loading.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from __future__ import absolute_import, print_function, unicode_literals 3 | 4 | from django.conf import settings 5 | from django.core.exceptions import ImproperlyConfigured 6 | 7 | __all__ = ['get_models', 'load_apps'] 8 | 9 | 10 | APP = 'app' 11 | MODEL = 'model' 12 | 13 | 14 | def is_app_or_model(label): 15 | label_bits = label.split('.') 16 | 17 | if len(label_bits) == 1: 18 | return APP 19 | elif len(label_bits) == 2: 20 | return MODEL 21 | else: 22 | raise ImproperlyConfigured("'%s' isn't recognized as an app () or model (.)." % label) 23 | 24 | 25 | try: 26 | from django.apps import apps 27 | 28 | def load_apps(): 29 | return [x.label for x in apps.get_app_configs()] 30 | 31 | def get_models(label): 32 | if is_app_or_model(label) == APP: 33 | try: 34 | app = apps.get_app_config(label) 35 | except LookupError as exc: 36 | raise ImproperlyConfigured(u'get_models() called for unregistered app %s: %s' % (label, exc)) 37 | 38 | return app.get_models() 39 | else: 40 | app_label, model_name = label.split('.') 41 | return [apps.get_app_config(app_label).get_model(model_name)] 42 | 43 | except ImportError: 44 | def load_apps(): 45 | from django.db.models import get_app 46 | # Do all, in an INSTALLED_APPS sorted order. 47 | items = [] 48 | 49 | for app in settings.INSTALLED_APPS: 50 | app_label = app.split('.')[-1] 51 | 52 | try: 53 | get_app(app_label) 54 | except ImproperlyConfigured: 55 | continue # Intentionally allow e.g. apps without models.py 56 | 57 | items.append(app_label) 58 | 59 | return items 60 | 61 | def get_models(label): 62 | from django.db.models import get_app, get_models as _get_models, get_model 63 | app_or_model = is_app_or_model(label) 64 | 65 | if app_or_model == APP: 66 | app_mod = get_app(label) 67 | return _get_models(app_mod) 68 | else: 69 | app_label, model_name = label.split('.') 70 | return [get_model(app_label, model_name)] 71 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/app_loading.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/utils/app_loading.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/decorators.py: -------------------------------------------------------------------------------- 1 | # Backport of Django 1.2's ``django.utils.decorators``. 2 | from __future__ import unicode_literals 3 | try: 4 | from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS 5 | except ImportError: 6 | from django.utils.functional import wraps, update_wrapper, WRAPPER_ASSIGNMENTS # Python 2.4 fallback. 7 | 8 | 9 | def method_decorator(decorator): 10 | """ 11 | Converts a function decorator into a method decorator 12 | """ 13 | def _dec(func): 14 | def _wrapper(self, *args, **kwargs): 15 | def bound_func(*args2, **kwargs2): 16 | return func(self, *args2, **kwargs2) 17 | # bound_func has the signature that 'decorator' expects i.e. no 18 | # 'self' argument, but it is a closure over self so it can call 19 | # 'func' correctly. 20 | return decorator(bound_func)(*args, **kwargs) 21 | return wraps(func)(_wrapper) 22 | update_wrapper(_dec, decorator) 23 | # Change the name to aid debugging. 24 | _dec.__name__ = 'method_decorator(%s)' % decorator.__name__ 25 | return _dec -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/geo.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from django.contrib.gis.geos import Point 3 | from django.contrib.gis.measure import Distance, D 4 | from haystack.constants import WGS_84_SRID 5 | from haystack.exceptions import SpatialError 6 | 7 | 8 | def ensure_geometry(geom): 9 | """ 10 | Makes sure the parameter passed in looks like a GEOS ``GEOSGeometry``. 11 | """ 12 | if not hasattr(geom, 'geom_type'): 13 | raise SpatialError("Point '%s' doesn't appear to be a GEOS geometry." % geom) 14 | 15 | return geom 16 | 17 | 18 | def ensure_point(geom): 19 | """ 20 | Makes sure the parameter passed in looks like a GEOS ``Point``. 21 | """ 22 | ensure_geometry(geom) 23 | 24 | if geom.geom_type != 'Point': 25 | raise SpatialError("Provided geometry '%s' is not a 'Point'." % geom) 26 | 27 | return geom 28 | 29 | 30 | def ensure_wgs84(point): 31 | """ 32 | Ensures the point passed in is a GEOS ``Point`` & returns that point's 33 | data is in the WGS-84 spatial reference. 34 | """ 35 | ensure_point(point) 36 | # Clone it so we don't alter the original, in case they're using it for 37 | # something else. 38 | new_point = point.clone() 39 | 40 | if not new_point.srid: 41 | # It has no spatial reference id. Assume WGS-84. 42 | new_point.set_srid(WGS_84_SRID) 43 | elif new_point.srid != WGS_84_SRID: 44 | # Transform it to get to the right system. 45 | new_point.transform(WGS_84_SRID) 46 | 47 | return new_point 48 | 49 | 50 | def ensure_distance(dist): 51 | """ 52 | Makes sure the parameter passed in is a 'Distance' object. 53 | """ 54 | try: 55 | # Since we mostly only care about the ``.km`` attribute, make sure 56 | # it's there. 57 | km = dist.km 58 | except AttributeError: 59 | raise SpatialError("'%s' does not appear to be a 'Distance' object." % dist) 60 | 61 | return dist 62 | 63 | 64 | def generate_bounding_box(bottom_left, top_right): 65 | """ 66 | Takes two opposite corners of a bounding box (order matters!) & generates 67 | a two-tuple of the correct coordinates for the bounding box. 68 | 69 | The two-tuple is in the form ``((min_lat, min_lng), (max_lat, max_lng))``. 70 | """ 71 | west, lat_1 = bottom_left.get_coords() 72 | east, lat_2 = top_right.get_coords() 73 | min_lat, max_lat = min(lat_1, lat_2), max(lat_1, lat_2) 74 | return ((min_lat, west), (max_lat, east)) 75 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/highlighting.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/utils/highlighting.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/loading.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/utils/loading.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/log.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from __future__ import unicode_literals 3 | 4 | import logging 5 | 6 | from django.conf import settings 7 | 8 | 9 | def getLogger(name): 10 | real_logger = logging.getLogger(name) 11 | return LoggingFacade(real_logger) 12 | 13 | 14 | class LoggingFacade(object): 15 | def __init__(self, real_logger): 16 | self.real_logger = real_logger 17 | 18 | def noop(self, *args, **kwargs): 19 | pass 20 | 21 | def __getattr__(self, attr): 22 | if getattr(settings, 'HAYSTACK_LOGGING', True): 23 | return getattr(self.real_logger, attr) 24 | return self.noop 25 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/utils/log.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/utils/log.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/haystack/views.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/haystack/views.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testhystack.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/templates/search/indexes/testapp/note_text.txt: -------------------------------------------------------------------------------- 1 | {{ object.title }} 2 | {{ object.user.get_full_name }} 3 | {{ object.body }} -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/templates/search/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {% block content %} 10 |

Search

11 | 12 |
13 | 14 | {{ form.as_table }} 15 | 16 | 17 | 20 | 21 |
  18 | 19 |
22 | 23 | {% if query %} 24 |

Results

25 | 26 | {% for result in page.object_list %} 27 |

28 | {{ result.object.title }} 29 |

30 | {% empty %} 31 |

No results found.

32 | {% endfor %} 33 | 34 | {% if page.has_previous or page.has_next %} 35 |
36 | {% if page.has_previous %}{% endif %}« Previous{% if page.has_previous %}{% endif %} 37 | | 38 | {% if page.has_next %}{% endif %}Next »{% if page.has_next %}{% endif %} 39 |
40 | {% endif %} 41 | {% else %} 42 | {# Show some example queries to run, maybe query syntax, something else? #} 43 | {% endif %} 44 |
45 | {% endblock %} 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | from testapp.models import Note 5 | 6 | 7 | class NoteAdmin(admin.ModelAdmin): 8 | pass 9 | admin.site.register(Note, NoteAdmin) -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/admin.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/admin.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import models, migrations 5 | from django.conf import settings 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Note', 17 | fields=[ 18 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), 19 | ('pub_date', models.DateTimeField()), 20 | ('title', models.CharField(max_length=200)), 21 | ('body', models.TextField()), 22 | ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), 23 | ], 24 | options={ 25 | }, 26 | bases=(models.Model,), 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/migrations/0001_initial.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/migrations/0001_initial.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/migrations/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/migrations/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/migrations/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import User 3 | 4 | 5 | class Note(models.Model): 6 | user = models.ForeignKey(User) 7 | pub_date = models.DateTimeField() 8 | title = models.CharField(max_length=200) 9 | body = models.TextField() 10 | 11 | def __unicode__(self): 12 | return self.title -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/models.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/models.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/search_indexes.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from haystack import indexes 3 | from models import Note 4 | 5 | 6 | class NoteIndex(indexes.SearchIndex, indexes.Indexable): 7 | text = indexes.CharField(document=True, use_template=True) 8 | author = indexes.CharField(model_attr='user') 9 | pub_date = indexes.DateTimeField(model_attr='pub_date') 10 | 11 | def get_model(self): 12 | return Note 13 | 14 | def index_queryset(self, using=None): 15 | """Used when the entire index for model is updated.""" 16 | return self.get_model().objects.filter(pub_date__lte=datetime.datetime.now()) -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/search_indexes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testapp/search_indexes.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for testhystack project. 3 | 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/1.7/topics/settings/ 6 | 7 | For the full list of settings and their values, see 8 | https://docs.djangoproject.com/en/1.7/ref/settings/ 9 | """ 10 | 11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 12 | import os 13 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 14 | 15 | 16 | # Quick-start development settings - unsuitable for production 17 | # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ 18 | 19 | # SECURITY WARNING: keep the secret key used in production secret! 20 | SECRET_KEY = 'wmmol^^5dwr8c7=ps-qy(@63_e7$*-h+_9fyqlb%1e=rr)^p&_' 21 | 22 | # SECURITY WARNING: don't run with debug turned on in production! 23 | DEBUG = True 24 | 25 | TEMPLATE_DEBUG = True 26 | 27 | ALLOWED_HOSTS = [] 28 | 29 | 30 | # Application definition 31 | 32 | INSTALLED_APPS = ( 33 | 'django.contrib.admin', 34 | 'django.contrib.auth', 35 | 'django.contrib.contenttypes', 36 | 'django.contrib.sessions', 37 | 'django.contrib.messages', 38 | 'django.contrib.staticfiles', 39 | 'testapp', 40 | 'haystack', 41 | ) 42 | 43 | MIDDLEWARE_CLASSES = ( 44 | 'django.contrib.sessions.middleware.SessionMiddleware', 45 | 'django.middleware.common.CommonMiddleware', 46 | 'django.middleware.csrf.CsrfViewMiddleware', 47 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 48 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ) 52 | 53 | ROOT_URLCONF = 'testhystack.urls' 54 | 55 | WSGI_APPLICATION = 'testhystack.wsgi.application' 56 | 57 | 58 | # Database 59 | # https://docs.djangoproject.com/en/1.7/ref/settings/#databases 60 | 61 | DATABASES = { 62 | 'default': { 63 | 'ENGINE': 'django.db.backends.sqlite3', 64 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 65 | } 66 | } 67 | 68 | # Internationalization 69 | # https://docs.djangoproject.com/en/1.7/topics/i18n/ 70 | 71 | LANGUAGE_CODE = 'en-us' 72 | 73 | TIME_ZONE = 'UTC' 74 | 75 | USE_I18N = True 76 | 77 | USE_L10N = True 78 | 79 | USE_TZ = True 80 | 81 | 82 | # Static files (CSS, JavaScript, Images) 83 | # https://docs.djangoproject.com/en/1.7/howto/static-files/ 84 | 85 | STATIC_URL = '/static/' 86 | 87 | TEMPLATE_DIRS = ( 88 | os.path.join(BASE_DIR, 'templates'), 89 | ) 90 | 91 | 92 | 93 | # haystack configurations 94 | # http://django-haystack.readthedocs.org/en/v2.3.0/tutorial.html#installation 95 | 96 | HAYSTACK_CONNECTIONS = { 97 | 'default': { 98 | 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', 99 | 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'), 100 | }, 101 | } 102 | 103 | HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' 104 | 105 | # HAYSTACK_DEFAULT_OPERATOR = 'AND' 106 | # HAYSTACK_DEFAULT_OPERATOR = 'OR' 107 | 108 | INCLUDE_SPELLING = True -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/settings.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/settings.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | from django.contrib import admin 3 | urlpatterns = patterns('', 4 | # Examples: 5 | # url(r'^$', 'testhystack.views.home', name='home'), 6 | # url(r'^blog/', include('blog.urls')), 7 | 8 | (r'^search/', include('haystack.urls')), 9 | url(r'^admin/', include(admin.site.urls)), 10 | ) 11 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/urls.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/urls.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/whoosh_index/MAIN_WRITELOCK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/whoosh_index/MAIN_WRITELOCK -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/whoosh_index/MAIN_xb0ro8ioy77cv3fz.seg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/whoosh_index/MAIN_xb0ro8ioy77cv3fz.seg -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/whoosh_index/_MAIN_2.toc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/whoosh_index/_MAIN_2.toc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for testhystack project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testhystack.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/testhystack/wsgi.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/testhystack/wsgi.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2008 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | __version__ = (2, 6, 0) 29 | 30 | 31 | def versionstring(build=True, extra=True): 32 | """Returns the version number of Whoosh as a string. 33 | 34 | :param build: Whether to include the build number in the string. 35 | :param extra: Whether to include alpha/beta/rc etc. tags. Only 36 | checked if build is True. 37 | :rtype: str 38 | """ 39 | 40 | if build: 41 | first = 3 42 | else: 43 | first = 2 44 | 45 | s = ".".join(str(n) for n in __version__[:first]) 46 | if build and extra: 47 | s += "".join(str(n) for n in __version__[3:]) 48 | 49 | return s 50 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2007 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | """Classes and functions for turning a piece of text into an indexable stream 29 | of "tokens" (usually equivalent to words). There are three general classes 30 | involved in analysis: 31 | 32 | * Tokenizers are always at the start of the text processing pipeline. They take 33 | a string and yield Token objects (actually, the same token object over and 34 | over, for performance reasons) corresponding to the tokens (words) in the 35 | text. 36 | 37 | Every tokenizer is a callable that takes a string and returns an iterator of 38 | tokens. 39 | 40 | * Filters take the tokens from the tokenizer and perform various 41 | transformations on them. For example, the LowercaseFilter converts all tokens 42 | to lowercase, which is usually necessary when indexing regular English text. 43 | 44 | Every filter is a callable that takes a token generator and returns a token 45 | generator. 46 | 47 | * Analyzers are convenience functions/classes that "package up" a tokenizer and 48 | zero or more filters into a single unit. For example, the StandardAnalyzer 49 | combines a RegexTokenizer, LowercaseFilter, and StopFilter. 50 | 51 | Every analyzer is a callable that takes a string and returns a token 52 | iterator. (So Tokenizers can be used as Analyzers if you don't need any 53 | filtering). 54 | 55 | You can compose tokenizers and filters together using the ``|`` character:: 56 | 57 | my_analyzer = RegexTokenizer() | LowercaseFilter() | StopFilter() 58 | 59 | The first item must be a tokenizer and the rest must be filters (you can't put 60 | a filter first or a tokenizer after the first item). 61 | """ 62 | 63 | from whoosh.analysis.acore import * 64 | from whoosh.analysis.tokenizers import * 65 | from whoosh.analysis.filters import * 66 | from whoosh.analysis.morph import * 67 | from whoosh.analysis.intraword import * 68 | from whoosh.analysis.ngrams import * 69 | from whoosh.analysis.analyzers import * 70 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/acore.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/acore.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/analyzers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/analyzers.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/filters.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/filters.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/intraword.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/intraword.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/morph.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/morph.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/ngrams.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/ngrams.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/analysis/tokenizers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/analysis/tokenizers.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/automata/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/automata/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/automata/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/automata/fst.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/automata/fst.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/classify.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/classify.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/codec/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | 29 | def default_codec(*args, **kwargs): 30 | from whoosh.codec.whoosh3 import W3Codec 31 | 32 | return W3Codec(*args, **kwargs) 33 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/codec/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/codec/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/codec/base.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/codec/base.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/codec/whoosh3.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/codec/whoosh3.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/collectors.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/collectors.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/columns.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/columns.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/compat.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/compat.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/externalsort.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/externalsort.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/fields.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/fields.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/filedb/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/filedb/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/filedb/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/filedb/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/filedb/compound.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/filedb/compound.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/filedb/filestore.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/filedb/filestore.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/filedb/filetables.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/filedb/filetables.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/filedb/structfile.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/filedb/structfile.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/formats.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/formats.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/highlight.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/highlight.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/idsets.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/idsets.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/index.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/index.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/lang/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/lang/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/lang/dmetaphone.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/lang/dmetaphone.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/lang/morph_en.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/lang/morph_en.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/lang/porter.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/lang/porter.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/lang/snowball/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2001-2012 NLTK Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an 'AS IS' BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | # Natural Language Toolkit: Snowball Stemmer 17 | # 18 | # Copyright (C) 2001-2012 NLTK Project 19 | # Author: Peter Michael Stahl 20 | # Peter Ljunglof (revisions) 21 | # Algorithms: Dr Martin Porter 22 | # URL: 23 | # For license information, see LICENSE.TXT 24 | 25 | # HJ 2012/07/19 adapted from https://github.com/kmike/nltk.git (branch 2and3) 26 | # 2.0.1rc4-256-g45768f8 27 | 28 | """ 29 | This module provides a port of the Snowball stemmers developed by Martin 30 | Porter. 31 | 32 | At the moment, this port is able to stem words from fourteen languages: Danish, 33 | Dutch, English, Finnish, French, German, Hungarian, Italian, Norwegian, 34 | Portuguese, Romanian, Russian, Spanish and Swedish. 35 | 36 | The algorithms have been developed by Martin Porter. These stemmers are called 37 | Snowball, because he invented a programming language with this name for 38 | creating new stemming algorithms. There is more information available at 39 | http://snowball.tartarus.org/ 40 | """ 41 | 42 | from .danish import DanishStemmer 43 | from .dutch import DutchStemmer 44 | from .english import EnglishStemmer 45 | from .finnish import FinnishStemmer 46 | from .french import FrenchStemmer 47 | from .german import GermanStemmer 48 | from .hungarian import HungarianStemmer 49 | from .italian import ItalianStemmer 50 | from .norwegian import NorwegianStemmer 51 | from .portugese import PortugueseStemmer 52 | from .romanian import RomanianStemmer 53 | from .russian import RussianStemmer 54 | from .spanish import SpanishStemmer 55 | from .swedish import SwedishStemmer 56 | 57 | 58 | # Map two-letter codes to stemming classes 59 | 60 | classes = {"da": DanishStemmer, 61 | "nl": DutchStemmer, 62 | "en": EnglishStemmer, 63 | "fi": FinnishStemmer, 64 | "fr": FrenchStemmer, 65 | "de": GermanStemmer, 66 | "hu": HungarianStemmer, 67 | "it": ItalianStemmer, 68 | "no": NorwegianStemmer, 69 | "pt": PortugueseStemmer, 70 | "ro": RomanianStemmer, 71 | "ru": RussianStemmer, 72 | "es": SpanishStemmer, 73 | "sv": SwedishStemmer, 74 | } 75 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/lang/snowball/norwegian.py: -------------------------------------------------------------------------------- 1 | from .bases import _ScandinavianStemmer 2 | 3 | from whoosh.compat import u 4 | 5 | 6 | class NorwegianStemmer(_ScandinavianStemmer): 7 | 8 | """ 9 | The Norwegian Snowball stemmer. 10 | 11 | :cvar __vowels: The Norwegian vowels. 12 | :type __vowels: unicode 13 | :cvar __s_ending: Letters that may directly appear before a word final 's'. 14 | :type __s_ending: unicode 15 | :cvar __step1_suffixes: Suffixes to be deleted in step 1 of the algorithm. 16 | :type __step1_suffixes: tuple 17 | :cvar __step2_suffixes: Suffixes to be deleted in step 2 of the algorithm. 18 | :type __step2_suffixes: tuple 19 | :cvar __step3_suffixes: Suffixes to be deleted in step 3 of the algorithm. 20 | :type __step3_suffixes: tuple 21 | :note: A detailed description of the Norwegian 22 | stemming algorithm can be found under 23 | http://snowball.tartarus.org/algorithms/norwegian/stemmer.html 24 | 25 | """ 26 | 27 | __vowels = u("aeiouy\xE6\xE5\xF8") 28 | __s_ending = "bcdfghjlmnoprtvyz" 29 | __step1_suffixes = ("hetenes", "hetene", "hetens", "heter", 30 | "heten", "endes", "ande", "ende", "edes", 31 | "enes", "erte", "ede", "ane", "ene", "ens", 32 | "ers", "ets", "het", "ast", "ert", "en", 33 | "ar", "er", "as", "es", "et", "a", "e", "s") 34 | 35 | __step2_suffixes = ("dt", "vt") 36 | 37 | __step3_suffixes = ("hetslov", "eleg", "elig", "elov", "slov", 38 | "leg", "eig", "lig", "els", "lov", "ig") 39 | 40 | def stem(self, word): 41 | """ 42 | Stem a Norwegian word and return the stemmed form. 43 | 44 | :param word: The word that is stemmed. 45 | :type word: str or unicode 46 | :return: The stemmed form. 47 | :rtype: unicode 48 | 49 | """ 50 | word = word.lower() 51 | 52 | r1 = self._r1_scandinavian(word, self.__vowels) 53 | 54 | # STEP 1 55 | for suffix in self.__step1_suffixes: 56 | if r1.endswith(suffix): 57 | if suffix in ("erte", "ert"): 58 | word = "".join((word[:-len(suffix)], "er")) 59 | r1 = "".join((r1[:-len(suffix)], "er")) 60 | 61 | elif suffix == "s": 62 | if (word[-2] in self.__s_ending or 63 | (word[-2] == "k" and word[-3] not in self.__vowels)): 64 | word = word[:-1] 65 | r1 = r1[:-1] 66 | else: 67 | word = word[:-len(suffix)] 68 | r1 = r1[:-len(suffix)] 69 | break 70 | 71 | # STEP 2 72 | for suffix in self.__step2_suffixes: 73 | if r1.endswith(suffix): 74 | word = word[:-1] 75 | r1 = r1[:-1] 76 | break 77 | 78 | # STEP 3 79 | for suffix in self.__step3_suffixes: 80 | if r1.endswith(suffix): 81 | word = word[:-len(suffix)] 82 | break 83 | 84 | return word 85 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/lang/snowball/swedish.py: -------------------------------------------------------------------------------- 1 | from .bases import _ScandinavianStemmer 2 | 3 | from whoosh.compat import u 4 | 5 | 6 | class SwedishStemmer(_ScandinavianStemmer): 7 | 8 | """ 9 | The Swedish Snowball stemmer. 10 | 11 | :cvar __vowels: The Swedish vowels. 12 | :type __vowels: unicode 13 | :cvar __s_ending: Letters that may directly appear before a word final 's'. 14 | :type __s_ending: unicode 15 | :cvar __step1_suffixes: Suffixes to be deleted in step 1 of the algorithm. 16 | :type __step1_suffixes: tuple 17 | :cvar __step2_suffixes: Suffixes to be deleted in step 2 of the algorithm. 18 | :type __step2_suffixes: tuple 19 | :cvar __step3_suffixes: Suffixes to be deleted in step 3 of the algorithm. 20 | :type __step3_suffixes: tuple 21 | :note: A detailed description of the Swedish 22 | stemming algorithm can be found under 23 | http://snowball.tartarus.org/algorithms/swedish/stemmer.html 24 | """ 25 | 26 | __vowels = u("aeiouy\xE4\xE5\xF6") 27 | __s_ending = "bcdfghjklmnoprtvy" 28 | __step1_suffixes = ("heterna", "hetens", "heter", "heten", 29 | "anden", "arnas", "ernas", "ornas", "andes", 30 | "andet", "arens", "arna", "erna", "orna", 31 | "ande", "arne", "aste", "aren", "ades", 32 | "erns", "ade", "are", "ern", "ens", "het", 33 | "ast", "ad", "en", "ar", "er", "or", "as", 34 | "es", "at", "a", "e", "s") 35 | __step2_suffixes = ("dd", "gd", "nn", "dt", "gt", "kt", "tt") 36 | __step3_suffixes = ("fullt", u("l\xF6st"), "els", "lig", "ig") 37 | 38 | def stem(self, word): 39 | """ 40 | Stem a Swedish word and return the stemmed form. 41 | 42 | :param word: The word that is stemmed. 43 | :type word: str or unicode 44 | :return: The stemmed form. 45 | :rtype: unicode 46 | 47 | """ 48 | word = word.lower() 49 | 50 | r1 = self._r1_scandinavian(word, self.__vowels) 51 | 52 | # STEP 1 53 | for suffix in self.__step1_suffixes: 54 | if r1.endswith(suffix): 55 | if suffix == "s": 56 | if word[-2] in self.__s_ending: 57 | word = word[:-1] 58 | r1 = r1[:-1] 59 | else: 60 | word = word[:-len(suffix)] 61 | r1 = r1[:-len(suffix)] 62 | break 63 | 64 | # STEP 2 65 | for suffix in self.__step2_suffixes: 66 | if r1.endswith(suffix): 67 | word = word[:-1] 68 | r1 = r1[:-1] 69 | break 70 | 71 | # STEP 3 72 | for suffix in self.__step3_suffixes: 73 | if r1.endswith(suffix): 74 | if suffix in ("els", "lig", "ig"): 75 | word = word[:-len(suffix)] 76 | elif suffix in ("fullt", u("l\xF6st")): 77 | word = word[:-1] 78 | break 79 | 80 | return word 81 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/legacy.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | """ 29 | This module contains code for maintaining backwards compatibility with old 30 | index formats. 31 | """ 32 | 33 | from whoosh.util.loading import RenamingUnpickler 34 | 35 | 36 | def load_110_toc(stream, gen, schema, version): 37 | # Between version -110 and version -111, I reorganized the modules and 38 | # changed the implementation of the NUMERIC field, so we have to change the 39 | # classes the unpickler tries to load if we need to read an old schema 40 | 41 | # Read the length of the pickled schema 42 | picklen = stream.read_varint() 43 | if schema: 44 | # If the user passed us a schema, use it and skip the one on disk 45 | stream.seek(picklen, 1) 46 | else: 47 | # Remap the old classes and functions to their moved versions as we 48 | # unpickle the schema 49 | scuts = {"wf": "whoosh.fields", 50 | "wsn": "whoosh.support.numeric", 51 | "wcw2": "whoosh.codec.whoosh2"} 52 | objmap = {"%(wf)s.NUMERIC": "%(wcw2)s.OLD_NUMERIC", 53 | "%(wf)s.DATETIME": "%(wcw2)s.OLD_DATETIME", 54 | "%(wsn)s.int_to_text": "%(wcw2)s.int_to_text", 55 | "%(wsn)s.text_to_int": "%(wcw2)s.text_to_int", 56 | "%(wsn)s.long_to_text": "%(wcw2)s.long_to_text", 57 | "%(wsn)s.text_to_long": "%(wcw2)s.text_to_long", 58 | "%(wsn)s.float_to_text": "%(wcw2)s.float_to_text", 59 | "%(wsn)s.text_to_float": "%(wcw2)s.text_to_float", } 60 | ru = RenamingUnpickler(stream, objmap, shortcuts=scuts) 61 | schema = ru.load() 62 | # Read the generation number 63 | index_gen = stream.read_int() 64 | assert gen == index_gen 65 | # Unused number 66 | _ = stream.read_int() 67 | # Unpickle the list of segment objects 68 | segments = stream.read_pickle() 69 | return schema, segments 70 | 71 | 72 | # Map TOC version numbers to functions to load that version 73 | toc_loaders = {-110: load_110_toc} 74 | 75 | 76 | # Map segment class names to functions to load the segment 77 | segment_loaders = {} 78 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/legacy.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/legacy.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/matching/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | from whoosh.matching.mcore import * 29 | from whoosh.matching.binary import * 30 | from whoosh.matching.wrappers import * 31 | from whoosh.matching.combo import * 32 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/matching/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/matching/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/matching/binary.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/matching/binary.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/matching/combo.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/matching/combo.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/matching/mcore.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/matching/mcore.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/matching/wrappers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/matching/wrappers.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | from whoosh.qparser.default import * 29 | from whoosh.qparser.plugins import * 30 | from whoosh.qparser.syntax import * 31 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/qparser/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/common.py: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | """ 29 | This module contains common utility objects/functions for the other query 30 | parser modules. 31 | """ 32 | 33 | import sys 34 | 35 | from whoosh.compat import string_type 36 | 37 | 38 | class QueryParserError(Exception): 39 | def __init__(self, cause, msg=None): 40 | super(QueryParserError, self).__init__(str(cause)) 41 | self.cause = cause 42 | 43 | 44 | def get_single_text(field, text, **kwargs): 45 | """Returns the first token from an analyzer's output. 46 | """ 47 | 48 | for t in field.process_text(text, mode="query", **kwargs): 49 | return t 50 | 51 | 52 | def attach(q, stxnode): 53 | if q: 54 | try: 55 | q.startchar = stxnode.startchar 56 | q.endchar = stxnode.endchar 57 | except AttributeError: 58 | raise AttributeError("Can't set attribute on %s" 59 | % q.__class__.__name__) 60 | return q 61 | 62 | 63 | def print_debug(level, msg, out=sys.stderr): 64 | if level: 65 | out.write("%s%s\n" % (" " * (level - 1), msg)) 66 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/common.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/qparser/common.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/default.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/qparser/default.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/plugins.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/qparser/plugins.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/syntax.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/qparser/syntax.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/qparser/taggers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/qparser/taggers.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | from whoosh.query.qcore import * 29 | from whoosh.query.terms import * 30 | from whoosh.query.compound import * 31 | from whoosh.query.positional import * 32 | from whoosh.query.ranges import * 33 | from whoosh.query.wrappers import * 34 | from whoosh.query.nested import * 35 | from whoosh.query.qcolumns import * 36 | from whoosh.query.spans import * 37 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/compound.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/compound.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/nested.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/nested.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/positional.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/positional.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/qcolumns.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/qcolumns.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/qcore.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/qcore.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/ranges.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/ranges.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/spans.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/spans.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/terms.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/terms.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/query/wrappers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/query/wrappers.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/reading.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/reading.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/scoring.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/scoring.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/searching.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/searching.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/sorting.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/sorting.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/support/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/support/__init__.py -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/support/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/support/__init__.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/support/base85.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module contains generic base85 encoding and decoding functions. The 3 | whoosh.util.numeric module contains faster variants for encoding and 4 | decoding integers. 5 | 6 | Modified from: 7 | http://paste.lisp.org/display/72815 8 | """ 9 | 10 | import struct 11 | 12 | from whoosh.compat import xrange 13 | 14 | 15 | # Instead of using the character set from the ascii85 algorithm, I put the 16 | # characters in order so that the encoded text sorts properly (my life would be 17 | # a lot easier if they had just done that from the start) 18 | b85chars = ("!$%&*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" 19 | "^_abcdefghijklmnopqrstuvwxyz{|}~") 20 | b85dec = {} 21 | for i in range(len(b85chars)): 22 | b85dec[b85chars[i]] = i 23 | 24 | 25 | # Integer encoding and decoding functions 26 | 27 | def to_base85(x, islong=False): 28 | "Encodes the given integer using base 85." 29 | 30 | size = 10 if islong else 5 31 | rems = "" 32 | for i in xrange(size): 33 | rems = b85chars[x % 85] + rems 34 | x //= 85 35 | return rems 36 | 37 | 38 | def from_base85(text): 39 | "Decodes the given base 85 text into an integer." 40 | 41 | acc = 0 42 | for c in text: 43 | acc = acc * 85 + b85dec[c] 44 | return acc 45 | 46 | 47 | # Bytes encoding and decoding functions 48 | 49 | def b85encode(text, pad=False): 50 | l = len(text) 51 | r = l % 4 52 | if r: 53 | text += '\0' * (4 - r) 54 | longs = len(text) >> 2 55 | out = [] 56 | words = struct.unpack('>' + 'L' * longs, text[0:longs * 4]) 57 | for word in words: 58 | rems = [0, 0, 0, 0, 0] 59 | for i in range(4, -1, -1): 60 | rems[i] = b85chars[word % 85] 61 | word /= 85 62 | out.extend(rems) 63 | 64 | out = ''.join(out) 65 | if pad: 66 | return out 67 | 68 | # Trim padding 69 | olen = l % 4 70 | if olen: 71 | olen += 1 72 | olen += l / 4 * 5 73 | return out[0:olen] 74 | 75 | 76 | def b85decode(text): 77 | l = len(text) 78 | out = [] 79 | for i in range(0, len(text), 5): 80 | chunk = text[i:i + 5] 81 | acc = 0 82 | for j in range(len(chunk)): 83 | try: 84 | acc = acc * 85 + b85dec[chunk[j]] 85 | except KeyError: 86 | raise TypeError('Bad base85 character at byte %d' % (i + j)) 87 | if acc > 4294967295: 88 | raise OverflowError('Base85 overflow in hunk starting at byte %d' % i) 89 | out.append(acc) 90 | 91 | # Pad final chunk if necessary 92 | cl = l % 5 93 | if cl: 94 | acc *= 85 ** (5 - cl) 95 | if cl > 1: 96 | acc += 0xffffff >> (cl - 2) * 8 97 | out[-1] = acc 98 | 99 | out = struct.pack('>' + 'L' * ((l + 4) / 5), *out) 100 | if cl: 101 | out = out[:-(5 - cl)] 102 | 103 | return out 104 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/support/levenshtein.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains functions implementing edit distance algorithms. 3 | """ 4 | 5 | from whoosh.compat import xrange 6 | 7 | 8 | def levenshtein(seq1, seq2, limit=None): 9 | """Returns the Levenshtein edit distance between two strings. 10 | """ 11 | 12 | oneago = None 13 | thisrow = range(1, len(seq2) + 1) + [0] 14 | for x in xrange(len(seq1)): 15 | # Python lists wrap around for negative indices, so put the 16 | # leftmost column at the *end* of the list. This matches with 17 | # the zero-indexed strings and saves extra calculation. 18 | oneago, thisrow = thisrow, [0] * len(seq2) + [x + 1] 19 | for y in xrange(len(seq2)): 20 | delcost = oneago[y] + 1 21 | addcost = thisrow[y - 1] + 1 22 | subcost = oneago[y - 1] + (seq1[x] != seq2[y]) 23 | thisrow[y] = min(delcost, addcost, subcost) 24 | 25 | if limit and x > limit and min(thisrow) > limit: 26 | return limit + 1 27 | 28 | return thisrow[len(seq2) - 1] 29 | 30 | 31 | def damerau_levenshtein(seq1, seq2, limit=None): 32 | """Returns the Damerau-Levenshtein edit distance between two strings. 33 | """ 34 | 35 | oneago = None 36 | thisrow = list(range(1, len(seq2) + 1)) + [0] 37 | for x in xrange(len(seq1)): 38 | # Python lists wrap around for negative indices, so put the 39 | # leftmost column at the *end* of the list. This matches with 40 | # the zero-indexed strings and saves extra calculation. 41 | twoago, oneago, thisrow = oneago, thisrow, [0] * len(seq2) + [x + 1] 42 | for y in xrange(len(seq2)): 43 | delcost = oneago[y] + 1 44 | addcost = thisrow[y - 1] + 1 45 | subcost = oneago[y - 1] + (seq1[x] != seq2[y]) 46 | thisrow[y] = min(delcost, addcost, subcost) 47 | # This block deals with transpositions 48 | if (x > 0 and y > 0 and seq1[x] == seq2[y - 1] 49 | and seq1[x - 1] == seq2[y] and seq1[x] != seq2[y]): 50 | thisrow[y] = min(thisrow[y], twoago[y - 2] + 1) 51 | 52 | if limit and x > limit and min(thisrow) > limit: 53 | return limit + 1 54 | 55 | return thisrow[len(seq2) - 1] 56 | 57 | 58 | def relative(a, b): 59 | """Returns the relative distance between two strings, in the range 60 | [0-1] where 1 means total equality. 61 | """ 62 | 63 | d = distance(a, b) 64 | longer = float(max((len(a), len(b)))) 65 | shorter = float(min((len(a), len(b)))) 66 | r = ((longer - d) / longer) * (shorter / longer) 67 | return r 68 | 69 | 70 | distance = damerau_levenshtein 71 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/support/levenshtein.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/support/levenshtein.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/system.py: -------------------------------------------------------------------------------- 1 | # Copyright 2007 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | import sys 29 | from struct import Struct, calcsize 30 | 31 | 32 | IS_LITTLE = sys.byteorder == "little" 33 | 34 | _INT_SIZE = calcsize("!i") 35 | _SHORT_SIZE = calcsize("!H") 36 | _LONG_SIZE = calcsize("!Q") 37 | _FLOAT_SIZE = calcsize("!f") 38 | _DOUBLE_SIZE = calcsize("!d") 39 | 40 | _byte_struct = Struct("!B") 41 | _sbyte_struct = Struct("!b") 42 | _ushort_struct = Struct("!H") 43 | _int_struct = Struct("!i") 44 | _uint_struct = Struct("!I") 45 | _long_struct = Struct("!q") 46 | _ulong_struct = Struct("!Q") 47 | _float_struct = Struct("!f") 48 | _double_struct = Struct("!d") 49 | _ushort_le_struct = Struct(">> find_object("whoosh.analysis.StopFilter") 59 | 60 | """ 61 | 62 | if blacklist: 63 | for pre in blacklist: 64 | if name.startswith(pre): 65 | raise TypeError("%r: can't instantiate names starting with %r" 66 | % (name, pre)) 67 | if whitelist: 68 | passes = False 69 | for pre in whitelist: 70 | if name.startswith(pre): 71 | passes = True 72 | break 73 | if not passes: 74 | raise TypeError("Can't instantiate %r" % name) 75 | 76 | lastdot = name.rfind(".") 77 | 78 | assert lastdot > -1, "Name %r must be fully qualified" % name 79 | modname = name[:lastdot] 80 | clsname = name[lastdot + 1:] 81 | 82 | mod = __import__(modname, fromlist=[clsname]) 83 | cls = getattr(mod, clsname) 84 | return cls 85 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/util/loading.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/util/loading.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/util/numeric.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/util/numeric.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/util/numlists.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/util/numlists.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/util/text.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/util/text.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/util/times.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/util/times.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/util/varints.py: -------------------------------------------------------------------------------- 1 | # Copyright 2007 Matt Chaput. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are met: 5 | # 6 | # 1. Redistributions of source code must retain the above copyright notice, 7 | # this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY MATT CHAPUT ``AS IS'' AND ANY EXPRESS OR 14 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL MATT CHAPUT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 19 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 22 | # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # The views and conclusions contained in the software and documentation are 25 | # those of the authors and should not be interpreted as representing official 26 | # policies, either expressed or implied, of Matt Chaput. 27 | 28 | from array import array 29 | 30 | from whoosh.compat import array_tobytes, xrange 31 | 32 | 33 | # Varint cache 34 | 35 | # Build a cache of the varint byte sequences for the first N integers, so we 36 | # don't have to constantly recalculate them on the fly. This makes a small but 37 | # noticeable difference. 38 | 39 | def _varint(i): 40 | a = array("B") 41 | while (i & ~0x7F) != 0: 42 | a.append((i & 0x7F) | 0x80) 43 | i = i >> 7 44 | a.append(i) 45 | return array_tobytes(a) 46 | 47 | 48 | _varint_cache_size = 512 49 | _varint_cache = [] 50 | for i in xrange(0, _varint_cache_size): 51 | _varint_cache.append(_varint(i)) 52 | _varint_cache = tuple(_varint_cache) 53 | 54 | 55 | def varint(i): 56 | """Encodes the given integer into a string of the minimum number of bytes. 57 | """ 58 | if i < len(_varint_cache): 59 | return _varint_cache[i] 60 | return _varint(i) 61 | 62 | 63 | def varint_to_int(vi): 64 | b = ord(vi[0]) 65 | p = 1 66 | i = b & 0x7f 67 | shift = 7 68 | while b & 0x80 != 0: 69 | b = ord(vi[p]) 70 | p += 1 71 | i |= (b & 0x7F) << shift 72 | shift += 7 73 | return i 74 | 75 | 76 | def signed_varint(i): 77 | """Zig-zag encodes a signed integer into a varint. 78 | """ 79 | 80 | if i >= 0: 81 | return varint(i << 1) 82 | return varint((i << 1) ^ (~0)) 83 | 84 | 85 | def decode_signed_varint(i): 86 | """Zig-zag decodes an integer value. 87 | """ 88 | 89 | if not i & 1: 90 | return i >> 1 91 | return (i >> 1) ^ (~0) 92 | 93 | 94 | def read_varint(readfn): 95 | """ 96 | Reads a variable-length encoded integer. 97 | 98 | :param readfn: a callable that reads a given number of bytes, 99 | like file.read(). 100 | """ 101 | 102 | b = ord(readfn(1)) 103 | i = b & 0x7F 104 | 105 | shift = 7 106 | while b & 0x80 != 0: 107 | b = ord(readfn(1)) 108 | i |= (b & 0x7F) << shift 109 | shift += 7 110 | return i 111 | -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/util/varints.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/util/varints.pyc -------------------------------------------------------------------------------- /Haystack-with-Whoosh-Search/whoosh/writing.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Haystack-with-Whoosh-Search/whoosh/writing.pyc -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/db.sqlite3 -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sentiment.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 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/sentiment/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for sentiment project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.1.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.1/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '@$f$z6f40v3)(c6yv&83wqhflcc&rs&r!%t%-1lers_ip^jn+b' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'tweeter', 35 | 'django.contrib.admin', 36 | 'django.contrib.auth', 37 | 'django.contrib.contenttypes', 38 | 'django.contrib.sessions', 39 | 'django.contrib.messages', 40 | 'django.contrib.staticfiles', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'sentiment.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'sentiment.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.1/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.1/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.1/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/sentiment/urls.py: -------------------------------------------------------------------------------- 1 | """sentiment URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path(r'', include('tweeter.urls')) 22 | ] 23 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/sentiment/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for sentiment project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sentiment.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TweeterConfig(AppConfig): 5 | name = 'tweeter' 6 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/static/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/templates/layout.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 39 | 40 | {{{body}}} 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/templates/myapp/bar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ title }} 6 | 7 | 8 | 9 | 10 |
11 |

{{ title }}

12 |
13 |
14 | 15 | 52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/templates/myapp/chart.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {% load staticfiles %} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 |
23 |
24 |
25 | 26 | 27 |
28 |
29 |
30 | 31 | 49 | 50 | 99 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/templates/myapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 27 | 28 |
29 |
30 | 31 | 32 |
33 | 34 |
35 | 36 | 37 |
38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Django_sentiment/sentiment/tweeter/urls.py: -------------------------------------------------------------------------------- 1 | """visualization URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from . import views 19 | 20 | urlpatterns = [ 21 | path('', views.chart, name='chart'), 22 | path('fetch/', views.fetch, name='fetch'), 23 | path('company/', views.fetch, name='company') 24 | 25 | 26 | ] 27 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Readme.md: -------------------------------------------------------------------------------- 1 | Prototype for a single tweet ..... supply the tweet in text area to analyse for positive or negative . 2 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/Stock_market_news_feed.py: -------------------------------------------------------------------------------- 1 | 2 | # coding: utf-8 3 | 4 | # In[14]: 5 | 6 | 7 | import csv 8 | import time 9 | import requests 10 | from bs4 import BeautifulSoup 11 | from pattern.en import ngrams 12 | 13 | Base_url = "http://www.moneycontrol.com" 14 | 15 | 16 | companies = {'cadilahealthcare':'CHC','piramalenterprises':'PH05', 17 | 'glenmarkpharma':'GP08','glaxosmithklinepharmaceuticals':'GSK', 18 | 'sunpharmaceuticalindustries':'SPI','lupinlaboratories':'LL', 19 | 'cipla':'C','aurobindopharma':'AP', 20 | 'drreddyslaboratories':'DRL','divislaboratories':'DL03'} 21 | 22 | # Create a list of the news section urls of the respective companies 23 | url_list = ['http://www.moneycontrol.com/company-article/{}/news/{}#{}'.format(k,v,v) for k,v in companies.items()] 24 | print(url_list) 25 | 26 | 27 | # In[16]: 28 | 29 | 30 | # Create an empty list which will contain the selected news articles 31 | List_of_links = [] 32 | 33 | # Extract the relevant news articles weblinks from the news section of selected companies 34 | for urls in url_list: 35 | html = requests.get(urls) 36 | soup = BeautifulSoup(html.text,'html.parser') # Create a BeautifulSoup object 37 | 38 | # Retrieve a list of all the links and the titles for the respective links 39 | word1,word2,word3 = "US","USA","USFDA" 40 | 41 | sub_links = soup.find_all('a', class_='arial11_summ') 42 | for links in sub_links: 43 | sp = BeautifulSoup(str(links),'html.parser') # first convert into a string 44 | tag = sp.a 45 | if word1 in tag['title'] or word2 in tag['title'] or word3 in tag['title']: 46 | category_links = Base_url + tag["href"] 47 | List_of_links.append(category_links) 48 | time.sleep(3) 49 | 50 | 51 | # In[42]: 52 | 53 | 54 | # Remove the duplicate news articles based on News Title 55 | import json 56 | 57 | unique_links = list(set(List_of_links)) 58 | for q in unique_links: 59 | print(q) 60 | 61 | # Create a dictionary of positive/negative words related to the Pharma Sector 62 | #reader = csv.reader(open('dict.csv', 'r')) 63 | #pharma_dict = dict((rows[0],rows[1]) for rows in reader) 64 | 65 | # Creating an empty list which will be filled later with news article links, and Polarity values (pos/neg) 66 | #df =[] 67 | #print(df) 68 | 69 | 70 | # In[47]: 71 | 72 | 73 | # Open the choosen news articles and extract the main text 74 | for selected_links in unique_links: 75 | results_url = selected_links 76 | #print results_url 77 | 78 | results = requests.get(results_url) 79 | results_text = BeautifulSoup(results.text , "lxml") 80 | #print(results.text) 81 | #break 82 | extract_text = results_text.find(class_='arti-flow') 83 | try: 84 | data = json.loads(results_text.find('script', type='application/ld+json').text) 85 | except: 86 | continue 87 | #print(data['description']) 88 | #print(extract_text) 89 | #print(data) 90 | #final_text = extract_text.get_text() 91 | final_text = data['description'] 92 | #print(final_text) 93 | 94 | # Pre-processing the extracted text using ngrams function from the pattern package 95 | final_text1 = ngrams(final_text, n=1, punctuation=".,;:!?()[]{}`''\"@#$^&*+-|=~_", continuous=False) 96 | print (final_text1) 97 | 98 | 99 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/server.py: -------------------------------------------------------------------------------- 1 | 2 | # coding: utf-8 3 | 4 | # In[2]: 5 | 6 | 7 | import datetime 8 | import requests 9 | import os 10 | from os.path import basename 11 | import glob 12 | from bs4 import BeautifulSoup 13 | import pandas as pd 14 | import pprint 15 | import re 16 | import tweepy 17 | from tweepy import OAuthHandler 18 | from textblob import TextBlob 19 | 20 | from flask import Flask , render_template , request , redirect , url_for , jsonify 21 | 22 | 23 | # In[20]: 24 | 25 | 26 | #Flask 27 | 28 | #from flask import Flask 29 | app = Flask(__name__) 30 | 31 | _code = "" 32 | 33 | @app.route("/", methods=["GET","POST"]) 34 | #def hello_world(): 35 | # return 'Hello, World!' 36 | def main(): 37 | if(request.method == "POST"): 38 | _code = request.form['code'] 39 | 40 | 41 | return redirect(url_for('getcode' , code = _code )) 42 | # return render_template('index.html') 43 | else: 44 | 45 | return render_template('index.html' , var = "") 46 | 47 | 48 | 49 | @app.route("/search") 50 | def getcode(): 51 | _code = request.args['code'] 52 | news="" 53 | new="" 54 | news = _code.join(re.sub("(@[A-Za-z0-9]+)|([^0-9A-Za-z \t]) |(\w+:\/\/\S+)", " ", _code).split()) 55 | new = _code 56 | 57 | analysis = TextBlob(new) 58 | # set sentiment 59 | pos = "Positive" 60 | neg = "Negative" 61 | #print(analysis.sentiment.polarity) 62 | if analysis.sentiment.polarity > 0: 63 | return render_template('pos.html' , var = "") 64 | elif analysis.sentiment.polarity == 0: 65 | return render_template('neg.html' , var = "") 66 | else: 67 | return render_template('neg.html' , var = "") 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | if __name__ == "__main__": 76 | #app.run(host='127.0.0.1', debug=True, port=5000) 77 | app.run(debug=True) 78 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 29 | 30 |
31 |
32 | 33 | 34 |
35 | 36 |
37 | 38 | 39 |
40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/templates/neg.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 |

NEGATIVE

16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Sentiment_Analysis/Sentiment(V0.1)/templates/pos.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 |

POSITIVE

16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.6.3 2 | certifi==2018.11.29 3 | chardet==3.0.4 4 | defusedxml==0.5.0 5 | diff-match-patch==20181111 6 | Django==2.1.4 7 | django-import-export==1.1.0 8 | django-nose==1.4.6 9 | elasticsearch==5.0.1 10 | elasticsearch-dsl==5.0.0 11 | et-xmlfile==1.0.1 12 | idna==2.8 13 | inflection==0.3.1 14 | jdcal==1.4 15 | more-itertools==4.3.0 16 | nltk==3.4 17 | nose==1.3.7 18 | numpy==1.15.4 19 | oauthlib==2.1.0 20 | odfpy==1.4.0 21 | openpyxl==2.5.12 22 | pandas==0.23.4 23 | PySocks==1.6.8 24 | pyspark==2.2.1 25 | python-dateutil==2.6.0 26 | pytz==2018.7 27 | PyYAML==3.13 28 | Quandl==3.4.5 29 | requests==2.21.0 30 | requests-oauthlib==1.0.0 31 | singledispatch==3.4.0.3 32 | six==1.10.0 33 | tablib==0.12.1 34 | textblob==0.15.2 35 | tweepy==3.7.0 36 | unicodecsv==0.14.1 37 | urllib3==1.19.1 38 | xlrd==1.2.0 39 | xlwt==1.3.0 40 | -------------------------------------------------------------------------------- /visualization/AAPL.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/AAPL.h5 -------------------------------------------------------------------------------- /visualization/AAPL_close.save: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/AAPL_close.save -------------------------------------------------------------------------------- /visualization/AAPL_index.save: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/AAPL_index.save -------------------------------------------------------------------------------- /visualization/AAPL_volume.save: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/AAPL_volume.save -------------------------------------------------------------------------------- /visualization/CompanyData.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/CompanyData.xlsx -------------------------------------------------------------------------------- /visualization/Visualisation/CompanyData.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/Visualisation/CompanyData.xlsx -------------------------------------------------------------------------------- /visualization/Visualisation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/Visualisation/__init__.py -------------------------------------------------------------------------------- /visualization/Visualisation/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /visualization/Visualisation/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class VisualtisationConfig(AppConfig): 5 | name = 'Visualtisation' 6 | -------------------------------------------------------------------------------- /visualization/Visualisation/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /visualization/Visualisation/static/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /visualization/Visualisation/templates/layout.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 39 | 40 | {{{body}}} 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /visualization/Visualisation/templates/visualisation/chart.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {% load staticfiles %} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 |
23 | 24 |
25 |
26 | 32 |
33 |
34 |
35 | 36 | 37 |
38 |
39 |
40 | 41 | 42 |
43 |
44 |
45 | 46 | 64 | 65 | -------------------------------------------------------------------------------- /visualization/Visualisation/templates/visualisation/index.html: -------------------------------------------------------------------------------- 1 |

Yes i did it!

-------------------------------------------------------------------------------- /visualization/Visualisation/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /visualization/Visualisation/urls.py: -------------------------------------------------------------------------------- 1 | """visualization URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from . import views 19 | 20 | urlpatterns = [ 21 | path('', views.home, name='chart'), 22 | path('fetch/', views.fetch, name='fetch'), 23 | path('company/', views.fetch, name='company') 24 | 25 | 26 | ] 27 | -------------------------------------------------------------------------------- /visualization/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/db.sqlite3 -------------------------------------------------------------------------------- /visualization/elasticsearchapp/__init__.py: -------------------------------------------------------------------------------- 1 | default_app_config = 'elasticsearchapp.apps.ElasticsearchappConfig' -------------------------------------------------------------------------------- /visualization/elasticsearchapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Companies 3 | from import_export.admin import ImportExportModelAdmin 4 | 5 | # Register your models here. 6 | @admin.register(Companies) 7 | class CompanyAdmin(ImportExportModelAdmin): 8 | pass 9 | # Need to register my Company so it shows up in the admin 10 | # admin.site.register(Company) -------------------------------------------------------------------------------- /visualization/elasticsearchapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ElasticsearchappConfig(AppConfig): 5 | name = 'elasticsearchapp' 6 | 7 | def ready(self): 8 | import elasticsearchapp.signals -------------------------------------------------------------------------------- /visualization/elasticsearchapp/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.5 on 2017-01-07 02:06 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | import django.utils.timezone 9 | 10 | 11 | class Migration(migrations.Migration): 12 | 13 | initial = True 14 | 15 | dependencies = [ 16 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 17 | ] 18 | 19 | operations = [ 20 | migrations.CreateModel( 21 | name='BlogPost', 22 | fields=[ 23 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 24 | ('posted_date', models.DateField(default=django.utils.timezone.now)), 25 | ('title', models.CharField(max_length=200)), 26 | ('text', models.TextField(max_length=1000)), 27 | ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blogpost', to=settings.AUTH_USER_MODEL)), 28 | ], 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/migrations/0002_auto_20181208_1912.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.5 on 2018-12-08 13:42 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('elasticsearchapp', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Company', 17 | fields=[ 18 | ('compnumber', models.CharField(max_length=100, primary_key=True, serialize=False)), 19 | ('ticker', models.CharField(max_length=200)), 20 | ('longname', models.CharField(max_length=200)), 21 | ('shortname', models.CharField(max_length=200)), 22 | ('country', models.CharField(max_length=200)), 23 | ], 24 | ), 25 | migrations.RemoveField( 26 | model_name='blogpost', 27 | name='author', 28 | ), 29 | migrations.DeleteModel( 30 | name='BlogPost', 31 | ), 32 | ] 33 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/migrations/0003_company_id.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.5 on 2018-12-08 15:23 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('elasticsearchapp', '0002_auto_20181208_1912'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='company', 17 | name='id', 18 | field=models.IntegerField(default=1), 19 | preserve_default=False, 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/migrations/0004_auto_20181208_2116.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.5 on 2018-12-08 15:46 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('elasticsearchapp', '0003_company_id'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Companies', 17 | fields=[ 18 | ('id', models.IntegerField(default=0)), 19 | ('compnumber', models.CharField(max_length=100, primary_key=True, serialize=False)), 20 | ('ticker', models.CharField(max_length=200)), 21 | ('longname', models.CharField(max_length=200)), 22 | ('shortname', models.CharField(max_length=200)), 23 | ('country', models.CharField(max_length=200)), 24 | ], 25 | ), 26 | migrations.DeleteModel( 27 | name='Company', 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/elasticsearchapp/migrations/__init__.py -------------------------------------------------------------------------------- /visualization/elasticsearchapp/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.utils import timezone 3 | from django.contrib.auth.models import User 4 | from .search import CompanyIndex 5 | 6 | # Create your models here. 7 | 8 | # Companies to be indexed into ElasticSearch 9 | 10 | 11 | class Companies(models.Model): 12 | id = models.IntegerField(default=0) 13 | compnumber = models.CharField(max_length=100, primary_key=True) 14 | ticker = models.CharField(max_length=200) 15 | longname = models.CharField(max_length=200) 16 | shortname = models.CharField(max_length=200) 17 | country = models.CharField(max_length=200) 18 | 19 | # Method for indexing the model 20 | def indexing(self): 21 | obj = CompanyIndex( 22 | meta={'id': self.compnumber}, 23 | id = self.compnumber, 24 | compnumber=self.compnumber, 25 | ticker=self.ticker, 26 | longname=self.longname, 27 | shortname=self.shortname, 28 | country=self.country 29 | ) 30 | obj.save() 31 | return obj.to_dict(include_meta=True) 32 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/search.py: -------------------------------------------------------------------------------- 1 | from elasticsearch_dsl.connections import connections 2 | from elasticsearch_dsl import DocType, Text, Date, Search 3 | from elasticsearch.helpers import bulk 4 | from elasticsearch import Elasticsearch 5 | from elasticsearch_dsl import Q 6 | from . import models 7 | 8 | # Create a connection to ElasticSearch 9 | connections.create_connection() 10 | 11 | # ElasticSearch "model" mapping out what fields to index 12 | class CompanyIndex(DocType): 13 | id = Text() 14 | compnumber = Text() 15 | ticker = Text() 16 | longname = Text() 17 | shortname = Text() 18 | country = Text() 19 | 20 | class Meta: 21 | index = 'companies-index' 22 | 23 | # Bulk indexing function, run in shell 24 | def bulk_indexing(): 25 | CompanyIndex.init() 26 | es = Elasticsearch() 27 | bulk(client=es, actions=(b.indexing() for b in models.Companies.objects.all().iterator())) 28 | 29 | # Simple search function 30 | def search(arg): 31 | q = Q('match', country=arg)| Q('match', shortname=arg) 32 | s = Search().query(q) 33 | # s = Search().query('match', country=arg)| Search().query('match', shortname=arg) 34 | response = s.execute() 35 | 36 | print(response) 37 | responseDictarray = [] 38 | 39 | for hit in response: 40 | i = 0 41 | responseDict = {} 42 | responseDict['compnumber'] = hit.compnumber 43 | responseDict['ticker'] = hit.ticker 44 | responseDict['longname'] = hit.longname 45 | responseDict['shortname'] = hit.shortname 46 | responseDict['country'] = hit.country 47 | 48 | responseDictarray.insert(i, responseDict) 49 | i = i + 1 50 | 51 | return responseDictarray 52 | 53 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/signals.py: -------------------------------------------------------------------------------- 1 | from .models import Companies 2 | from django.db.models.signals import post_save 3 | from django.dispatch import receiver 4 | 5 | 6 | # Signal to save each new blog post instance into ElasticSearch 7 | @receiver(post_save, sender=Companies) 8 | def index_post(sender, instance, **kwargs): 9 | print(instance) 10 | instance.indexing() 11 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Search App 7 | 70 | 71 | 72 |
73 |

Company Search

74 |
75 | 76 |
77 | {% block content %} 78 | {% endblock %} 79 |
80 | 81 |
82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /visualization/elasticsearchapp/urls.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Nov 27 14:31:08 2018 4 | 5 | @author: GUL 6 | """ 7 | from . import views 8 | from django.urls import path, include 9 | from django.contrib import admin 10 | 11 | urlpatterns = [ 12 | path('details/', views.searching , name='details'), 13 | # url(r'^details/(?P[\w.@+\- \,\.]+)/$', views.details, name='details'), 14 | path('search/', views.details, name='search'), 15 | ]; -------------------------------------------------------------------------------- /visualization/elasticsearchapp/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from .models import Companies 3 | from .search import search 4 | import pandas as pd 5 | import numpy as np 6 | # Create your views here. 7 | def details(request): 8 | # post = BlogPost.objects.get(shortname=shortname) 9 | arg = request.GET.get('arg') 10 | response = search(arg) 11 | # responseDummy = response 12 | # responseDummy = pd.DataFrame(responseDummy) 13 | # print(responseDummy) 14 | # countries = responseDummy[responseDummy.columns[1]].values[:] 15 | # countries = list(countries) 16 | # countries = responseDummy.ix[:,1] 17 | # countries = countries.to_json(orient='records') 18 | # print(countries) 19 | return render(request, 'details.html',{'company': response}) 20 | 21 | def searching(request): 22 | return render(request, 'details.html') 23 | -------------------------------------------------------------------------------- /visualization/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'visualization.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 | -------------------------------------------------------------------------------- /visualization/myapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post 3 | 4 | admin.site.register(Post) -------------------------------------------------------------------------------- /visualization/myapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MyappConfig(AppConfig): 5 | name = 'myapp' 6 | -------------------------------------------------------------------------------- /visualization/myapp/models.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import models 3 | from django.utils import timezone 4 | 5 | 6 | class Post(models.Model): 7 | author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) 8 | title = models.CharField(max_length=200) 9 | text = models.TextField() 10 | created_date = models.DateTimeField(default=timezone.now) 11 | published_date = models.DateTimeField(blank=True, null=True) 12 | 13 | def publish(self): 14 | self.published_date = timezone.now() 15 | self.save() 16 | 17 | def __str__(self): 18 | return self.title -------------------------------------------------------------------------------- /visualization/myapp/static/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.1.3 (https://getbootstrap.com/) 3 | * Copyright 2011-2018 The Bootstrap Authors 4 | * Copyright 2011-2018 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /visualization/myapp/static/css/myapp.css: -------------------------------------------------------------------------------- 1 | h1 a, h2 a { 2 | color: #C25100; 3 | font-family: 'Lobster'; 4 | } 5 | 6 | .page-header { 7 | background-color: #C25100; 8 | margin-top: 0; 9 | padding: 20px 20px 20px 40px; 10 | } 11 | 12 | .page-header h1, .page-header h1 a, .page-header h1 a:visited, .page-header h1 a:active { 13 | color: #ffffff; 14 | font-size: 36pt; 15 | text-decoration: none; 16 | } 17 | 18 | .content { 19 | margin-left: 40px; 20 | } 21 | 22 | h1, h2, h3, h4 { 23 | font-family: 'Lobster', cursive; 24 | } 25 | 26 | .date { 27 | color: #828282; 28 | } 29 | 30 | .save { 31 | float: right; 32 | } 33 | 34 | .post-form textarea, .post-form input { 35 | width: 100%; 36 | } 37 | 38 | .top-menu, .top-menu:hover, .top-menu:visited { 39 | color: #ffffff; 40 | float: right; 41 | font-size: 26pt; 42 | margin-right: 20px; 43 | } 44 | 45 | .post { 46 | margin-bottom: 70px; 47 | } 48 | 49 | .post h1 a, .post h1 a:visited { 50 | color: #000000; 51 | } -------------------------------------------------------------------------------- /visualization/myapp/static/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /visualization/myapp/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /visualization/myapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from . import views 3 | 4 | urlpatterns = [ 5 | url(r'', views.fetch_compare, name='fetch'), 6 | url(r'fetch/', views.fetch_compare, name='fetch_compare'), 7 | url(r'company/', views.fetch_compare, name='company_compare') 8 | ] -------------------------------------------------------------------------------- /visualization/tweeter/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /visualization/tweeter/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TweeterConfig(AppConfig): 5 | name = 'tweeter' 6 | -------------------------------------------------------------------------------- /visualization/tweeter/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /visualization/tweeter/static/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /visualization/tweeter/templates/layout.handlebars: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 39 | 40 | {{{body}}} 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /visualization/tweeter/templates/myapp/bar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ title }} 6 | 7 | 8 | 9 | 10 |
11 |

{{ title }}

12 |
13 |
14 | 15 | 52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /visualization/tweeter/templates/myapp/chart.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {% load staticfiles %} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 |
23 |
24 |
25 | 26 | 27 |
28 |
29 |
30 | 31 | 49 | 50 | 99 | -------------------------------------------------------------------------------- /visualization/tweeter/templates/myapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 27 | 28 |
29 |
30 | 31 | 32 |
33 | 34 |
35 | 36 | 37 |
38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /visualization/tweeter/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /visualization/tweeter/urls.py: -------------------------------------------------------------------------------- 1 | """visualization URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, url 14 | 2. Add a URL to urlpatterns: url('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path,include 18 | from . import views 19 | 20 | urlpatterns = [ 21 | path('', views.fetch, name='chart'), 22 | path('fetch/', views.fetch, name='fetch'), 23 | path('company/', views.fetch, name='company') 24 | 25 | 26 | ] 27 | -------------------------------------------------------------------------------- /visualization/unittestsearch.py: -------------------------------------------------------------------------------- 1 | from django.core.management import call_command 2 | from django.test import TestCase 3 | from elasticsearchapp.models import Companies 4 | 5 | 6 | 7 | class IntegrationTestUsers(TestCase): 8 | def test_search_users_in_elasticsearch(self): 9 | c = Companies.objects.create(id = 372, 10 | compnumber= 372, 11 | ticker="AIG", 12 | longname="American International Group Inc", 13 | shortname="American International Group", 14 | country="USA") 15 | c = Companies.objects.create(id = 76258, 16 | compnumber=76258, 17 | ticker="CB", 18 | longname="Chubb Ltd", 19 | shortname="Chubb Ltd", 20 | country="CHE") 21 | 22 | def test_details_page_status_code(self): 23 | response = self.client.get('/companies/details/') 24 | self.assertEquals(response.status_code, 200) 25 | 26 | def test_search_page_status_code_cmpny(self): 27 | response = self.client.get('/companies/search/',{'arg':'USA'}) 28 | self.assertEquals(response.status_code, 200) 29 | 30 | 31 | def test_search_page_status_code_shortName(self): 32 | response = self.client.get('/companies/search/',{'arg':'Chubb Ltd'}) 33 | self.assertEquals(response.status_code, 200) 34 | 35 | def test_search_page_value_shortName(self): 36 | response = self.client.get('/companies/search/',{'arg':'Chubb Ltd'}) 37 | self.assertIsNotNone(response) -------------------------------------------------------------------------------- /visualization/unittestvisual.py: -------------------------------------------------------------------------------- 1 | from django.core.management import call_command 2 | from django.test import TestCase 3 | from elasticsearchapp.models import Companies 4 | 5 | 6 | 7 | class IntegrationTestUsers(TestCase): 8 | # def test_search_users_in_elasticsearch(self): 9 | # c = Companies.objects.create(id = 372, 10 | # compnumber= 372, 11 | # ticker="AIG", 12 | # longname="American International Group Inc", 13 | # shortname="American International Group", 14 | # country="USA") 15 | # c = Companies.objects.create(id = 76258, 16 | # compnumber=76258, 17 | # ticker="CB", 18 | # longname="Chubb Ltd", 19 | # shortname="Chubb Ltd", 20 | # country="CHE") 21 | 22 | def test_details_page_status_code(self): 23 | response = self.client.get('/company/',{'company_name':'AAPL','start_date':'','end_date':''}) 24 | self.assertEquals(response.status_code, 200) 25 | 26 | def test_search_page_status_code_cmpny(self): 27 | response = self.client.get('/twitter/') 28 | self.assertEquals(response.status_code, 200) 29 | 30 | 31 | def test_search_page_status_code_shortName(self): 32 | response = self.client.get('/compare/') 33 | self.assertEquals(response.status_code, 200) 34 | 35 | # def test_search_page_value_shortName(self): 36 | # response = self.client.get('/companies/search/',{'arg':'Chubb Ltd'}) 37 | # self.assertIsNotNone(response) -------------------------------------------------------------------------------- /visualization/visualization/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapstoneProject18/Stock-Market-Analysis/b24c47e2cafa74bea71af5b5e1d1bebf3d052ef8/visualization/visualization/__init__.py -------------------------------------------------------------------------------- /visualization/visualization/requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.6.3 2 | certifi==2018.11.29 3 | chardet==3.0.4 4 | defusedxml==0.5.0 5 | diff-match-patch==20181111 6 | Django==2.1.4 7 | django-import-export==1.1.0 8 | django-nose==1.4.6 9 | elasticsearch==5.0.1 10 | elasticsearch-dsl==5.0.0 11 | et-xmlfile==1.0.1 12 | idna==2.8 13 | inflection==0.3.1 14 | jdcal==1.4 15 | more-itertools==4.3.0 16 | nltk==3.4 17 | nose==1.3.7 18 | numpy==1.15.4 19 | oauthlib==2.1.0 20 | odfpy==1.4.0 21 | openpyxl==2.5.12 22 | pandas==0.23.4 23 | PySocks==1.6.8 24 | pyspark==2.2.1 25 | python-dateutil==2.6.0 26 | pytz==2018.7 27 | PyYAML==3.13 28 | Quandl==3.4.5 29 | requests==2.21.0 30 | requests-oauthlib==1.0.0 31 | singledispatch==3.4.0.3 32 | six==1.10.0 33 | tablib==0.12.1 34 | textblob==0.15.2 35 | tweepy==3.7.0 36 | unicodecsv==0.14.1 37 | urllib3==1.19.1 38 | xlrd==1.2.0 39 | xlwt==1.3.0 40 | -------------------------------------------------------------------------------- /visualization/visualization/urls.py: -------------------------------------------------------------------------------- 1 | """visualization URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from . import views 19 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path('', include('Visualisation.urls')), 23 | path('compare/', include('myapp.urls')), 24 | path('twitter/', include('tweeter.urls')), 25 | path('companies/', include('elasticsearchapp.urls')) 26 | ] 27 | -------------------------------------------------------------------------------- /visualization/visualization/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | 3 | 4 | def index(request): 5 | return HttpResponse("Hello, world. You're at the polls index.yes") -------------------------------------------------------------------------------- /visualization/visualization/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for visualization project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'visualization.settings') 15 | 16 | application = get_wsgi_application() 17 | --------------------------------------------------------------------------------