diff --git a/app/blog/static/blog/images/one_protocol.png b/app/blog/static/blog/images/one_protocol.png new file mode 100644 index 0000000..33a3bf4 Binary files /dev/null and b/app/blog/static/blog/images/one_protocol.png differ diff --git a/app/blog/static/blog/images/one_speech.png b/app/blog/static/blog/images/one_speech.png new file mode 100644 index 0000000..c861fad Binary files /dev/null and b/app/blog/static/blog/images/one_speech.png differ diff --git a/app/blog/static/blog/images/slide_ngram_viewer.png b/app/blog/static/blog/images/slide_ngram_viewer.png new file mode 100644 index 0000000..6fc465d Binary files /dev/null and b/app/blog/static/blog/images/slide_ngram_viewer.png differ diff --git a/app/blog/static/blog/images/slider_profile.png b/app/blog/static/blog/images/slider_profile.png new file mode 100644 index 0000000..9463e96 Binary files /dev/null and b/app/blog/static/blog/images/slider_profile.png differ diff --git a/app/blog/templates/blog/about.html b/app/blog/templates/blog/about.html index e36fe6d..b3f55d9 100755 --- a/app/blog/templates/blog/about.html +++ b/app/blog/templates/blog/about.html @@ -1,9 +1,99 @@ {% extends "blog/base.html" %} +{% load static %} + + {% block content %} -
-
-

About page!

+
+
+
+
+

Die Masterarbeit

+

Diese Webseite sowie die für diese benötigten Daten sind im Rahmen einer Masterarbeit entstanden. In der Arbeit sind die Funktionsweise + der Software für die automatische Auszeichnung der + Bundestagsplenarprotokolle sowie die der Webanwendung + beschrieben. Die Arbeit kann hier gelesen werden.

+

Weiter unten sind einige grundlegende Aspekte des Projekts kurz beschrieben. Ebenfalls kann dort der Quellcode der Webanwendung und der Software für die automatische Auszeichnung heruntergeladen werden.

+
+
+
+
+
+
+
+
+

Datengrundlage

+

Die Ausgangsdaten, welche für das Projekt genutzt wurden, sind für + alle Bürger und Bürgerinnen auf der + Webseite des Bundestag + frei zugänglich.

+

Im Rahmen einer Open + Data-Initiative stellt der deutsche Bundestag alle Plenarprotokolle + sowie die biografischen Daten aller Abgeordneten seit 1949 als + XML-Dateien zur Verfügung.

+

+ Das Projekt Bundesdata umfasst alle XML-Protokolle der Wahlperioden 1. + bis 18. und deckt somit den Zeitraum von 1949 bis 2017 ab.

+

+
+
+
+
+
+
+
+
+

Automatische Auszeichnung

+

Da die von derBundesregierung bereitstellen XML-Protokolle nur wenig + bis keine maschinenlesbare Informationen dazu enthalten, welcher + Abgeordnete oder welche Abgeordnete zu welchem Zeitpunkt einen Redebeitrag + im Bundestag hatte, sind die Ausgangsdaten im Rahmen des Projekts + automatisch mit weiteren Informationen angereichert und strukturiert + worden. Hierfür wurde eine eigene Software entwickelt, die die öffentlich verfügbaren XML-Protokolle automatisch mit zusätzliche Metadaten auszeichnet. Diese Auszeichnung ermöglicht es die Protokolle auf der Website strukturiert darzustellen und durchsuchbar zu machen. Ebenfalls können so auch erst die N-Gramme für den Ngram Viewer berechnet werden.

+
+
+
+
+
+
+
+
+
+

Quellcode für Software und Webanwendung

+

+ Der Quellcode für die eigens entwickelte Software, welche die automatische + Auszeichnung erstellt hat, kann auf GitLab eingesehen und + heruntergeladen werden. Der Quellcode für die Webseite ist ebenfalls + auf GitLab verfügbar.

+
+
+
+
+
+
+
+
+
+

Download der ausgezeichneten Daten

+

+ Die für das Projekt mittels der eigenen Software erstellten XML-Protokolle sowie weitere Forschungsdaten können hier heruntergeladen werden.

+
+
+
+
+
+
+
+
+
+

Fehlerquoten und Probleme der Ausgangsdaten

+

Die automatische Auszeichnung der Protokolle ist nicht gänzlich fehlerfrei. + Somit können Fehler bei der Darstellung der Reden auf der Website auftreten. + Wie hoch genau die einzelen Fehlerqouten sind, ist in der Masterarbeit beschrieben

+
+
+
+
{% endblock content %} diff --git a/app/blog/templates/blog/base.html b/app/blog/templates/blog/base.html index a694160..cb87017 100755 --- a/app/blog/templates/blog/base.html +++ b/app/blog/templates/blog/base.html @@ -1,5 +1,10 @@ {% load static %} + + @@ -84,6 +89,9 @@ document.querySelectorAll('.dropdown-trigger'), {"coverTrigger": false} ) + document.addEventListener('DOMContentLoaded', function() { + M.Slider.init(document.querySelectorAll('.slider'), {}); + }); diff --git a/app/blog/templates/blog/blog.html b/app/blog/templates/blog/blog.html index 756ff11..869e142 100755 --- a/app/blog/templates/blog/blog.html +++ b/app/blog/templates/blog/blog.html @@ -1,5 +1,7 @@ {% extends "blog/base.html" %} + + {% block content %}
diff --git a/app/blog/templates/blog/home.html b/app/blog/templates/blog/home.html index dd9912c..d4867b9 100755 --- a/app/blog/templates/blog/home.html +++ b/app/blog/templates/blog/home.html @@ -1,6 +1,10 @@ {% extends "blog/base.html" %} {% load static %} + + {% block content %}
@@ -120,89 +124,46 @@ Mehr Informationen zum Projekt, der Arbeit, der Datengrundlage sowie der automatischen Auszeichnung mit zusätzlichen Informationen und Metadaten gibt es auf der Info-Seite.

-
-
+
-
-
-
-
-

Datengrundlage

-

Die Ausgangsdaten, welche für das Projekt genutzt wurden, sind für - alle Bürger und Bürgerinnen auf der - Webseite des Bundestag - frei zugänglich.

-

Im Rahmen einer Open - Data-Initiative stellt der deutsche Bundestag alle Plenarprotokolle - sowie die biografischen Daten aller Abgeordneten seit 1949 als - XML-Dateien zur Verfügung.

-

- Das Projekt Bundesdata umfasst alle XML-Protokolle der Wahlperioden 1. - bis 18. und deckt somit den Zeitraum von 1949 bis 2017 ab.

-

-
-
-
-
+
-

Automatische Auszeichnung

-

Da die von derBundesregierung bereitstellen XML-Protokolle nur wenig - bis keine maschinenlesbare Informationen dazu enthalten, welcher - Abgeordnete oder welche Abgeordnete zu welchem Zeitpunkt einen Redebeitrag - im Bundestag hatte, sind die Ausgangsdaten im Rahmen des Projekts - automatisch mit weiteren Informationen angereichert und strukturiert - worden. Hierfür wurde eine eigene Software entwickelt, die die öffentlich verfügbaren XML-Protokolle automatisch mit zusätzliche Metadaten auszeichnet. Diese Auszeichnung ermöglicht es die Protokolle auf der Website strukturiert darzustellen und durchsuchbar zu machen. Ebenfalls können so auch erst die N-Gramme für den Ngram Viewer berechnet werden.

+
+
+
    +
  • + +
    +
    +
  • +
  • + +
    +
    +
  • +
  • + +
    +
    +
  • +
  • + +
    +
    +
  • +
+
+
-
-
-
-
-

Quellcode für Software und Webanwendung

-

- Der Quellcode für die eigens entwickelte Software, welche die automatische - Auszeichnung erstellt hat, kann auf GitLab eingesehen und - heruntergeladen werden. Der Quellcode für die Webseite ist ebenfalls - auf GitLab verfügbar.

-
-
-
-
-
-
-
-
-
-

Download der ausgezeichneten Daten

-

- Die für das Projekt mittels der eigenen Software erstellten XML-Protokolle sowie weitere Forschungsdaten können hier heruntergeladen werden.

-
-
-
-
-
-
-
-
-
-

Fehlerquoten und Probleme der Ausgangsdaten

-

Die automatische Auszeichnung der Protokolle ist nicht gänzlich fehlerfrei. - Somit können Fehler bei der Darstellung der Reden auf der Website auftreten. - Wie hoch genau die einzelen Fehlerqouten sind, sowie weitere Informationen zum - Projekt, der Arbeit, der Datengrundlage und der automatischen Auszeichnung mit - zusätzlichen Informationen und Metadaten gibt es auf der - Info-Seite.

-
-
-
-
+
{% endblock content %} diff --git a/app/blog/templates/blog/impressum.html b/app/blog/templates/blog/impressum.html index 00eaaa1..3adfbc9 100755 --- a/app/blog/templates/blog/impressum.html +++ b/app/blog/templates/blog/impressum.html @@ -1,5 +1,7 @@ {% extends "blog/base.html" %} + + {% block content %}
@@ -50,8 +52,8 @@
Quelle der Bilder:

- Bild 4094966.jpg auf der Homepage: (c) Deutscher Bundestag / Marc-Steffen Unger
- Bild 4116197.jpg auf der Homepage: (c) Deutscher Bundestag / Thomas Köhler/photothek.net
+ Bild 4094966.jpg auf der Homepage und Infoseite: (c) Deutscher Bundestag / Marc-Steffen Unger
+ Bild 4116197.jpg auf der Homepage und Infoseite: (c) Deutscher Bundestag / Thomas Köhler/photothek.net

diff --git a/app/blog/urls.py b/app/blog/urls.py index 66f0493..63b831b 100755 --- a/app/blog/urls.py +++ b/app/blog/urls.py @@ -1,6 +1,10 @@ from django.urls import path from . import views +""" +Url paths for all blog views. +""" + urlpatterns = [ path("blog/", views.blog, name="blog"), path("about/", views.about, name="about-page"), diff --git a/app/blog/views.py b/app/blog/views.py index 5564993..4d96e84 100755 --- a/app/blog/views.py +++ b/app/blog/views.py @@ -2,16 +2,28 @@ from django.shortcuts import render def home(request): + """ + This view creates the homepage of the web app. + """ return render(request, "blog/home.html", {"title": "Homepage"}) def blog(request): + """ + This view creates a blog page. Not used right now. + """ return render(request, "blog/blog.html") def about(request): + """ + This view creates the abot/info page of the web app. + """ return render(request, "blog/about.html", {"title": "About"}) def impressum(request): + """ + This view creates the impressum page of the web app. + """ return render(request, "blog/impressum.html", {"title": "Impressum"}) diff --git a/app/ngram_viewer/charts.py b/app/ngram_viewer/charts.py index ac9af2e..e5255f1 100755 --- a/app/ngram_viewer/charts.py +++ b/app/ngram_viewer/charts.py @@ -20,6 +20,10 @@ class TimeChart(Chart): self.data_sets = None def get_datasets(self, **kwargs): + """ + Takes n number of data sets as an input and creates one data-line per + data set. + """ if kwargs is not None: for key, value in kwargs.items(): self.data_sets = value @@ -42,8 +46,6 @@ class TimeChart(Chart): class BarChart(Chart): """ Class to configure the N-Gramm Viewer bar chart per speaker. - The class function get_datasets() is used to get the data sets and creates - one data set for each. """ chart_type = "horizontalBar" responsive = True @@ -57,6 +59,9 @@ class BarChart(Chart): self.bar_names = [] def get_labels(self): + """ + Creates lables for the bar chart entries. + """ try: tmp_list = self.lable_names self.lable_names = sum(tmp_list, [])[:self.speaker_range] @@ -65,6 +70,10 @@ class BarChart(Chart): return self.lable_names def create_data(self, **kwargs): + """ + Takes n numer of data sets but only one is passed because the + Ngram Viewer per speaker is caped at one query at a time. + """ if kwargs is not None: for key, value in kwargs.items(): self.data_sets = value @@ -83,6 +92,10 @@ class BarChart(Chart): self.bar_data.append(entry_bar_data[:self.speaker_range]) def get_datasets(self): + """ + Takes the data sets from self.bar_data plus self.bar_names and creates + one bar per speaker from this. + """ data_set_objects = [] for bar_data, bar_name in zip(self.bar_data, self.bar_names): data_set_objects.append(DataSet(type="horizontalBar", diff --git a/app/ngram_viewer/forms.py b/app/ngram_viewer/forms.py index e1692fa..3aa552b 100755 --- a/app/ngram_viewer/forms.py +++ b/app/ngram_viewer/forms.py @@ -6,7 +6,7 @@ class NgramForm(forms.Form): Describes and configures the input html form for the Ngram Viewer per year. """ CORPUS_CHOICE = [('lm_ns_year', 'Lemmatisiert ohne Stoppwörter'), - ('tk_ws_year', 'Nicht lemmatisiert mit Stoppwörter'),] + ('tk_ws_year', 'Nicht lemmatisiert mit Stoppwörtern'),] query = forms.CharField(label="Suche Ngramme", max_length="200") case_sensitive = forms.BooleanField(label="case-sensitive", required=False) search_plus = forms.BooleanField(label="search-plus", required=False) @@ -19,7 +19,7 @@ class NgramFormSpeaker(forms.Form): Describes and configures the input html form for the Ngram Viewer per speaker. """ CORPUS_CHOICE = [('lm_ns_speaker', 'Lemmatisiert ohne Stoppwörter'), - ('tk_ws_speaker', 'Nicht lemmatisiert mit Stoppwörter'),] + ('tk_ws_speaker', 'Nicht lemmatisiert mit Stoppwörtern'),] query = forms.CharField(label="Suche Ngramm", max_length="200") case_sensitive = forms.BooleanField(label="case-sensitive", required=False) search_plus = forms.BooleanField(label="search-plus", required=False) diff --git a/app/ngram_viewer/management/commands/import_ngrams_bulk.py b/app/ngram_viewer/management/commands/import_ngrams_bulk.py index 8406a74..de635b3 100755 --- a/app/ngram_viewer/management/commands/import_ngrams_bulk.py +++ b/app/ngram_viewer/management/commands/import_ngrams_bulk.py @@ -13,26 +13,29 @@ class Command(BaseCommand): " syntax. N-grams will be added from csv files with three columns." " First column is the n-gram string, second column is the key " " (e.g. year or speaker) and the third column is the counter." - " Input is a path pointing to one n-gram file. The user must specify" - " if the csv is containing 1-grams, 2-grams ... 5-grams with the" - " parameter 'n_grams'.") + " Input (input_path) is a path pointing to one folder containing all" + " 37 alphabetical sorted n-gram csv-files for one kind of n-gram." + " Thus the user must specify with the parameter n_grams if the" + " csv-files in the folder are 1-grams, 2-grams etc." + " parameter 'n_grams'. The user also need to specifiy the corpus_type.") def add_arguments(self, parser): parser.add_argument("n_grams", type=int, choices=[1, 2, 3, 4, 5], help="Tells the script to either import given input\ - csv as 1-grams 2-grams etc.") + csv-files as 1-grams 2-grams etc.") parser.add_argument("input_folder", type=str, - help="File path to the csv containing one kind of \ - ngrams.") + help="File path to the csv-files containing one \ + kind of ngrams.") parser.add_argument("corpus_type", choices=["lm_ns_year", "tk_ws_year", "lm_ns_speaker", "tk_ws_speaker"], - help="user has to choose what kind of ngrams will \ - be imported. lm_ns: Lemmatized without stopwords or\ - tk_ws not lemmatized with stopwords.", + help="User has to choose what kind of ngrams will \ + be imported. lm_ns_year: Lemmatized without \ + stopwords per year, tk_ws_year: not lemmatized \ + with stopwords per year etc.", type=str) parser.add_argument( "--batch_size", @@ -41,7 +44,8 @@ class Command(BaseCommand): default=1000000, required=False, help="Int to set how many rows(entries) should be \ - inserted via bulk at once. Default is 1 million.") + inserted via bulk at once. Default is 1 million. \ + Optional parameter.") def handle(self, *args, **options): start_time = datetime.now() diff --git a/app/ngram_viewer/models.py b/app/ngram_viewer/models.py index d7106bc..eb3420d 100755 --- a/app/ngram_viewer/models.py +++ b/app/ngram_viewer/models.py @@ -6,16 +6,16 @@ automatically generated with the utils/create_ngram_models.py script. One model holds one kind of ngram. The name of the model follows a pattern describing the specific kind of ngam. For example: KeyA_TwoGram_lm_ns_year --> This model will create a table -contianing all lemmatized (lm) 2-grams without stopwords (ns) per year starting with the -letter "A" or "a". +contianing all lemmatized (lm) 2-grams without stopwords (ns) per year starting +with the letter "A" or "a". For example: Key_Non_ASCII_ThreeGram_tk_ws_speaker --> This model will create a table containing all tokenized (tk) 3-grams with stopwords (ws) per speaker starting with any non ASCII letter like ü, ö, ä or é. The Idea behind these splits and a single table for every kind of ngram is to minimize search times for the user. It would have been possible to create a table -for every 1-gram, 2-gram etc. But these would have benn pretty long (millions of) -rows. +for every 1-gram, 2-gram etc. But these would have benn pretty long (100 millions + of) rows. """ diff --git a/app/ngram_viewer/ngram_search.py b/app/ngram_viewer/ngram_search.py index c377974..774bd9e 100755 --- a/app/ngram_viewer/ngram_search.py +++ b/app/ngram_viewer/ngram_search.py @@ -10,9 +10,8 @@ class NgramSearch(object): """ Class that handles the search for ngrams per year. Inputs are the user query and search options. User query will be splitted and every split will be used - as a single query. Every singel query returns a QuerySet which will be - searched again with a regex to either match full words or partial words. - New regex evaluated QuerySets will be returned. Data from those will be + as a single query. + Every singel query returns a QuerySet. Data from those will be retrived and converted to valid chart.js data sets. Besides the query the user can pass some search options to the class like case sensitive and case insensitve. This Class handles search per year which is kind of the default. @@ -163,8 +162,8 @@ class NgramSearch(object): def query_sets_to_data(self): """ Converts QuerySets to data dictionaries. Fills missing years with zero - value counts for ngrams. Also sums upper and lower case n-grams to one ngram - with one count. + value counts for ngrams. Also sums upper and lower case n-grams to one + ngram with one count. """ data = [] for key, query_sets in self.filtered_sets_dict.items(): @@ -216,11 +215,9 @@ class NgramSearch(object): class NgramSearchSpeaker(NgramSearch): """ Class that handles the search for ngrams per speaker. Inputs are the user - query and search options. User query will be splitted and every split will - be used as a single query. Every singel query returns a QuerySet which will - be searched again with a regex to either match full words or partial words. - New regex evaluated QuerySets will be returned. Data from those will be - retrived and converted to valid chart.js data sets. Besides the query the + query and search options. User query can only contain one n-gram. + The query returns a QuerySet. Data from thise will be + retrived and converted to a valid chart.js data set. Besides the query the user can pass some search options to the class like case sensitive and case insensitve. Inherits from NgramSearch. """ @@ -261,8 +258,8 @@ class NgramSearchSpeaker(NgramSearch): def query_sets_to_data(self): """ - Converts QuerySets to data dictionaries. Fills missing years with zero - value counts for ngrams. Also sums upper and lower case n-grams to one ngram + Converts QuerySets to data dictionaries. + Also sums upper and lower case n-grams to one ngram with one count. """ data = [] diff --git a/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_speaker.html b/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_speaker.html index dce80e2..13f1b98 100755 --- a/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_speaker.html +++ b/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_speaker.html @@ -1,5 +1,8 @@ {% extends "blog/base.html" %} + + {% block nav-tabs %}

- Corpus:{{form.corpus_choice}} + Korpus:{{form.corpus_choice}}
Case-sensitive Suche: diff --git a/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_year.html b/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_year.html index c461dff..6e2fbba 100755 --- a/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_year.html +++ b/app/ngram_viewer/templates/ngram_viewer/ngram_viewer_year.html @@ -1,5 +1,8 @@ {% extends "blog/base.html" %} + + {% block nav-tabs %}

- Corpus:{{form.corpus_choice}} + Korpus:{{form.corpus_choice}}
Case-sensitive Suche: diff --git a/app/ngram_viewer/urls.py b/app/ngram_viewer/urls.py index a879d80..28089f3 100755 --- a/app/ngram_viewer/urls.py +++ b/app/ngram_viewer/urls.py @@ -1,6 +1,10 @@ from django.urls import path from . import views +""" +Url paths for all ngram_viewer views. +""" + urlpatterns = [ path("pro-jahr/", views.ngram_viewer_year, name="ngram-viewer-jahr"), path("pro-mdb/", views.ngram_viewer_speaker, name="ngram-viewer-sprecher") diff --git a/app/ngram_viewer/views.py b/app/ngram_viewer/views.py index 84ff018..8720208 100755 --- a/app/ngram_viewer/views.py +++ b/app/ngram_viewer/views.py @@ -6,6 +6,9 @@ from .ngram_search import NgramSearch, NgramSearchSpeaker def ngram_viewer_year(request): + """ + This view creates the Ngram Viewer page per year. + """ # logger = logging.getLogger(__name__) if(request.method == "GET"): form = NgramForm(request.GET) @@ -49,6 +52,9 @@ def ngram_viewer_year(request): def ngram_viewer_speaker(request): + """ + This view creates the Ngram Viewer page per speaker. + """ if(request.method == "GET"): form = NgramFormSpeaker(request.GET) if(form.is_valid()): diff --git a/app/speakers/tables.py b/app/speakers/tables.py index 77de716..e5e0c62 100755 --- a/app/speakers/tables.py +++ b/app/speakers/tables.py @@ -6,7 +6,8 @@ from django_tables2.utils import A # alias for Accessor class SpeakerTable(tables.Table): """ Configures the table showing all speakers. Inserts a column with links to - the profile of one speaker. Also defines all shown columns. + the profile of one speaker. Also defines all shown columns. The template + speakers/table.html is imported in line 19. """ link = tables.LinkColumn("MdB", text="Profil", args=[A("id")], orderable=False, diff --git a/app/speakers/templates/speakers/speaker.html b/app/speakers/templates/speakers/speaker.html index 67a4dbb..b452cf8 100755 --- a/app/speakers/templates/speakers/speaker.html +++ b/app/speakers/templates/speakers/speaker.html @@ -1,6 +1,8 @@ {% extends "blog/base.html" %} {% load render_table from django_tables2 %} + + {% block content %}
diff --git a/app/speakers/templates/speakers/speakers.html b/app/speakers/templates/speakers/speakers.html index 93e9b0a..9525c34 100755 --- a/app/speakers/templates/speakers/speakers.html +++ b/app/speakers/templates/speakers/speakers.html @@ -1,6 +1,9 @@ {% extends "blog/base.html" %} {% load render_table from django_tables2 %} + + {% block content %}
diff --git a/app/speakers/templates/speakers/table.html b/app/speakers/templates/speakers/table.html index b3b4754..584a44f 100755 --- a/app/speakers/templates/speakers/table.html +++ b/app/speakers/templates/speakers/table.html @@ -1,5 +1,9 @@ {% load django_tables2 %} {% load i18n %} + + + {% block table-wrapper %} {% block table %} diff --git a/app/speakers/urls.py b/app/speakers/urls.py index 2cc928b..754f45a 100755 --- a/app/speakers/urls.py +++ b/app/speakers/urls.py @@ -1,6 +1,10 @@ from django.urls import path from . import views +""" +Url paths for all speakers views. +""" + urlpatterns = [ path("", views.speakers, name="MdBs"), path("mdb/", views.speaker, name="MdB"), diff --git a/app/speakers/views.py b/app/speakers/views.py index 001bc16..a9c5b52 100755 --- a/app/speakers/views.py +++ b/app/speakers/views.py @@ -11,6 +11,9 @@ from speeches.forms import SearchFormSpeech def speakers(request): + """ + This view creates the page for the searchable speakers list. + """ if(request.method == "GET"): form = SearchForm(request.GET) if(form.is_valid()): @@ -30,6 +33,9 @@ def speakers(request): def speaker(request, id): + """ + This view creates the profile page of one speaker. + """ try: current_speaker = Speaker.objects.get(pk=id) speech_count = len(Speech.objects.filter(foreign_speaker=id)) diff --git a/app/speeches/management/commands/import_protocols.py b/app/speeches/management/commands/import_protocols.py index 47bc697..a0c09c0 100755 --- a/app/speeches/management/commands/import_protocols.py +++ b/app/speeches/management/commands/import_protocols.py @@ -13,8 +13,8 @@ class Command(BaseCommand): " syntax. Protocols will be added from the xml protocol files." " Input is a path pointing to all/multiple protocols in one" " directory with one level of subdirectories. First imports" - " toc, attachments and metadata with model Protocol. Speeches will be put into realtion with the model Speech." - " to the protocols later on.") + " toc, attachments and metadata with model Protocol. Speeches will" + " be put into realtion with the model Speech.") def add_arguments(self, parser): parser.add_argument("input_path", diff --git a/app/speeches/tables.py b/app/speeches/tables.py index afadf65..30510d9 100755 --- a/app/speeches/tables.py +++ b/app/speeches/tables.py @@ -6,7 +6,8 @@ from django_tables2.utils import A # alias for Accessor class SpeechTable(tables.Table): """ Configures the table showing all speeches. Inserts a column with links to - the speeches. Also defines all shown columns. + the speeches. Also defines all shown columns. The template + speeches/table.html is imported in line 21. """ link = tables.LinkColumn("Rede", text="Rede", args=[A("speech_id")], orderable=False, @@ -25,6 +26,8 @@ class SpeakerSpeechTable(tables.Table): """ Configures the table showing all speeches of one speaker in his profile. Inserts a column with links to the speeches. Also defines all shown columns. + The template + speeches/table.html is imported in line 39. """ link = tables.LinkColumn("Rede", text="Rede", args=[A("speech_id")], orderable=False, @@ -41,6 +44,8 @@ class ProtocolTable(tables.Table): """ Configures the table showing all protocols. Inserts a column with links to the protocols. Also defines all shown columns. + The template + speeches/table.html is imported in line 57. """ link = tables.LinkColumn("Protokoll", text="Protokoll", args=[A("protocol_id")], orderable=False, diff --git a/app/speeches/templates/speeches/protocol.html b/app/speeches/templates/speeches/protocol.html index 51fd9ce..dd7888b 100755 --- a/app/speeches/templates/speeches/protocol.html +++ b/app/speeches/templates/speeches/protocol.html @@ -1,6 +1,8 @@ {% extends "blog/base.html" %} {% load render_table from django_tables2 %} + + {% block content %}
diff --git a/app/speeches/templates/speeches/protocols.html b/app/speeches/templates/speeches/protocols.html index 1f39a3d..70b3420 100755 --- a/app/speeches/templates/speeches/protocols.html +++ b/app/speeches/templates/speeches/protocols.html @@ -1,6 +1,8 @@ {% extends "blog/base.html" %} {% load render_table from django_tables2 %} + + {% block content %}
diff --git a/app/speeches/templates/speeches/speech.html b/app/speeches/templates/speeches/speech.html index be65d14..3e0f09f 100755 --- a/app/speeches/templates/speeches/speech.html +++ b/app/speeches/templates/speeches/speech.html @@ -1,6 +1,8 @@ {% extends "blog/base.html" %} {% load render_table from django_tables2 %} + + {% block content %}
diff --git a/app/speeches/templates/speeches/speeches.html b/app/speeches/templates/speeches/speeches.html index 661ef0a..9f488b5 100755 --- a/app/speeches/templates/speeches/speeches.html +++ b/app/speeches/templates/speeches/speeches.html @@ -1,6 +1,8 @@ {% extends "blog/base.html" %} {% load render_table from django_tables2 %} + + {% block content %}
diff --git a/app/speeches/templates/speeches/table.html b/app/speeches/templates/speeches/table.html index b3b4754..584a44f 100755 --- a/app/speeches/templates/speeches/table.html +++ b/app/speeches/templates/speeches/table.html @@ -1,5 +1,9 @@ {% load django_tables2 %} {% load i18n %} + + + {% block table-wrapper %} {% block table %}
diff --git a/app/speeches/urls.py b/app/speeches/urls.py index 85b9469..bf7af4b 100755 --- a/app/speeches/urls.py +++ b/app/speeches/urls.py @@ -1,6 +1,10 @@ from django.urls import path from . import views +""" +Url paths for all speeches views. +""" + urlpatterns = [ path("reden/", views.speeches, name="Reden"), path("liste-protokolle/", views.protocols, name="Protokoll-list"), diff --git a/app/speeches/utils.py b/app/speeches/utils.py index 8894e33..a45d53e 100755 --- a/app/speeches/utils.py +++ b/app/speeches/utils.py @@ -4,7 +4,7 @@ from lxml import etree def create_html_speech(speech_content_xml_string): """ - COnverts the XML speech content into styled html. Also counts the words and + Converts the XML speech content into styled html. Also counts the words and shows the vocabulary. """ speech_html = "
" + speech_content_xml_string + "
" diff --git a/app/speeches/views.py b/app/speeches/views.py index 9838e64..544256c 100755 --- a/app/speeches/views.py +++ b/app/speeches/views.py @@ -10,6 +10,9 @@ from collections import Counter def speech(request, speech_id): + """ + This view creates the page of one speech. + """ try: current_speech = Speech.objects.get(pk=speech_id) if(current_speech.previous_speech_id is not None): @@ -50,6 +53,9 @@ def speech(request, speech_id): def speeches(request): + """ + This view creates the searchable list of all speeches. + """ if(request.method == "GET"): form = SearchFormSpeech(request.GET) if(form.is_valid()): @@ -69,6 +75,9 @@ def speeches(request): def protocol(request, protocol_id): + """ + This view creates the page of one protocol. + """ try: current_protocol = Protocol.objects.get(pk=protocol_id) related_speeches = Speech.objects.filter(foreign_protocol=protocol_id).order_by("speech_id") @@ -91,6 +100,9 @@ def protocol(request, protocol_id): def protocols(request): + """ + This view creates the searchable list of all protocols. + """ if(request.method == "GET"): form = SearchForm(request.GET) if(form.is_valid()): diff --git a/app/utils/create_ngram_models.py b/app/utils/create_ngram_models.py index ad74543..a15ae11 100755 --- a/app/utils/create_ngram_models.py +++ b/app/utils/create_ngram_models.py @@ -1,5 +1,5 @@ """ -Small script creating the models for the N-Gramm Viewer holding containing all +Small script creating the models for the N-Gramm Viewer containing all the different n-gramm data. """