From ec7dad8eba7ae864b7ad00215fa389854762b6e1 Mon Sep 17 00:00:00 2001 From: Ian Renfro Date: Wed, 18 Oct 2017 00:18:49 -0400 Subject: [PATCH 01/41] Easy update of python files on remote server I did not want to have to download the repo on the remote server so this script will update the files that I need --- SummarizationModule/remoteUpdate.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 SummarizationModule/remoteUpdate.sh diff --git a/SummarizationModule/remoteUpdate.sh b/SummarizationModule/remoteUpdate.sh new file mode 100755 index 0000000..fdb0afe --- /dev/null +++ b/SummarizationModule/remoteUpdate.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# AUTHORS: Ian Renfro +# +# PURPOSE: Use for downloading files from the git on a remote server without +# downloading the entire repo + +echo "Downloading New Version of LexicalChain.py" +wget -O LexicalChainNew.py https://raw.githubusercontent.com/simplif-ai/Application/develop/SummarizationModule/LexicalChain.py -q --show-progress +echo "Downloading New Version of Summarizer.py" +wget -O SummarizerNew.py https://raw.githubusercontent.com/simplif-ai/Application/develop/SummarizationModule/Summarizer.py -q --show-progress +echo "Downloading New Version of Passenger_WSGI.py" +wget -O passenger_wsgiNew.py https://raw.githubusercontent.com/simplif-ai/Application/develop/SummarizationModule/API/passenger_wsgi.py -q --show-progress +echo "Finished Downloading all files" From cbe87b548968432367f2e32488c48597f1179a80 Mon Sep 17 00:00:00 2001 From: Ian Renfro Date: Wed, 18 Oct 2017 00:19:20 -0400 Subject: [PATCH 02/41] Added docs to the API Added usage readme to the API --- SummarizationModule/API/README.md | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 SummarizationModule/API/README.md diff --git a/SummarizationModule/API/README.md b/SummarizationModule/API/README.md new file mode 100644 index 0000000..03a4657 --- /dev/null +++ b/SummarizationModule/API/README.md @@ -0,0 +1,39 @@ +# Simplif.ai's API + +#### API URL: https://ir.thirty2k.com/summarize + +## How to request a summarization +- You must make a POST request to the API URL, any other request will return an error. +- The format of the body of the data must be as follows + * Must be JSON data or Form Data + * The text that you want summarized must be stored in a JSON variable called "text" +#### Example + { + "text": "Text that I wish to summarize., Please summarize me." + } + +## What does the response look like +- The returned data will be JSON data +- If your request format is not correct then the response will look as follows + * The JSON will contain a variable called "error" that contains a message that will tell you either that you did not + have a "text" variable in the request or if you used an incorrect request method + * The JSON will also have a variable called "success" and it will be set to false in this case +- If your request format is correct then the response will look as follows + * The JSON will contain a variable called "text" that is an array. Every index in the array that is contained in + "text" will be an array of size three. For each of the arrays of size three the first index will contain a sentence + from the original input text, the next index will be the strength of that sentence and the last index will contain + the position of the sentence in the original input text. + * The JSON will also contain a variable called "success" that will be set to true in this case. + +#### Example + { + "text": [ + ["Text that I wish to summarize", 1, 0], + ["Please summarize me", 0, 1] + ], + "success": true + } + +_Note the response may take longer based on the input text length_ + + \ No newline at end of file From 845248e162b69e149ed3db232d176bc2fffc39f6 Mon Sep 17 00:00:00 2001 From: Ian Renfro Date: Wed, 18 Oct 2017 00:21:02 -0400 Subject: [PATCH 03/41] Fixed the extra comma --- SummarizationModule/API/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SummarizationModule/API/README.md b/SummarizationModule/API/README.md index 03a4657..f569403 100644 --- a/SummarizationModule/API/README.md +++ b/SummarizationModule/API/README.md @@ -9,7 +9,7 @@ * The text that you want summarized must be stored in a JSON variable called "text" #### Example { - "text": "Text that I wish to summarize., Please summarize me." + "text": "Text that I wish to summarize. Please summarize me." } ## What does the response look like @@ -36,4 +36,4 @@ _Note the response may take longer based on the input text length_ - \ No newline at end of file + From 3475a11a9d159caf4b54b9e0dc973dd3b68f1213 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Thu, 19 Oct 2017 00:16:40 -0400 Subject: [PATCH 04/41] Compute strength dynamically Do this to speed up checking strength of chains. --- SummarizationModule/LexicalChain.py | 17 +++++++---------- SummarizationModule/Testing/Runner.py | 4 ++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index db741a4..160cd84 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -54,11 +54,13 @@ def get_count(self): class LexChain: """ Class representing chains of words within the same lexical context """ - def __init__(self, words=None): + def __init__(self, words=None, strength=0): """ Initialize field variables """ self.words = dict() + self.strength = 0 if words != None: self.words = words + self.strength = strength def __repr__(self): """ String representation """ @@ -72,8 +74,11 @@ def add_word(self, word, synset): """ Adds new word along with its synset into the chain """ if word not in self.words: self.words[word] = LexWord(word, synset) + for key in self.words: + self.strength += 7 * wn.path_similarity(self.words[key].get_synset(), synset) else: self.words[word].add_count() + self.strength += 10 def get_words(self): """ Getter function for word dictionary """ @@ -92,16 +97,8 @@ def get_simil(self, synset): def get_strength(self): """ Uses basic heuristic to compute the internal strength of the chain """ - #TODO: rework this so it updates dynamically #TODO: use a better heuristic - total = 0 - for key in self.words: - total += (self.words[key].get_count() - 1) * 10 - for key2 in self.words: - if key != key2: - total += 7 * wn.path_similarity(self.words[key].get_synset(), self.words[key2].get_synset()) - - return total + return self.strength def get_score(self): """ diff --git a/SummarizationModule/Testing/Runner.py b/SummarizationModule/Testing/Runner.py index 8a1915f..fb55502 100644 --- a/SummarizationModule/Testing/Runner.py +++ b/SummarizationModule/Testing/Runner.py @@ -15,6 +15,7 @@ import sys sys.path.append('../../') +from time import time from SummarizationModule.Summarizer import Summarizer # ============================================================================= @@ -22,10 +23,13 @@ def main(): """ Main method for initializing a run """ + t0 = time() with open("sample.txt", 'r') as f: text = f.read() tester = Summarizer(text) print(tester.rank_sentences()) + t1 = time() + print(t1 - t0) if __name__ == "__main__": From c56d6def996115293ae37e27d35cebcf3b4afc1f Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Thu, 19 Oct 2017 00:24:29 -0400 Subject: [PATCH 05/41] Compute score dynamically Do this to speed up checking score of chains. --- SummarizationModule/LexicalChain.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 160cd84..3472d27 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -54,12 +54,14 @@ def get_count(self): class LexChain: """ Class representing chains of words within the same lexical context """ - def __init__(self, words=None, strength=0): + def __init__(self, words=None, length=0, strength=0): """ Initialize field variables """ self.words = dict() self.strength = 0 + self.length = 0 if words != None: self.words = words + self.length = length self.strength = strength def __repr__(self): @@ -79,6 +81,7 @@ def add_word(self, word, synset): else: self.words[word].add_count() self.strength += 10 + self.length += 1 def get_words(self): """ Getter function for word dictionary """ @@ -107,13 +110,9 @@ def get_score(self): Calculated as such: score = length * h_index (homogeneity) """ - length = 0 - for key in self.words: - length += self.words[key].get_count() - - h_index = 1 - (len(self.words.keys()) / length) + h_index = 1 - (len(self.words.keys()) / self.length) - return length * h_index + return self.length * h_index def get_key_words(self): """ From ca7f881223670d4fe60cd20c756917b702740500 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Sun, 22 Oct 2017 22:55:30 -0400 Subject: [PATCH 06/41] Add experiment 1 log --- SummarizationModule/LexicalChain.py | 5 +++- .../Testing/Experiment_Logs/exp1.txt | 26 +++++++++++++++++++ SummarizationModule/Testing/Runner.py | 3 +++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 SummarizationModule/Testing/Experiment_Logs/exp1.txt diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 3472d27..7c4442a 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -54,11 +54,14 @@ def get_count(self): class LexChain: """ Class representing chains of words within the same lexical context """ - def __init__(self, words=None, length=0, strength=0): + def __init__(self, words=None, length=0, strength=0, wqlen = 20): """ Initialize field variables """ self.words = dict() self.strength = 0 self.length = 0 + self.q_length = wqlen + self.word_q = [] + self.word_q_table = dict() if words != None: self.words = words self.length = length diff --git a/SummarizationModule/Testing/Experiment_Logs/exp1.txt b/SummarizationModule/Testing/Experiment_Logs/exp1.txt new file mode 100644 index 0000000..6f695cf --- /dev/null +++ b/SummarizationModule/Testing/Experiment_Logs/exp1.txt @@ -0,0 +1,26 @@ +Experiment 1: Operation Beacon Warehouse + +Goal: In order to speed up the summarizer, we want to dynamically +update strength and score instead of recomputing it every time it +is needed. Our hypothesis is that doing so will reduce the runtime +complexity from O(n^3) to O(n^2). + +Text used: sample.txt (4773 char) + +Experiment Log: +10/19 12:08AM +Original code +36.8 + +10/19 12:12AM +Update strength dynamically +23.76 + +10/19 12:18AM +Update score dynamically +23.7 + +Results: It seems we are headed in the right direction for our hypothesis. +Results seem very positive, so this change will be pushed to our codebase. + +Experiment finished. \ No newline at end of file diff --git a/SummarizationModule/Testing/Runner.py b/SummarizationModule/Testing/Runner.py index fb55502..8ea9d02 100644 --- a/SummarizationModule/Testing/Runner.py +++ b/SummarizationModule/Testing/Runner.py @@ -24,8 +24,11 @@ def main(): """ Main method for initializing a run """ t0 = time() + prop = 1.0 with open("sample.txt", 'r') as f: text = f.read() + text = text[:int(len(text) * prop)] + print(len(text)) tester = Summarizer(text) print(tester.rank_sentences()) t1 = time() From f00dcbe0ad9e7cb41db40815ceda4b44e410e69c Mon Sep 17 00:00:00 2001 From: Ian Renfro Date: Mon, 23 Oct 2017 00:02:36 -0400 Subject: [PATCH 07/41] Added frontend url to the html and py files --- SummarizationModule/API/passenger_wsgi.py | 4 +--- SummarizationModule/API/redirect.html | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/SummarizationModule/API/passenger_wsgi.py b/SummarizationModule/API/passenger_wsgi.py index 920daa1..0bc28b2 100644 --- a/SummarizationModule/API/passenger_wsgi.py +++ b/SummarizationModule/API/passenger_wsgi.py @@ -38,8 +38,7 @@ "\n\t\t\t6\n\t\t],\n\t\t[\n\t\t\t\"for testing\",\n\t\t\t7,\n\t\t\t8\n\t\t],\n\t\t[\n\t\t\t\"json\"," \ "\n\t\t\t9,\n\t\t\t0\n\t\t]\n\t]\n}" -# TODO Website url that needs to be inserted in the future -websiteURL = "__INSERT WEBAPP URL HERE__" +websiteURL = "http://simplif.ai.s3-website.us-east-2.amazonaws.com/" # ============================================================================= @@ -55,7 +54,6 @@ def summarizeTEST(): def summarize(): # If there is a GET or HEAD request then send the redirect page because it is probably done from a browser if request.method != 'POST': - # TODO Create an actual redirection page return render_template('redirect.html') # If our chosen variable name is included in the form data in the body if var in request.form: diff --git a/SummarizationModule/API/redirect.html b/SummarizationModule/API/redirect.html index ea3b8ef..ee27895 100644 --- a/SummarizationModule/API/redirect.html +++ b/SummarizationModule/API/redirect.html @@ -2,9 +2,9 @@ - + Redirect - + \ No newline at end of file From 2e90ba96ba0506fe6b469b4e08ec56568ff0cb5b Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Mon, 23 Oct 2017 00:07:15 -0400 Subject: [PATCH 08/41] Add noun queue to chains Do this to optimize summarizer. --- SummarizationModule/LexicalChain.py | 19 +++++++- SummarizationModule/Summarizer.py | 2 + .../Testing/Experiment_Logs/exp2.txt | 45 +++++++++++++++++++ SummarizationModule/Testing/Runner.py | 8 +++- 4 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 SummarizationModule/Testing/Experiment_Logs/exp2.txt diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 7c4442a..e2cd303 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -54,14 +54,13 @@ def get_count(self): class LexChain: """ Class representing chains of words within the same lexical context """ - def __init__(self, words=None, length=0, strength=0, wqlen = 20): + def __init__(self, words=None, length=0, strength=0, wqlen = 10): """ Initialize field variables """ self.words = dict() self.strength = 0 self.length = 0 self.q_length = wqlen self.word_q = [] - self.word_q_table = dict() if words != None: self.words = words self.length = length @@ -79,11 +78,21 @@ def add_word(self, word, synset): """ Adds new word along with its synset into the chain """ if word not in self.words: self.words[word] = LexWord(word, synset) + self.word_q.append(word) + for key in self.word_q: + self.strength += 7 * wn.path_similarity(self.words[key].get_synset(), synset) + if len(self.word_q) > self.q_length: + self.word_q.pop(0) + """ for key in self.words: self.strength += 7 * wn.path_similarity(self.words[key].get_synset(), synset) + """ else: self.words[word].add_count() self.strength += 10 + self.word_q.append(word) + if len(self.word_q) > self.q_length: + self.word_q.pop(0) self.length += 1 def get_words(self): @@ -94,10 +103,16 @@ def get_simil(self, synset): """ Uses basic heuristic to compare the relevance of a synset to the chain """ #TODO: use a better heuristic highest = 0 + for key in self.word_q: + simil = wn.path_similarity(self.words[key].get_synset(), synset) + if simil > highest: + highest = simil + """ for key in self.words: simil = wn.path_similarity(self.words[key].get_synset(), synset) if simil > highest: highest = simil + """ return highest diff --git a/SummarizationModule/Summarizer.py b/SummarizationModule/Summarizer.py index d317d25..2215a5a 100644 --- a/SummarizationModule/Summarizer.py +++ b/SummarizationModule/Summarizer.py @@ -53,6 +53,8 @@ def find_best_chains(self, num_chains): if len(sets) > 0: ss = lc_group.get_most_relevant(sets) lc_group.add_to_chain(noun, ss) + for chain in lc_group.get_chains(): + print(chain) top = lc_group.get_top_chains(num_chains) return top diff --git a/SummarizationModule/Testing/Experiment_Logs/exp2.txt b/SummarizationModule/Testing/Experiment_Logs/exp2.txt new file mode 100644 index 0000000..7bc52d0 --- /dev/null +++ b/SummarizationModule/Testing/Experiment_Logs/exp2.txt @@ -0,0 +1,45 @@ +Experiment 2: Operation Wild Crayon + +Goal: In order to speed up the summarizer, we want to avoid scanning all +nouns in the entire document for every new noun added to the lexical chains. +Nouns at the beginning of the document do not contribute to the context of +newer nouns. Thus, we wish to limit the number of nouns checked using a +queue. + +Text(s) used: +sample.txt (4773 char) +sample_long.txt (13544 char) + +Experiment Log: +10/22 10:59PM +Original code with sample.txt +24.3 + +10/22 11:07PM +Modified with queue length 20 on sample.txt +1.96 +Comments: summary was pretty bad, gonna investigate +whoops, had a bug + +10/22 11:19PM +Modified with queue length 20 on sample.txt +17.9 +Comments: summary was almost as good, time was sped up + +10/22 11:30PM +Modified with queue length 10 on sample.txt +23.8 +Comments: summary was very good + +10/22 11:33PM +Original code for sample_long.txt (0.4 proportion) +440 + +10/22 11:37PM +Modified with queue length 10 on sample_long.txt +176 + +Results: Looks like adding this queue preserves summary quality and simultaneously +speeds up summarizer for long texts. We will be keeping this queue. + +Experiment complete. \ No newline at end of file diff --git a/SummarizationModule/Testing/Runner.py b/SummarizationModule/Testing/Runner.py index 8ea9d02..2b4b373 100644 --- a/SummarizationModule/Testing/Runner.py +++ b/SummarizationModule/Testing/Runner.py @@ -25,12 +25,16 @@ def main(): """ Main method for initializing a run """ t0 = time() prop = 1.0 - with open("sample.txt", 'r') as f: + with open("sample_long.txt", 'r') as f: text = f.read() text = text[:int(len(text) * prop)] print(len(text)) tester = Summarizer(text) - print(tester.rank_sentences()) + ranked = tester.rank_sentences() + total = len(ranked) + for sent in ranked: + if sent[1] < total * 0.1: + print(sent[0]) t1 = time() print(t1 - t0) From 86bcfe0aeb4ab9e1df067b0bbc72dfa950da4720 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Mon, 23 Oct 2017 00:09:04 -0400 Subject: [PATCH 09/41] Delete old code --- SummarizationModule/LexicalChain.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index e2cd303..98d45a9 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -83,10 +83,6 @@ def add_word(self, word, synset): self.strength += 7 * wn.path_similarity(self.words[key].get_synset(), synset) if len(self.word_q) > self.q_length: self.word_q.pop(0) - """ - for key in self.words: - self.strength += 7 * wn.path_similarity(self.words[key].get_synset(), synset) - """ else: self.words[word].add_count() self.strength += 10 @@ -107,12 +103,6 @@ def get_simil(self, synset): simil = wn.path_similarity(self.words[key].get_synset(), synset) if simil > highest: highest = simil - """ - for key in self.words: - simil = wn.path_similarity(self.words[key].get_synset(), synset) - if simil > highest: - highest = simil - """ return highest From 29bdb060d8ac40cb15d2db13a5181e09173cd8d8 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Mon, 23 Oct 2017 00:11:34 -0400 Subject: [PATCH 10/41] Remove print statements --- SummarizationModule/Summarizer.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/SummarizationModule/Summarizer.py b/SummarizationModule/Summarizer.py index 2215a5a..d317d25 100644 --- a/SummarizationModule/Summarizer.py +++ b/SummarizationModule/Summarizer.py @@ -53,8 +53,6 @@ def find_best_chains(self, num_chains): if len(sets) > 0: ss = lc_group.get_most_relevant(sets) lc_group.add_to_chain(noun, ss) - for chain in lc_group.get_chains(): - print(chain) top = lc_group.get_top_chains(num_chains) return top From f964b579b30b8c78865397da4ecf61e99abee557 Mon Sep 17 00:00:00 2001 From: Ian Renfro Date: Mon, 23 Oct 2017 00:32:13 -0400 Subject: [PATCH 11/41] Added more stuff to server script --- SummarizationModule/remoteUpdate.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SummarizationModule/remoteUpdate.sh b/SummarizationModule/remoteUpdate.sh index fdb0afe..8f24222 100755 --- a/SummarizationModule/remoteUpdate.sh +++ b/SummarizationModule/remoteUpdate.sh @@ -12,3 +12,13 @@ wget -O SummarizerNew.py https://raw.githubusercontent.com/simplif-ai/Applicatio echo "Downloading New Version of Passenger_WSGI.py" wget -O passenger_wsgiNew.py https://raw.githubusercontent.com/simplif-ai/Application/develop/SummarizationModule/API/passenger_wsgi.py -q --show-progress echo "Finished Downloading all files" +echo "Diff'ing LexicalChain.py. Output is in LexicalChainDiff.txt" +echo -e "Local \t\t\t\t\t\t\t\t\t\t Server\n" > LexicalChainDiff.txt +diff -Bys LexicalChain.py LexicalChainNew.py >> LexicalChainDiff.txt +echo "Diff'ing Summarizer.py. Output is in SummarizerDiff.txt" +echo -e "Local \t\t\t\t\t\t\t\t\t\t Server\n" > SummarizerDiff.txt +diff -Bys Summarizer.py SummarizerNew.py >> SummarizerDiff.txt +echo "Diff'ing passenger_wsgi.py. Output is in PassengerDiff.txt" +echo -e "Local \t\t\t\t\t\t\t\t\t\t Server\n" > PassengerDiff.txt +diff -Bys passenger_wsgi.py passenger_wsgiNew.py >> PassengerDiff.txt +echo "Finished Diff'ing all files" From bc4973a7eb2c7c6d1fd94b38c276a27c71e6331c Mon Sep 17 00:00:00 2001 From: Ian Renfro Date: Mon, 23 Oct 2017 11:20:18 -0400 Subject: [PATCH 12/41] Added new line to redirect.html --- SummarizationModule/API/redirect.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SummarizationModule/API/redirect.html b/SummarizationModule/API/redirect.html index ee27895..eead46f 100644 --- a/SummarizationModule/API/redirect.html +++ b/SummarizationModule/API/redirect.html @@ -7,4 +7,5 @@ - \ No newline at end of file + + From c841d2577a7826ffeca845f95c2dddd665e9837d Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Sat, 28 Oct 2017 20:52:53 -0400 Subject: [PATCH 13/41] Filter out weakest chains --- SummarizationModule/LexicalChain.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 98d45a9..e67cd3c 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -145,11 +145,12 @@ def get_key_words(self): class LexChainGroup: """ Class representing a possible grouping of chains """ - def __init__(self, chains=None): + def __init__(self, chains=None, chain_cap=6): """ Initialize field variables """ self.chains = [] if chains != None: self.chains = chains + self.chain_cap = chain_cap def get_most_relevant(self, synsetset): """ Obtain the most relevant chain to the synset out of the chain group """ @@ -180,6 +181,12 @@ def add_to_chain(self, word, synset): newchain = LexChain() newchain.add_word(word, synset) self.chains.append(newchain) + if self.chain_cap != -1 and len(self.chains) > self.chain_cap: + min_ind = 0 + for i in range(len(self.chains)): + if self.chains[i].get_strength() < self.chains[min_ind].get_strength(): + min_ind = i + self.chains.pop(min_ind) def get_strength(self): """ Return the sum of all chains in the group """ From ee6705b9aec349d918141947d0cc193fde9d9a23 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Sat, 28 Oct 2017 21:29:22 -0400 Subject: [PATCH 14/41] Choose best chain filter based on number of sentences --- SummarizationModule/LexicalChain.py | 2 +- SummarizationModule/Summarizer.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index e67cd3c..d7942c1 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -145,7 +145,7 @@ def get_key_words(self): class LexChainGroup: """ Class representing a possible grouping of chains """ - def __init__(self, chains=None, chain_cap=6): + def __init__(self, chains=None, chain_cap=-1): """ Initialize field variables """ self.chains = [] if chains != None: diff --git a/SummarizationModule/Summarizer.py b/SummarizationModule/Summarizer.py index d317d25..26785bb 100644 --- a/SummarizationModule/Summarizer.py +++ b/SummarizationModule/Summarizer.py @@ -28,6 +28,8 @@ class Summarizer: def __init__(self, full_text): """ Initialize field variables """ self.full_text = full_text + self.sents = nltk.sent_tokenize(self.full_text) + print(len(self.sents)) def extract_nouns(self): """ Extracts and returns all nouns from a body of text """ @@ -39,14 +41,13 @@ def extract_nouns(self): nouns.append(word) return nouns - def extract_sentences(self): - """ Extracts and returns all sentences from a body of text """ - sents = nltk.sent_tokenize(self.full_text) - return sents + def get_sentences(self): + """ Returns all sentences from a body of text """ + return self.sents def find_best_chains(self, num_chains): """ Generates chains and returns strongest chains """ - lc_group = LexChainGroup() + lc_group = LexChainGroup(chain_cap = len(self.sents) // 6 + 1) nouns = self.extract_nouns() for noun in nouns: sets = wn.synsets(noun, 'n') @@ -62,9 +63,8 @@ def rank_sentences(self): multiplier = 1.0 used_chains = [False] * len(top_chains) final_dataset = [] - sentences = self.extract_sentences() weights = [] - for sent in sentences: + for sent in self.sents: sent_words = nltk.word_tokenize(sent) weight = 1 used = False @@ -82,8 +82,8 @@ def rank_sentences(self): weights.append(weight) ranks = [a[0] for a in sorted(enumerate(sorted(enumerate(weights), key=lambda x:x[1], reverse=True)), \ key=lambda x:x[1][0])] - for i in range(len(sentences)): - final_dataset.append([sentences[i], ranks[i], i]) + for i in range(len(self.sents)): + final_dataset.append([self.sents[i], ranks[i], i]) return final_dataset def get_full_text(self): From 7288980b1d854f08cf0255870672a32d64e2b257 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Sat, 28 Oct 2017 21:41:17 -0400 Subject: [PATCH 15/41] Remove print statement --- SummarizationModule/Summarizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/SummarizationModule/Summarizer.py b/SummarizationModule/Summarizer.py index 26785bb..d96ee4f 100644 --- a/SummarizationModule/Summarizer.py +++ b/SummarizationModule/Summarizer.py @@ -29,7 +29,6 @@ def __init__(self, full_text): """ Initialize field variables """ self.full_text = full_text self.sents = nltk.sent_tokenize(self.full_text) - print(len(self.sents)) def extract_nouns(self): """ Extracts and returns all nouns from a body of text """ From c0e882f70fce1e029eb88a0dd13cd9b8f4569963 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Sun, 29 Oct 2017 23:03:59 -0400 Subject: [PATCH 16/41] Make chain selection scalable and improved sentence ranking algorithm --- SummarizationModule/Summarizer.py | 17 ++++++++--------- SummarizationModule/Testing/Runner.py | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/SummarizationModule/Summarizer.py b/SummarizationModule/Summarizer.py index d96ee4f..db7ec20 100644 --- a/SummarizationModule/Summarizer.py +++ b/SummarizationModule/Summarizer.py @@ -58,26 +58,25 @@ def find_best_chains(self, num_chains): def rank_sentences(self): """ Ranks sentences in order of relevance and returns exportable dataset """ - top_chains = self.find_best_chains(4) + #top_chains = self.find_best_chains(4) + top_chains = self.find_best_chains(len(self.sents) // 10 + 1) multiplier = 1.0 - used_chains = [False] * len(top_chains) + chain_weights = [1.0] * len(top_chains) final_dataset = [] weights = [] for sent in self.sents: sent_words = nltk.word_tokenize(sent) weight = 1 - used = False + used_chains = [False] * len(top_chains) for word in sent_words: for i in range(len(top_chains)): if word in top_chains[i]: - if not used and not used_chains[i]: + if not used_chains[i]: used_chains[i] = True - used = True - weight += 10 - else: - weight += 1 + weight += 10 * chain_weights[i] + chain_weights[i] *= 0.99 weight *= multiplier - multiplier *= 0.95 + multiplier *= 0.99 weights.append(weight) ranks = [a[0] for a in sorted(enumerate(sorted(enumerate(weights), key=lambda x:x[1], reverse=True)), \ key=lambda x:x[1][0])] diff --git a/SummarizationModule/Testing/Runner.py b/SummarizationModule/Testing/Runner.py index 2b4b373..be6b66c 100644 --- a/SummarizationModule/Testing/Runner.py +++ b/SummarizationModule/Testing/Runner.py @@ -25,7 +25,7 @@ def main(): """ Main method for initializing a run """ t0 = time() prop = 1.0 - with open("sample_long.txt", 'r') as f: + with open("sample_long.txt", 'r', encoding='utf-8') as f: text = f.read() text = text[:int(len(text) * prop)] print(len(text)) @@ -33,7 +33,7 @@ def main(): ranked = tester.rank_sentences() total = len(ranked) for sent in ranked: - if sent[1] < total * 0.1: + if sent[1] < total * 0.3: print(sent[0]) t1 = time() print(t1 - t0) From 45a5fe49bd17e271af63614da8530271e493024f Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Sun, 29 Oct 2017 23:04:21 -0400 Subject: [PATCH 17/41] Add more logs --- .../Testing/Experiment_Logs/exp3.txt | 35 +++++ .../Testing/Experiment_Logs/exp4.txt | 145 ++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 SummarizationModule/Testing/Experiment_Logs/exp3.txt create mode 100644 SummarizationModule/Testing/Experiment_Logs/exp4.txt diff --git a/SummarizationModule/Testing/Experiment_Logs/exp3.txt b/SummarizationModule/Testing/Experiment_Logs/exp3.txt new file mode 100644 index 0000000..4f477cc --- /dev/null +++ b/SummarizationModule/Testing/Experiment_Logs/exp3.txt @@ -0,0 +1,35 @@ +Experiment 3: Operation Intense Gamma + +Goal: In order to speed up the summarizer, we want to avoid having too many +small lexical chains in a lexical chain group. We solve this by filtering out +smaller lexical chains as more chains are added. + +Text(s) used: +sample.txt (4773 char) +sample_long.txt (13544 char) + +Experiment Log: +10/24 8:25PM +Original code with sample.txt +26 + +10/24 8:32PM +Modified code with chain cap 6 with sample.txt +11.74 + +10/28 8:54PM +Modified code with chain cap 6 for sample_long.txt +83.2 + +10/28 9:02PM +Modified code with chain cap (num sentences // 3 + 1) for sample_long.txt +843 + +10/28 9:20PM +Modified code with chain cap (num sentences // 6 + 1) for sample_long.txt +482 + +Results: Looks like filtering lexical chains preserves summary quality and simultaneously +speeds up summarizer for long texts. We will be keeping this filter. + +Experiment complete. diff --git a/SummarizationModule/Testing/Experiment_Logs/exp4.txt b/SummarizationModule/Testing/Experiment_Logs/exp4.txt new file mode 100644 index 0000000..1077e97 --- /dev/null +++ b/SummarizationModule/Testing/Experiment_Logs/exp4.txt @@ -0,0 +1,145 @@ +Experiment 4: Operation Nitrogen Morbid + +Goal: In order to scale the summarizer to longer texts, we must use more +lexical chains in the summarization. + +Text(s) used: +sample_long.txt (13544 char) + +Experiment Log: +10/29 8:45PM +Original code +Edge1 + +It seems like a pretty intense place to be standing-but then you have to remember something about what it's like to stand on a time graph: you can't see what's to your right. +So here's how it actually feels to stand there: + +Edge + +Which probably feels pretty normal… + +_______________ + +The Far Future-Coming Soon +Imagine taking a time machine back to 1750-a time when the world was in a permanent power outage, long-distance communication meant either yelling loudly or firing a cannon in the air, and all transportation ran on hay. +It's impossible for us to understand what it would be like for him to see shiny capsules racing by on a highway, talk to people who had been on the other side of the ocean earlier in the day, watch sports that were being played 1,000 miles away, hear a musical performance that happened 50 years ago, and play with my magical wizard rectangle that he could use to capture a real-life image or record a living moment, generate a map with a paranormal moving blue dot that shows him where he is, look at someone's face and chat with them even though they're on the other side of the country, and worlds of other inconceivable sorcery. +The 1500 guy would learn some mind-bending shit about space and physics, he'd be impressed with how committed Europe turned out to be with that new imperialism fad, and he'd have to do some major revisions of his world map conception. +But watching everyday life go by in 1750-transportation, communication, etc.-definitely wouldn't make him die. +No, in order for the 1750 guy to have as much fun as we had with him, he'd have to go much farther back-maybe all the way back to about 12,000 BC, before the First Agricultural Revolution gave rise to the first cities and to the concept of civilization. +In order for someone to be transported into the future and die from the level of shock they'd experience, they have to go enough years ahead that a "die level of progress," or a Die Progress Unit (DPU) has been achieved. +The post-Industrial Revolution world has moved so quickly that a 1750 person only needs to go forward a couple hundred years for a DPU to have happened. +This pattern-human progress moving quicker and quicker as time goes on-is what futurist Ray Kurzweil calls human history's Law of Accelerating Returns. +19th century humanity knew more and had better technology than 15th century humanity, so it's no surprise that humanity made far more advances in the 19th century than in the 15th century-15th century humanity was no match for 19th century humanity.11← open these + +This works on smaller scales too. +The movie Back to the Future came out in 1985, and "the past" took place in 1955. +It was a different world, yes-but if the movie were made today and the past took place in 1985, the movie could have had much more fun with much bigger differences. +The character would be in a time before personal computers, internet, or cell phones-today's Marty McFly, a teenager born in the late 90s, would be much more out of place in 1985 than the movie's Marty McFly was in 1955. +the next DPU might only take a couple decades-and the world in 2050 might be so vastly different than today's world that we would barely recognize it. +It's what many scientists smarter and more knowledgeable than you or I firmly believe-and if you look at history, it's what we should logically predict. +So then why, when you hear me say something like "the world 35 years from now might be totally unrecognizable," are you thinking, "Cool….but nahhhhhhh"? +Three reasons we're skeptical of outlandish forecasts of the future: + +1) When it comes to history, we think in straight lines. +When we think about the extent to which the world will change in the 21st century, we just take the 20th century progress and add it to the year 2000. +In order to think about the future correctly, you need to imagine things moving at a much faster rate than they're moving now. +A leveling off as the particular paradigm matures3 + +If you look only at very recent history, the part of the S-curve you're on at the moment can obscure your perception of how fast things are advancing. +We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." +If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." + +10/29 9:20PM +Modified code with num sentences // 10 + 1 chains +Edge1 + +It seems like a pretty intense place to be standing-but then you have to remember something about what it's like to stand on a time graph: you can't see what's to your right. +So here's how it actually feels to stand there: + +Edge + +Which probably feels pretty normal… + +_______________ + +The Far Future-Coming Soon +Imagine taking a time machine back to 1750-a time when the world was in a permanent power outage, long-distance communication meant either yelling loudly or firing a cannon in the air, and all transportation ran on hay. +It's impossible for us to understand what it would be like for him to see shiny capsules racing by on a highway, talk to people who had been on the other side of the ocean earlier in the day, watch sports that were being played 1,000 miles away, hear a musical performance that happened 50 years ago, and play with my magical wizard rectangle that he could use to capture a real-life image or record a living moment, generate a map with a paranormal moving blue dot that shows him where he is, look at someone's face and chat with them even though they're on the other side of the country, and worlds of other inconceivable sorcery. +The 1500 guy would learn some mind-bending shit about space and physics, he'd be impressed with how committed Europe turned out to be with that new imperialism fad, and he'd have to do some major revisions of his world map conception. +No, in order for the 1750 guy to have as much fun as we had with him, he'd have to go much farther back-maybe all the way back to about 12,000 BC, before the First Agricultural Revolution gave rise to the first cities and to the concept of civilization. +In order for someone to be transported into the future and die from the level of shock they'd experience, they have to go enough years ahead that a "die level of progress," or a Die Progress Unit (DPU) has been achieved. +The post-Industrial Revolution world has moved so quickly that a 1750 person only needs to go forward a couple hundred years for a DPU to have happened. +This pattern-human progress moving quicker and quicker as time goes on-is what futurist Ray Kurzweil calls human history's Law of Accelerating Returns. +19th century humanity knew more and had better technology than 15th century humanity, so it's no surprise that humanity made far more advances in the 19th century than in the 15th century-15th century humanity was no match for 19th century humanity.11← open these + +This works on smaller scales too. +The movie Back to the Future came out in 1985, and "the past" took place in 1955. +It was a different world, yes-but if the movie were made today and the past took place in 1985, the movie could have had much more fun with much bigger differences. +The character would be in a time before personal computers, internet, or cell phones-today's Marty McFly, a teenager born in the late 90s, would be much more out of place in 1985 than the movie's Marty McFly was in 1955. +the next DPU might only take a couple decades-and the world in 2050 might be so vastly different than today's world that we would barely recognize it. +It's what many scientists smarter and more knowledgeable than you or I firmly believe-and if you look at history, it's what we should logically predict. +So then why, when you hear me say something like "the world 35 years from now might be totally unrecognizable," are you thinking, "Cool….but nahhhhhhh"? +Three reasons we're skeptical of outlandish forecasts of the future: + +1) When it comes to history, we think in straight lines. +When we think about the extent to which the world will change in the 21st century, we just take the 20th century progress and add it to the year 2000. +Projections + +2) The trajectory of very recent history often tells a distorted story. +Kurzweil explains that progress happens in "S-curves": + +S-Curves + +An S is created by the wave of progress when a new paradigm sweeps the world. +A leveling off as the particular paradigm matures3 + +If you look only at very recent history, the part of the S-curve you're on at the moment can obscure your perception of how fast things are advancing. +We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." +If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." + +10/29 9:55PM +Modified code with num sentences // 8 + 1 chains +Edge1 + +It seems like a pretty intense place to be standing-but then you have to remember something about what it's like to stand on a time graph: you can't see what's to your right. +So here's how it actually feels to stand there: + +Edge + +Which probably feels pretty normal… + +_______________ + +The Far Future-Coming Soon +Imagine taking a time machine back to 1750-a time when the world was in a permanent power outage, long-distance communication meant either yelling loudly or firing a cannon in the air, and all transportation ran on hay. +It's impossible for us to understand what it would be like for him to see shiny capsules racing by on a highway, talk to people who had been on the other side of the ocean earlier in the day, watch sports that were being played 1,000 miles away, hear a musical performance that happened 50 years ago, and play with my magical wizard rectangle that he could use to capture a real-life image or record a living moment, generate a map with a paranormal moving blue dot that shows him where he is, look at someone's face and chat with them even though they're on the other side of the country, and worlds of other inconceivable sorcery. +The 1500 guy would learn some mind-bending shit about space and physics, he'd be impressed with how committed Europe turned out to be with that new imperialism fad, and he'd have to do some major revisions of his world map conception. +No, in order for the 1750 guy to have as much fun as we had with him, he'd have to go much farther back-maybe all the way back to about 12,000 BC, before the First Agricultural Revolution gave rise to the first cities and to the concept of civilization. +In order for someone to be transported into the future and die from the level of shock they'd experience, they have to go enough years ahead that a "die level of progress," or a Die Progress Unit (DPU) has been achieved. +So a DPU took over 100,000 years in hunter-gatherer times, but at the post-Agricultural Revolution rate, it only took about 12,000 years. +The post-Industrial Revolution world has moved so quickly that a 1750 person only needs to go forward a couple hundred years for a DPU to have happened. +This pattern-human progress moving quicker and quicker as time goes on-is what futurist Ray Kurzweil calls human history's Law of Accelerating Returns. +19th century humanity knew more and had better technology than 15th century humanity, so it's no surprise that humanity made far more advances in the 19th century than in the 15th century-15th century humanity was no match for 19th century humanity.11← open these + +This works on smaller scales too. +The movie Back to the Future came out in 1985, and "the past" took place in 1955. +It was a different world, yes-but if the movie were made today and the past took place in 1985, the movie could have had much more fun with much bigger differences. +The character would be in a time before personal computers, internet, or cell phones-today's Marty McFly, a teenager born in the late 90s, would be much more out of place in 1985 than the movie's Marty McFly was in 1955. +the next DPU might only take a couple decades-and the world in 2050 might be so vastly different than today's world that we would barely recognize it. +It's what many scientists smarter and more knowledgeable than you or I firmly believe-and if you look at history, it's what we should logically predict. +So then why, when you hear me say something like "the world 35 years from now might be totally unrecognizable," are you thinking, "Cool….but nahhhhhhh"? +Three reasons we're skeptical of outlandish forecasts of the future: + +1) When it comes to history, we think in straight lines. +When we think about the extent to which the world will change in the 21st century, we just take the 20th century progress and add it to the year 2000. +Projections + +2) The trajectory of very recent history often tells a distorted story. +A leveling off as the particular paradigm matures3 + +If you look only at very recent history, the part of the S-curve you're on at the moment can obscure your perception of how fast things are advancing. +We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." +If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." + + +Results: From 401dac442d8c4833cb2e8b452126706095041151 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 22:45:16 -0400 Subject: [PATCH 18/41] Filter out more words from chains. --- SummarizationModule/LexicalChain.py | 8 +++++++- SummarizationModule/Testing/Experiment_Logs/exp4.txt | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index d7942c1..254d900 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -134,9 +134,14 @@ def get_key_words(self): average += self.words[key].get_count() average = average / len(self.words.keys()) + sd = 0 + for key in self.words: + sd += (self.words[key].get_count() - average) ** 2 + sd = ((sd / len(self.words.keys())) ** 0.5) + key_words = [] for key in self.words: - if self.words[key].get_count() >= average: + if self.words[key].get_count() >= average + 0.5 * sd: key_words.append(key) return key_words @@ -212,4 +217,5 @@ def get_top_chains(self, n): skchains = [] for chain in schains: skchains.append(chain.get_key_words()) + print(skchains[-n:]) return skchains[-n:] diff --git a/SummarizationModule/Testing/Experiment_Logs/exp4.txt b/SummarizationModule/Testing/Experiment_Logs/exp4.txt index 1077e97..f31f21f 100644 --- a/SummarizationModule/Testing/Experiment_Logs/exp4.txt +++ b/SummarizationModule/Testing/Experiment_Logs/exp4.txt @@ -142,4 +142,4 @@ We base our ideas about the world on our personal experience, and that experienc If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." -Results: +Results: Seems that the new settings with len // 10 + 1 chains is ideal. Code has been updated as such. \ No newline at end of file From dbddec3bb6d8ad826e6ef329fe22f5ccbc12a090 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 22:45:35 -0400 Subject: [PATCH 19/41] Add experiment log for exp5. --- .../Testing/Experiment_Logs/exp5.txt | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 SummarizationModule/Testing/Experiment_Logs/exp5.txt diff --git a/SummarizationModule/Testing/Experiment_Logs/exp5.txt b/SummarizationModule/Testing/Experiment_Logs/exp5.txt new file mode 100644 index 0000000..af61b04 --- /dev/null +++ b/SummarizationModule/Testing/Experiment_Logs/exp5.txt @@ -0,0 +1,194 @@ +Experiment 5: Operation Stormy Hurricane + +Goal: We currently use only the top 50% most commonly appearing words in each lexical chain +as key words, but we may want to limit this further. + +Text(s) used: +sample_long.txt (11557 char) + +Experiment Log: +11/01 9:58PM +Original code (above mean) +Edge1 + +It seems like a pretty intense place to be standing-but then you have to remember something about what it's like to stand on a time graph: you can't see what's to your right. +So here's how it actually feels to stand there: + +Edge + +Which probably feels pretty normal… + +_______________ + +The Far Future-Coming Soon +Imagine taking a time machine back to 1750-a time when the world was in a permanent power outage, long-distance communication meant either yelling loudly or firing a cannon in the air, and all transportation ran on hay. +It's impossible for us to understand what it would be like for him to see shiny capsules racing by on a highway, talk to people who had been on the other side of the ocean earlier in the day, watch sports that were being played 1,000 miles away, hear a musical performance that happened 50 years ago, and play with my magical wizard rectangle that he could use to capture a real-life image or record a living moment, generate a map with a paranormal moving blue dot that shows him where he is, look at someone's face and chat with them even though they're on the other side of the country, and worlds of other inconceivable sorcery. +The 1500 guy would learn some mind-bending shit about space and physics, he'd be impressed with how committed Europe turned out to be with that new imperialism fad, and he'd have to do some major revisions of his world map conception. +No, in order for the 1750 guy to have as much fun as we had with him, he'd have to go much farther back-maybe all the way back to about 12,000 BC, before the First Agricultural Revolution gave rise to the first cities and to the concept of civilization. +In order for someone to be transported into the future and die from the level of shock they'd experience, they have to go enough years ahead that a "die level of progress," or a Die Progress Unit (DPU) has been achieved. +The post-Industrial Revolution world has moved so quickly that a 1750 person only needs to go forward a couple hundred years for a DPU to have happened. +This pattern-human progress moving quicker and quicker as time goes on-is what futurist Ray Kurzweil calls human history's Law of Accelerating Returns. +19th century humanity knew more and had better technology than 15th century humanity, so it's no surprise that humanity made far more advances in the 19th century than in the 15th century-15th century humanity was no match for 19th century humanity.11← open these + +This works on smaller scales too. +The movie Back to the Future came out in 1985, and "the past" took place in 1955. +It was a different world, yes-but if the movie were made today and the past took place in 1985, the movie could have had much more fun with much bigger differences. +The character would be in a time before personal computers, internet, or cell phones-today's Marty McFly, a teenager born in the late 90s, would be much more out of place in 1985 than the movie's Marty McFly was in 1955. +the next DPU might only take a couple decades-and the world in 2050 might be so vastly different than today's world that we would barely recognize it. +It's what many scientists smarter and more knowledgeable than you or I firmly believe-and if you look at history, it's what we should logically predict. +So then why, when you hear me say something like "the world 35 years from now might be totally unrecognizable," are you thinking, "Cool….but nahhhhhhh"? +Three reasons we're skeptical of outlandish forecasts of the future: + +1) When it comes to history, we think in straight lines. +When we think about the extent to which the world will change in the 21st century, we just take the 20th century progress and add it to the year 2000. +Projections + +2) The trajectory of very recent history often tells a distorted story. +Kurzweil explains that progress happens in "S-curves": + +S-Curves + +An S is created by the wave of progress when a new paradigm sweeps the world. +A leveling off as the particular paradigm matures3 + +If you look only at very recent history, the part of the S-curve you're on at the moment can obscure your perception of how fast things are advancing. +We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." +If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." + +11/01 10:00PM +Modified code (above 1 SD) +So here's how it actually feels to stand there: + +Edge + +Which probably feels pretty normal… + +_______________ + +The Far Future-Coming Soon +Imagine taking a time machine back to 1750-a time when the world was in a permanent power outage, long-distance communication meant either yelling loudly or firing a cannon in the air, and all transportation ran on hay. +It's impossible for us to understand what it would be like for him to see shiny capsules racing by on a highway, talk to people who had been on the other side of the ocean earlier in the day, watch sports that were being played 1,000 miles away, hear a musical performance that happened 50 years ago, and play with my magical wizard rectangle that he could use to capture a real-life image or record a living moment, generate a map with a paranormal moving blue dot that shows him where he is, look at someone's face and chat with them even though they're on the other side of the country, and worlds of other inconceivable sorcery. +The 1500 guy would learn some mind-bending shit about space and physics, he'd be impressed with how committed Europe turned out to be with that new imperialism fad, and he'd have to do some major revisions of his world map conception. +No, in order for the 1750 guy to have as much fun as we had with him, he'd have to go much farther back-maybe all the way back to about 12,000 BC, before the First Agricultural Revolution gave rise to the first cities and to the concept of civilization. +So a DPU took over 100,000 years in hunter-gatherer times, but at the post-Agricultural Revolution rate, it only took about 12,000 years. +The post-Industrial Revolution world has moved so quickly that a 1750 person only needs to go forward a couple hundred years for a DPU to have happened. +This pattern-human progress moving quicker and quicker as time goes on-is what futurist Ray Kurzweil calls human history's Law of Accelerating Returns. +19th century humanity knew more and had better technology than 15th century humanity, so it's no surprise that humanity made far more advances in the 19th century than in the 15th century-15th century humanity was no match for 19th century humanity.11← open these + +This works on smaller scales too. +It was a different world, yes-but if the movie were made today and the past took place in 1985, the movie could have had much more fun with much bigger differences. +The average rate of advancement between 1985 and 2015 was higher than the rate between 1955 and 1985-because the former was a more advanced world-so much more change happened in the most recent 30 years than in the prior 30. +Kurzweil suggests that the progress of the entire 20th century would have been achieved in only 20 years at the rate of advancement in the year 2000-in other words, by 2000, the rate of progress was five times faster than the average rate of progress during the 20th century. +the next DPU might only take a couple decades-and the world in 2050 might be so vastly different than today's world that we would barely recognize it. +It's what many scientists smarter and more knowledgeable than you or I firmly believe-and if you look at history, it's what we should logically predict. +So then why, when you hear me say something like "the world 35 years from now might be totally unrecognizable," are you thinking, "Cool….but nahhhhhhh"? +Three reasons we're skeptical of outlandish forecasts of the future: + +1) When it comes to history, we think in straight lines. +When we think about the extent to which the world will change in the 21st century, we just take the 20th century progress and add it to the year 2000. +If someone is being more clever about it, they might predict the advances of the next 30 years not by looking at the previous 30 years, but by taking the current rate of progress and judging based on that. +Projections + +2) The trajectory of very recent history often tells a distorted story. +Kurzweil explains that progress happens in "S-curves": + +S-Curves + +An S is created by the wave of progress when a new paradigm sweeps the world. +A leveling off as the particular paradigm matures3 + +If you look only at very recent history, the part of the S-curve you're on at the moment can obscure your perception of how fast things are advancing. +We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." +If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." + +11/01 10:29PM +Modified code (above 2 SD) +So here's how it actually feels to stand there: + +Edge + +Which probably feels pretty normal… + +_______________ + +The Far Future-Coming Soon +Imagine taking a time machine back to 1750-a time when the world was in a permanent power outage, long-distance communication meant either yelling loudly or firing a cannon in the air, and all transportation ran on hay. +It's impossible for us to understand what it would be like for him to see shiny capsules racing by on a highway, talk to people who had been on the other side of the ocean earlier in the day, watch sports that were being played 1,000 miles away, hear a musical performance that happened 50 years ago, and play with my magical wizard rectangle that he could use to capture a real-life image or record a living moment, generate a map with a paranormal moving blue dot that shows him where he is, look at someone's face and chat with them even though they're on the other side of the country, and worlds of other inconceivable sorcery. +The 1500 guy would learn some mind-bending shit about space and physics, he'd be impressed with how committed Europe turned out to be with that new imperialism fad, and he'd have to do some major revisions of his world map conception. +If he went back 12,000 years to 24,000 BC and got a guy and brought him to 12,000 BC, he'd show the guy everything and the guy would be like, "Okay what's your point who cares." +For the 12,000 BC guy to have the same fun, he'd have to go back over 100,000 years and get someone he could show fire and language to for the first time. +So a DPU took over 100,000 years in hunter-gatherer times, but at the post-Agricultural Revolution rate, it only took about 12,000 years. +The post-Industrial Revolution world has moved so quickly that a 1750 person only needs to go forward a couple hundred years for a DPU to have happened. +This pattern-human progress moving quicker and quicker as time goes on-is what futurist Ray Kurzweil calls human history's Law of Accelerating Returns. +It was a different world, yes-but if the movie were made today and the past took place in 1985, the movie could have had much more fun with much bigger differences. +The average rate of advancement between 1985 and 2015 was higher than the rate between 1955 and 1985-because the former was a more advanced world-so much more change happened in the most recent 30 years than in the prior 30. +Kurzweil suggests that the progress of the entire 20th century would have been achieved in only 20 years at the rate of advancement in the year 2000-in other words, by 2000, the rate of progress was five times faster than the average rate of progress during the 20th century. +the next DPU might only take a couple decades-and the world in 2050 might be so vastly different than today's world that we would barely recognize it. +It's what many scientists smarter and more knowledgeable than you or I firmly believe-and if you look at history, it's what we should logically predict. +So then why, when you hear me say something like "the world 35 years from now might be totally unrecognizable," are you thinking, "Cool….but nahhhhhhh"? +Three reasons we're skeptical of outlandish forecasts of the future: + +1) When it comes to history, we think in straight lines. +When we think about the extent to which the world will change in the 21st century, we just take the 20th century progress and add it to the year 2000. +If someone is being more clever about it, they might predict the advances of the next 30 years not by looking at the previous 30 years, but by taking the current rate of progress and judging based on that. +Projections + +2) The trajectory of very recent history often tells a distorted story. +Kurzweil explains that progress happens in "S-curves": + +S-Curves + +An S is created by the wave of progress when a new paradigm sweeps the world. +A leveling off as the particular paradigm matures3 + +If you look only at very recent history, the part of the S-curve you're on at the moment can obscure your perception of how fast things are advancing. +We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." +If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." + +11/01 10:29PM +Modified code (above 0.5 SD) +It seems like a pretty intense place to be standing-but then you have to remember something about what it's like to stand on a time graph: you can't see what's to your right. +So here's how it actually feels to stand there: + +Edge + +Which probably feels pretty normal… + +_______________ + +The Far Future-Coming Soon +Imagine taking a time machine back to 1750-a time when the world was in a permanent power outage, long-distance communication meant either yelling loudly or firing a cannon in the air, and all transportation ran on hay. +The 1500 guy would learn some mind-bending shit about space and physics, he'd be impressed with how committed Europe turned out to be with that new imperialism fad, and he'd have to do some major revisions of his world map conception. +So a DPU took over 100,000 years in hunter-gatherer times, but at the post-Agricultural Revolution rate, it only took about 12,000 years. +The post-Industrial Revolution world has moved so quickly that a 1750 person only needs to go forward a couple hundred years for a DPU to have happened. +This pattern-human progress moving quicker and quicker as time goes on-is what futurist Ray Kurzweil calls human history's Law of Accelerating Returns. +19th century humanity knew more and had better technology than 15th century humanity, so it's no surprise that humanity made far more advances in the 19th century than in the 15th century-15th century humanity was no match for 19th century humanity.11← open these + +This works on smaller scales too. +The movie Back to the Future came out in 1985, and "the past" took place in 1955. +It was a different world, yes-but if the movie were made today and the past took place in 1985, the movie could have had much more fun with much bigger differences. +The character would be in a time before personal computers, internet, or cell phones-today's Marty McFly, a teenager born in the late 90s, would be much more out of place in 1985 than the movie's Marty McFly was in 1955. +The average rate of advancement between 1985 and 2015 was higher than the rate between 1955 and 1985-because the former was a more advanced world-so much more change happened in the most recent 30 years than in the prior 30. +the next DPU might only take a couple decades-and the world in 2050 might be so vastly different than today's world that we would barely recognize it. +It's what many scientists smarter and more knowledgeable than you or I firmly believe-and if you look at history, it's what we should logically predict. +So then why, when you hear me say something like "the world 35 years from now might be totally unrecognizable," are you thinking, "Cool….but nahhhhhhh"? +Three reasons we're skeptical of outlandish forecasts of the future: + +1) When it comes to history, we think in straight lines. +When we think about the extent to which the world will change in the 21st century, we just take the 20th century progress and add it to the year 2000. +If someone is being more clever about it, they might predict the advances of the next 30 years not by looking at the previous 30 years, but by taking the current rate of progress and judging based on that. +Projections + +2) The trajectory of very recent history often tells a distorted story. +Kurzweil explains that progress happens in "S-curves": + +S-Curves + +An S is created by the wave of progress when a new paradigm sweeps the world. +A leveling off as the particular paradigm matures3 + +If you look only at very recent history, the part of the S-curve you're on at the moment can obscure your perception of how fast things are advancing. +We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." +If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." + +Results: \ No newline at end of file From fb788482924fde41a5beb78405fb91596ab44b2e Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 22:47:22 -0400 Subject: [PATCH 20/41] Wrap up word filtering. --- SummarizationModule/LexicalChain.py | 2 -- SummarizationModule/Testing/Experiment_Logs/exp5.txt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 254d900..36987fc 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -128,7 +128,6 @@ def get_key_words(self): Only keeps words with more than the average amount of word occurrences """ - #TODO: may need to filter out more than just half the words average = 0 for key in self.words: average += self.words[key].get_count() @@ -217,5 +216,4 @@ def get_top_chains(self, n): skchains = [] for chain in schains: skchains.append(chain.get_key_words()) - print(skchains[-n:]) return skchains[-n:] diff --git a/SummarizationModule/Testing/Experiment_Logs/exp5.txt b/SummarizationModule/Testing/Experiment_Logs/exp5.txt index af61b04..b1e23df 100644 --- a/SummarizationModule/Testing/Experiment_Logs/exp5.txt +++ b/SummarizationModule/Testing/Experiment_Logs/exp5.txt @@ -191,4 +191,4 @@ If you look only at very recent history, the part of the S-curve you're on at th We base our ideas about the world on our personal experience, and that experience has ingrained the rate of growth of the recent past in our heads as "the way things happen." If I tell you, later in this post, that you may live to be 150, or 250, or not die at all, your instinct will be, "That's stupid-if there's one thing I know from history, it's that everybody dies." -Results: \ No newline at end of file +Results: Seems that 0.5 standard deviations above the mean is most optimal. This will be included in the final code. \ No newline at end of file From f3f06cc8a565282acdea3c389035a1ac0ab2d2de Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 23:02:48 -0400 Subject: [PATCH 21/41] Keep current heuristic. --- SummarizationModule/LexicalChain.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 36987fc..92fedfb 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -97,7 +97,6 @@ def get_words(self): def get_simil(self, synset): """ Uses basic heuristic to compare the relevance of a synset to the chain """ - #TODO: use a better heuristic highest = 0 for key in self.word_q: simil = wn.path_similarity(self.words[key].get_synset(), synset) @@ -108,7 +107,6 @@ def get_simil(self, synset): def get_strength(self): """ Uses basic heuristic to compute the internal strength of the chain """ - #TODO: use a better heuristic return self.strength def get_score(self): From 8c317cda5a94e602b591c4ad1f88c61460902ece Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 23:21:07 -0400 Subject: [PATCH 22/41] Add get_copy function for LexChain --- SummarizationModule/LexicalChain.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 92fedfb..1df4abe 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -143,6 +143,15 @@ def get_key_words(self): return key_words + def get_copy(self): + """ + Returns a copy of self. + """ + new_words = dict() + for key in self.words: + new_words[key] = self.words[key] + return LexChain(words=new_words, length=self.length, strength=self.strength, wqlen=self.q_length) + class LexChainGroup: """ Class representing a possible grouping of chains """ From a06eaa08908bb74bee9d98a93d9f9d931f406f02 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 23:22:32 -0400 Subject: [PATCH 23/41] Add get_copy function for LexChainGroup --- SummarizationModule/LexicalChain.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SummarizationModule/LexicalChain.py b/SummarizationModule/LexicalChain.py index 1df4abe..05c6b2d 100644 --- a/SummarizationModule/LexicalChain.py +++ b/SummarizationModule/LexicalChain.py @@ -224,3 +224,12 @@ def get_top_chains(self, n): for chain in schains: skchains.append(chain.get_key_words()) return skchains[-n:] + + def get_copy(self): + """ + Returns a copy of self. + """ + new_chains = [] + for chain in self.chains: + new_chains.append(chain.get_copy()) + return LexChainGroup(chains=new_chains, chain_cap=self.chain_cap) From b84258cf134695a0434054ea124a440fb67ebfb6 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 23:28:40 -0400 Subject: [PATCH 24/41] Add non-greedy implementation of lexical chain building --- SummarizationModule/Summarizer.py | 38 ++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/SummarizationModule/Summarizer.py b/SummarizationModule/Summarizer.py index db7ec20..389f584 100644 --- a/SummarizationModule/Summarizer.py +++ b/SummarizationModule/Summarizer.py @@ -56,9 +56,45 @@ def find_best_chains(self, num_chains): top = lc_group.get_top_chains(num_chains) return top + def find_best_chains_nogreedy(self, num_chains): + """ + Generates chains and returns strongest chains, considering multiple cases aside from greedy case + """ + group_pool = [LexChainGroup(chain_cap=len(self.sents) // 6 + 1)] + nouns = self.extract_nouns() + for noun in nouns: + sets = wn.synsets(noun, 'n') + if len(sets) > 0: + new_group_pool = [] + for set in sets: + cur_group_pool = [group.get_copy() for group in group_pool] + for group in cur_group_pool: + group.add_to_chain(noun, set) + new_group_pool.extend(cur_group_pool) + group_pool = new_group_pool + while len(group_pool) > 4: + min_ind = 0 + min_val = -1 + for i in range(len(group_pool)): + val = group_pool[i].get_strength() + if min_val == -1 or val < min_val: + min_val = val + min_ind = i + group_pool.pop(i) + + while len(group_pool) > 1: + min_ind = 0 + min_val = -1 + for i in range(len(group_pool)): + val = group_pool[i].get_strength() + if min_val == -1 or val < min_val: + min_val = val + min_ind = i + group_pool.pop[i] + return group_pool[0].get_top_chains(num_chains) + def rank_sentences(self): """ Ranks sentences in order of relevance and returns exportable dataset """ - #top_chains = self.find_best_chains(4) top_chains = self.find_best_chains(len(self.sents) // 10 + 1) multiplier = 1.0 chain_weights = [1.0] * len(top_chains) From ae4732f038b2c8f50a72386279ffa30e1015a573 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Wed, 1 Nov 2017 23:29:56 -0400 Subject: [PATCH 25/41] Fix indexing bug --- SummarizationModule/Summarizer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SummarizationModule/Summarizer.py b/SummarizationModule/Summarizer.py index 389f584..9b330c9 100644 --- a/SummarizationModule/Summarizer.py +++ b/SummarizationModule/Summarizer.py @@ -80,7 +80,7 @@ def find_best_chains_nogreedy(self, num_chains): if min_val == -1 or val < min_val: min_val = val min_ind = i - group_pool.pop(i) + group_pool.pop(min_ind) while len(group_pool) > 1: min_ind = 0 @@ -90,7 +90,7 @@ def find_best_chains_nogreedy(self, num_chains): if min_val == -1 or val < min_val: min_val = val min_ind = i - group_pool.pop[i] + group_pool.pop[min_ind] return group_pool[0].get_top_chains(num_chains) def rank_sentences(self): From a082f6c9c2c09915e400f3f46289169cbbbc1481 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Thu, 2 Nov 2017 23:23:08 -0400 Subject: [PATCH 26/41] Fix and update test cases --- SummarizationModule/Testing/LexicalChainTest.py | 4 ++-- SummarizationModule/Testing/Runner.py | 2 +- SummarizationModule/Testing/SummarizerTest.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SummarizationModule/Testing/LexicalChainTest.py b/SummarizationModule/Testing/LexicalChainTest.py index daaa9bf..24a1bf2 100644 --- a/SummarizationModule/Testing/LexicalChainTest.py +++ b/SummarizationModule/Testing/LexicalChainTest.py @@ -50,8 +50,8 @@ class TestLexChain(unittest.TestCase): def test_basic(self): test_chain = LexChain() - test_chain.add_word("hello", None) - test_chain.add_word("world", None) + test_chain.add_word("hello", wn.synsets("hello")[0]) + test_chain.add_word("world", wn.synsets("world")[0]) wlist = test_chain.get_words() self.assertEqual(wlist["world"].get_word(), "world") diff --git a/SummarizationModule/Testing/Runner.py b/SummarizationModule/Testing/Runner.py index be6b66c..fa4c14b 100644 --- a/SummarizationModule/Testing/Runner.py +++ b/SummarizationModule/Testing/Runner.py @@ -25,7 +25,7 @@ def main(): """ Main method for initializing a run """ t0 = time() prop = 1.0 - with open("sample_long.txt", 'r', encoding='utf-8') as f: + with open("blah.txt", 'r', encoding='utf-8') as f: text = f.read() text = text[:int(len(text) * prop)] print(len(text)) diff --git a/SummarizationModule/Testing/SummarizerTest.py b/SummarizationModule/Testing/SummarizerTest.py index e1ea242..3f8a6aa 100644 --- a/SummarizationModule/Testing/SummarizerTest.py +++ b/SummarizationModule/Testing/SummarizerTest.py @@ -46,13 +46,13 @@ class TestSentenceExtraction(unittest.TestCase): def test_basic(self): test_summ = Summarizer("I hit the baseball with a bat. I like food. Ms. Vincent is good at coding.") - self.assertEqual(test_summ.extract_sentences(), ['I hit the baseball with a bat.', \ + self.assertEqual(test_summ.get_sentences(), ['I hit the baseball with a bat.', \ 'I like food.', \ 'Ms. Vincent is good at coding.']) def test_empty(self): test_summ = Summarizer("") - self.assertEqual(test_summ.extract_sentences(), []) + self.assertEqual(test_summ.get_sentences(), []) if __name__ == "__main__": From 82113851030c7f1c803edec98c3bbeed4b888440 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Fri, 3 Nov 2017 00:41:39 -0400 Subject: [PATCH 27/41] Added summarization module readme --- SummarizationModule/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 SummarizationModule/README.md diff --git a/SummarizationModule/README.md b/SummarizationModule/README.md new file mode 100644 index 0000000..609b777 --- /dev/null +++ b/SummarizationModule/README.md @@ -0,0 +1,27 @@ +# Summarization Module +This document solely describes the codebase of the inner workings of the summarizer. For instructions on how to run +the API, please refer to the README.md in the API folder. + +## LexicalChain.py +LexicalChain.py contains the code for the data structures used in the summarizer. `LexChainGroup`s store a collection +of `LexChain`s, which each contain a list of `LexWord`s contextually related to each other. + +## Summarizer.py +Summarizer.py uses the data structures in LexicalChain.py to generate a summary from a given text. + +#### Example local usage of the summarizer: + # Read the file + with open("sample.txt", 'r', encoding='utf-8') as f: + text = f.read() + + # Initialize and use summarizer on text + summ = Summarizer(text) + ranked = summ.rank_sentences() + + # Print out 20% highest priority sentences + total = len(ranked) + for sent in ranked: + if sent[1] < total * 0.2: + print(sent[0]) + +A runner is also included in the testing folder for convenience. \ No newline at end of file From f36b41d9fba03209496862195ae0838ca74bceec Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Fri, 3 Nov 2017 00:47:34 -0400 Subject: [PATCH 28/41] Added LexWord documentation to the readme --- SummarizationModule/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SummarizationModule/README.md b/SummarizationModule/README.md index 609b777..8567006 100644 --- a/SummarizationModule/README.md +++ b/SummarizationModule/README.md @@ -6,6 +6,13 @@ the API, please refer to the README.md in the API folder. LexicalChain.py contains the code for the data structures used in the summarizer. `LexChainGroup`s store a collection of `LexChain`s, which each contain a list of `LexWord`s contextually related to each other. +### LexWord +Initialization: + LexWord(word, synset) +Incrementing word counter: + add_count() +LexWord also contains getters for `word`,`synset`, and `count`. + ## Summarizer.py Summarizer.py uses the data structures in LexicalChain.py to generate a summary from a given text. From 84609943267b93bb4a61befcb517c359d22acbfc Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Fri, 3 Nov 2017 00:48:40 -0400 Subject: [PATCH 29/41] Fix missing code blocks --- SummarizationModule/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SummarizationModule/README.md b/SummarizationModule/README.md index 8567006..53f9895 100644 --- a/SummarizationModule/README.md +++ b/SummarizationModule/README.md @@ -7,9 +7,9 @@ LexicalChain.py contains the code for the data structures used in the summarizer of `LexChain`s, which each contain a list of `LexWord`s contextually related to each other. ### LexWord -Initialization: +#### Initialization: LexWord(word, synset) -Incrementing word counter: +#### Incrementing word counter: add_count() LexWord also contains getters for `word`,`synset`, and `count`. From 9b1b61fafbabedaf55b27dccdc7f809d7eea6567 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Fri, 3 Nov 2017 00:57:00 -0400 Subject: [PATCH 30/41] Added LexChain documentation to the readme --- SummarizationModule/README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/SummarizationModule/README.md b/SummarizationModule/README.md index 53f9895..39c7255 100644 --- a/SummarizationModule/README.md +++ b/SummarizationModule/README.md @@ -7,12 +7,35 @@ LexicalChain.py contains the code for the data structures used in the summarizer of `LexChain`s, which each contain a list of `LexWord`s contextually related to each other. ### LexWord +`LexWord` contains the information of a single candidate word. #### Initialization: LexWord(word, synset) #### Incrementing word counter: add_count() LexWord also contains getters for `word`,`synset`, and `count`. +### LexChain +`LexChain` contains a list of `LexWord`s with semantic relations. +#### Initialization: + LexChain(words=None, length=0, strength=0, wqlen = 10) +`wqlen` represents the number of words we most recently added that we want to check for contextual relations. +#### Adding a new word to the chain: + add_word(word, synset) +#### Check the similarity of a new synset with the chain: + get_simil(synset) +#### Obtain strength of chain: + get_strength() +The strength is defined as the strength of the relationship between the words within the chain. +#### Obtain score of chain: + get_score() +The score is defined as the relative value of importance of the chain compared to other chains. +#### Obtain key words of chain: + get_key_words() +Returns words that are representative of the chain. Chooses by returning words that have counts higher than the +mean + 0.5 * standard deviation. +#### Return a shallow copy of the chain: + get_copy() + ## Summarizer.py Summarizer.py uses the data structures in LexicalChain.py to generate a summary from a given text. From 49006ad8de5ec5816be294df296ef85b1e78ce80 Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Fri, 3 Nov 2017 01:01:40 -0400 Subject: [PATCH 31/41] Added LexChainGroup documentation to the readme --- SummarizationModule/README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/SummarizationModule/README.md b/SummarizationModule/README.md index 39c7255..5c4ff1a 100644 --- a/SummarizationModule/README.md +++ b/SummarizationModule/README.md @@ -33,7 +33,27 @@ The score is defined as the relative value of importance of the chain compared t get_key_words() Returns words that are representative of the chain. Chooses by returning words that have counts higher than the mean + 0.5 * standard deviation. -#### Return a shallow copy of the chain: +#### Obtain a shallow copy of the chain: + get_copy() + +### LexChainGroup +`LexChainGroup` contains a group of `LexChain`s built together from a text. +#### Initialization: + LexChainGroup(chains=None, chain_cap=-1) +`chain_cap` represents the maximum amount of chains that the group is willing to hold. If this cap is exceeded, the +weakest chain is dropped from the group. If this is set to -1, there is no cap. +#### Obtain most relevant synset from a group of synsets: + get_most_relevant(synsetset) +Use this to pick the correct definition for a word with multiple definitions. +#### Add a new word to the chain group: + add_to_chain(word, synset): +#### Obtain strength of chain: + get_strength() +Returns the sum of strengths of all chains. +#### Obtain most relevant chains: + get_top_chains(n) +Returns the n highest scoring chains. +#### Obtain a shallow copy of the chain group: get_copy() ## Summarizer.py From 69c5e5aacdbdd6f1d24a802d52af1515287daadb Mon Sep 17 00:00:00 2001 From: Kevin Xia Date: Mon, 13 Nov 2017 20:30:35 -0500 Subject: [PATCH 32/41] Remove all files irrelevant to the summarization module. --- Backend/README.md | 196 - Backend/app.js | 481 -- Backend/config.js | 3 - Backend/endpoints.md | 76 - Backend/package-lock.json | 945 --- Backend/package.json | 22 - Backend/yarn.lock | 713 -- Database/README.md | 20 - Frontend/.gitignore | 15 - Frontend/README.md | 18 - Frontend/authenticate.html | 27 - Frontend/createFolder | 0 Frontend/package-lock.json | 141 - Frontend/package.json | 29 - Frontend/public/favicon.ico | Bin 3870 -> 0 bytes Frontend/public/index.html | 65 - Frontend/public/manifest.json | 15 - Frontend/public/placeholder-favicon.png | Bin 1068 -> 0 bytes Frontend/src/App.css | 73 - Frontend/src/App.js | 21 - Frontend/src/App.test.js | 8 - Frontend/src/README.md | 2164 ----- Frontend/src/Routes.js | 22 - Frontend/src/__tests__/login.test.js | 16 - Frontend/src/__tests__/passwordreset.test.js | 12 - Frontend/src/__tests__/register.test.js | 12 - .../__tests__/requestpasswordreset.test.js | 12 - Frontend/src/__tests__/texteditor.test.js | 14 - .../src/assets/background/paper-coffee.svg | 43 - .../assets/background/white-headphones.svg | 25 - .../src/assets/background/white-pencil.svg | 23 - .../src/assets/background/white-plane.svg | 37 - Frontend/src/assets/bars-icon.svg | 16 - Frontend/src/assets/dropdown.svg | 10 - Frontend/src/assets/logo-type.svg | 35 - Frontend/src/assets/nav-x-icon.svg | 15 - Frontend/src/assets/paper-plane-icon.svg | 15 - Frontend/src/assets/pencil-icon-orange.svg | 20 - Frontend/src/assets/pencil-icon.svg | 15 - Frontend/src/assets/plus-icon.svg | 25 - Frontend/src/assets/white-logotype.svg | 35 - Frontend/src/assets/x-icon.svg | 22 - Frontend/src/config.js | 2 - Frontend/src/css/footer.css | 42 - Frontend/src/css/login.css | 83 - Frontend/src/css/nav.css | 72 - Frontend/src/css/profile.css | 42 - Frontend/src/css/register.css | 52 - Frontend/src/css/requestPasswordReset.css | 0 Frontend/src/css/summary.css | 143 - Frontend/src/index.css | 5 - Frontend/src/index.js | 8 - Frontend/src/logo.svg | 7 - Frontend/src/pages/components/Footer.js | 12 - Frontend/src/pages/components/Nav.js | 63 - Frontend/src/pages/login/Login.js | 85 - Frontend/src/pages/login/LoginForm.js | 22 - Frontend/src/pages/login/PasswordReset.js | 76 - Frontend/src/pages/login/Register.js | 62 - .../src/pages/login/RequestPasswordReset.js | 54 - Frontend/src/pages/login/simplif-03.svg | 13 - .../src/pages/login/simplif-logotype-04.svg | 1 - Frontend/src/pages/profile/Profile.js | 284 - Frontend/src/pages/summary/index.js | 135 - Frontend/src/registerServiceWorker.js | 108 - Frontend/src/utils/api.js | 9 - Frontend/yarn.lock | 7289 ----------------- Templates/HTML_TEMPLATE.html | 15 - Templates/REACT_COMPONENT_TEMPLATE.jsx | 19 - 69 files changed, 14159 deletions(-) delete mode 100644 Backend/README.md delete mode 100644 Backend/app.js delete mode 100644 Backend/config.js delete mode 100644 Backend/endpoints.md delete mode 100644 Backend/package-lock.json delete mode 100644 Backend/package.json delete mode 100644 Backend/yarn.lock delete mode 100644 Database/README.md delete mode 100644 Frontend/.gitignore delete mode 100644 Frontend/README.md delete mode 100644 Frontend/authenticate.html delete mode 100644 Frontend/createFolder delete mode 100644 Frontend/package-lock.json delete mode 100644 Frontend/package.json delete mode 100644 Frontend/public/favicon.ico delete mode 100644 Frontend/public/index.html delete mode 100644 Frontend/public/manifest.json delete mode 100644 Frontend/public/placeholder-favicon.png delete mode 100644 Frontend/src/App.css delete mode 100644 Frontend/src/App.js delete mode 100644 Frontend/src/App.test.js delete mode 100644 Frontend/src/README.md delete mode 100644 Frontend/src/Routes.js delete mode 100644 Frontend/src/__tests__/login.test.js delete mode 100644 Frontend/src/__tests__/passwordreset.test.js delete mode 100644 Frontend/src/__tests__/register.test.js delete mode 100644 Frontend/src/__tests__/requestpasswordreset.test.js delete mode 100644 Frontend/src/__tests__/texteditor.test.js delete mode 100644 Frontend/src/assets/background/paper-coffee.svg delete mode 100644 Frontend/src/assets/background/white-headphones.svg delete mode 100644 Frontend/src/assets/background/white-pencil.svg delete mode 100644 Frontend/src/assets/background/white-plane.svg delete mode 100644 Frontend/src/assets/bars-icon.svg delete mode 100644 Frontend/src/assets/dropdown.svg delete mode 100644 Frontend/src/assets/logo-type.svg delete mode 100644 Frontend/src/assets/nav-x-icon.svg delete mode 100644 Frontend/src/assets/paper-plane-icon.svg delete mode 100644 Frontend/src/assets/pencil-icon-orange.svg delete mode 100644 Frontend/src/assets/pencil-icon.svg delete mode 100644 Frontend/src/assets/plus-icon.svg delete mode 100644 Frontend/src/assets/white-logotype.svg delete mode 100644 Frontend/src/assets/x-icon.svg delete mode 100644 Frontend/src/config.js delete mode 100644 Frontend/src/css/footer.css delete mode 100644 Frontend/src/css/login.css delete mode 100644 Frontend/src/css/nav.css delete mode 100644 Frontend/src/css/profile.css delete mode 100644 Frontend/src/css/register.css delete mode 100644 Frontend/src/css/requestPasswordReset.css delete mode 100644 Frontend/src/css/summary.css delete mode 100644 Frontend/src/index.css delete mode 100644 Frontend/src/index.js delete mode 100644 Frontend/src/logo.svg delete mode 100644 Frontend/src/pages/components/Footer.js delete mode 100644 Frontend/src/pages/components/Nav.js delete mode 100644 Frontend/src/pages/login/Login.js delete mode 100644 Frontend/src/pages/login/LoginForm.js delete mode 100644 Frontend/src/pages/login/PasswordReset.js delete mode 100644 Frontend/src/pages/login/Register.js delete mode 100644 Frontend/src/pages/login/RequestPasswordReset.js delete mode 100644 Frontend/src/pages/login/simplif-03.svg delete mode 100644 Frontend/src/pages/login/simplif-logotype-04.svg delete mode 100644 Frontend/src/pages/profile/Profile.js delete mode 100644 Frontend/src/pages/summary/index.js delete mode 100644 Frontend/src/registerServiceWorker.js delete mode 100644 Frontend/src/utils/api.js delete mode 100644 Frontend/yarn.lock delete mode 100644 Templates/HTML_TEMPLATE.html delete mode 100644 Templates/REACT_COMPONENT_TEMPLATE.jsx diff --git a/Backend/README.md b/Backend/README.md deleted file mode 100644 index 4629dff..0000000 --- a/Backend/README.md +++ /dev/null @@ -1,196 +0,0 @@ -# Backend - -## Endpoints - -### /login -Receives: -{ -email: "sdblatz@gmail.com", - -password: "securePassword" -} - -Sends: -{ -sucess: "true", - -token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ", - -error: "Email does not exist." //optional -} - -### /editProfile -Receives: -{ -email: "sdblatz@gmail.com", - -newEmail: "sblatz@purdue.edu", //optional - -newName: "Sawyer" //optional -} - -Sends: -{ -sucess: "true", - -error: "Email does not exist." //optional -} - -### /profile - -Receives: -{ -email: "sdblatz@gmail.com" -} - -Sends: -{ -sucess: "true", - -name: "Sawyer", - -email: "sdblatz@gmail.com", - -password: "securePass", - -prefersEmailUpdates: "0", - -postCount: "3" -} - -### /loginToGoogle - -Sends: -{ - -sucess: "true" - -error: "Authentication failed" //optional - -token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9" -} - -### /createAccount - -Receives: -{ -email: "sdblatz@gmail.com", - -name: "Sawyer", - -email: "sdblatz@gmail.com", - -password: "securePass", - -prefersEmailUpdates: "0" -} - -Sends: -{ -sucess: "true" - -error: "Email already exists." //optional -} - -### /deleteAccount - -Receives: -{ -email: "sdblatz@gmail.com" -} - -Sends: -{ -sucess: "true", - -error: "Email doesn't exist." //optional -} - -### /changePassword - -Receives: -{ -email: "sdblatz@gmail.com", - -password: "oldPassword", - -newPassword: "newPassword" -} - -Sends: -{ -sucess: "true", - -error: "Email doesn't exist." //optional -} - -### /receivePassword -Receives: -{ -email: "luna.ad2@gmail.com", -} - -Sends: -{ -sucess: sends email to the above email -erro: "email has not been sent" -} - -This is a post request for sending an email of the link to reset the password. -An email is sent in the body of the request where the reset password link will be sent to it -using nodemailer in nodejs. - -## How to use summarizer Api -To send text to the summarizer Api to summarize(using the middleware endpoint): -1. Make a post http-request on the endpoint path 'http://localhost:8000/sumarizertext'. -2. Add the text to be sent in a json object as below: -```javascipt -var mock = "Hi this is Lena's mock text"; -var json = { - 'text': mock -} -``` -3. The body received from the request of the middleware endpoint is in a stringified JSON object -4. Handle that summarized data recieved as needed -5. The data that will sent back to your api that called the middleware should be parsed to a JSON object -#Example -An example of a get request of making an api that does a post request to send the text to the middleware endpoint, receives the strignifies JSON object of the summarized data from the middleware endpoint, then makes a callback to send that data back to the api that called the middleware. This example doesn't handle or make any changes to the summarized data, but it could be added. -```javascript -app.get('/mocktext', function(req, res) { - var mock = "Hi this is Lena's mock text"; - var json = { - 'text': mock - } - console.log("json of text: " + json) - var options = { - url: 'http://localhost:8000/sumarizertext', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(json) - } - request.post(options, function(error, response, body){ - res.send(JSON.parse(body)); - }) -}) -``` - -## How to test the middleware api fuctionality - -1. Pull the code -2. Use this command to install all dependencies needed from the package.js -``` -npm install -``` -3. Everything should be setup so you can run: -``` -node app.js -``` -4. You'll see a message on console "Listening to port 8000" - -5. Go to a browser and put in url: 'http://localhost:8000/mocktext' - -6. You will see the mock summarizer data that was sent from summarizer api - - - diff --git a/Backend/app.js b/Backend/app.js deleted file mode 100644 index 5307504..0000000 --- a/Backend/app.js +++ /dev/null @@ -1,481 +0,0 @@ -/** - * midlle ware to connect frontend with api for summarizer - * creates all dependencies and endpoints - * Author: Lena Arafa - * Date: 9/24/2017 - */ - -//List dependencies -var config = require('./config'); -const express = require('express'); -const app = express(); -const parseurl = require('parseurl'); -const bodyparser = require('body-parser'); -const path = require('path'); -//const expressValidator = require('express-validator'); -const request = require('request'); -const mysql = require('mysql'); -const nodemailer = require ('nodemailer'); -var jwt = require('jsonwebtoken'); -app.set('superSecret', config.secret); // secret variable - - -//setup database -var connection = mysql.createConnection({ - host: 'simplifaidb.caijj6vztwxw.us-east-2.rds.amazonaws.com', - user: 'admin', - password: 'mGLPkLat3W^y9w[w', - port: '3306', - database : 'Simplifai_Database' -}); - -//parse application/JSON -app.use(bodyparser.json()); - -// enable cors -app.use(function(req, res, next) { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); - next(); -}); - -//User endpoint -//Forget passowrd mailto endpoint - - -//this is a mock api to test the fuctionality of the -//middleware function -app.get('/mocktext', function (req, res) { - var mock = "Hi this is Lena's mock text"; - var json = { - 'text': mock - } - var options = { - url: 'http://localhost:8000/sumarizertext', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(json) - } - // res.send(options.body); - request.post(options, function (error, response, body) { - //console.log(body); - res.send(JSON.parse(body)); - }); -}); - -//Text endpoint; text sumbitted by user is handled here -//It is then sent to the summarizer api and the data received -//is sent back to the user -app.post('/sumarizertext', function (req, res) { - //url subject to change once api is created - console.log('req.body', req.body); - var summarizerApi = "https://ir.thirty2k.com/summarize"; - var options = { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - body: JSON.stringify(req.body), - method: 'POST' - } - - //send the text received from user to api of summarizer - //get for testing reasons, use post when using summarizer api url - request.post(summarizerApi, options, function(error, response, body) { - //recives data from summarizerAPI - //sends it back to the summarizertext endpoint which would be the - //body response to any request that posts a request to it - //uses json to send a stringfied json object of the non-object data from api - - if (!error && response.statusCode === 200) { - res.send(response.body); - } else { - res.send({ success: false, error: error }); - } - }); -}); - -//another request to get the saved version from the user of the summarizer text -//and send it to db -app.post('/savetodb', function (req, res) { - connection.connect(function (err) { - if (err) { - console.error('Database connection failed: ' + err.stack); - return; - } - console.log('Connected to database.'); - var sql = "ALTER TABLE User ADD COLUMN summary STRING AUTO_INCREMENT PRIMARY KEY"; - connection.query(sql, function(err, result){ - if(err) { - console.error('Error with adding summary column'); - } else { - console.log('Table Altered'); - } - - sql = "INSERT INTO Users (summary) VALUES ("+req.body+")"; - }); - connection.query(sql, function(err, result){ - if(err) { - console.error('Error with instering summary in table'); - } - console.log('summary record inserted'); - }); - }); - connection.end(); -}); - -//request to receive forget password post and send an email to user -app.post('/mailto', function (req, res) { - //get email of user from db - //receive email and link to reset? - var email; - // connection.connect(function (err) { - // if (err) { - // console.error('Database connection failed: ' + err.stack); - // return; - // } - // console.log('Connected to database.'); - // sql = "SELECT email FROM Users where idUser = "; - // connection.query(sql, function(err, result, fields){ - // if(err) { - // console.error('Error with retrieving email from table'); - // } - // email = result; - // console.log('email retreived'); - // }) - // }) - // connection.end(); - - //send email - //text has the paramter url of connecting to the page for resetting password - -}); - - -/** -*** These are the Google Authentication methods which we use in ordre to authenticate a user with if they don't have an account. -**/ -//Google authentication setup -var GoogleAuth; // Google Auth object. -function initClient() { - gapi.client.init({ - 'apiKey': 'ON6JuWU0xirbexXJ3H2a7wYq', - 'clientId': '950783336607-ouratd1dt1hr3baond6u36664ijrmjnq.apps.googleusercontent.com', - 'scope': 'https://www.googleapis.com/auth/drive.metadata.readonly', - 'discoveryDocs': ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest'] - }).then(function () { - GoogleAuth = gapi.auth2.getAuthInstance(); - - // Listen for sign-in state changes. - GoogleAuth.isSignedIn.listen(updateSigninStatus); - - // Handle initial sign-in state. (Determine if user is already signed in.) - var user = GoogleAuth.currentUser.get(); - setSigninStatus(); - - }); -}; - -function setSigninStatus(isSignedIn) { - var user = GoogleAuth.currentUser.get(); - var isAuthorized = user.hasGrantedScopes(SCOPE); - if (isAuthorized) { - //set something about being authorized - } else { - //let the user know they're not authorized - } - }; - -//login endpoint -//allows the user to login with google authentication -app.post('/loginToGoogle', function(req, res) { - if (GoogleAuth.isSignedIn.get()) { - //user is already signed in! - } else { - // User is not signed in. Start Google auth flow. - GoogleAuth.signIn(); - } - - var token = jwt.sign(payload, "secretString", { - expiresIn: 60 * 60 * 24 // expires in 24 hours - }); - - res.status(200).send({ success: true, token: token}); - - //return JWT token -}); - -app.post('/login', function(req, res) { - //login without google API - //email and password given - var user = req.body; - var email = user.email; - var password = user.password; - - connection.query("SELECT * FROM users WHERE email = ? AND password = ?", [email, password], function (err, result) { - if (err) { - res.status(500).send({ success: false, error: err }); - } else { - console.log(result) - const payload = { - admin: email - }; - - var token = jwt.sign(payload, app.get('superSecret'), { - expiresIn: 60 * 60 * 24 // expires in 24 hours - }); - - if (result.length == 1) { - //do JWT stuff - res.status(200).send({ success: true, token: token}); - } else { - res.status(500).send({ success: false, error: "Username or password is incorrect."}); - } - } - }) -}) - -//this endpoint allows the user to change their password in the database. -app.post('/changePassword', function(req, res) { - //talk to database here once Lena has imported it - var user = req.body; - var email = user.email; - var password = user.password; - var newPassword = user.newPassword; - - connection.query("SELECT * FROM users WHERE email = ? AND password = ?", [email, password], function (err, result) { - if (err) { - console.log("err"); - res.status(500).send({ success: false, error: err }); - } else { - console.log("Not err"); - console.log(result); - if (result.length == 1) { - console.log("count is 1"); - connection.query("UPDATE users SET password = ? WHERE email = ?", [newPassword, email], function (err, result) { - if (err) { - console.log("err 2"); - res.status(500).send({ success: false, error: error }); - } else { - console.log("Success!"); - res.status(200).send({ success: true}); - } - }) - } else { - res.status(500).send({ success: false, error: "User not found." }); - } - } - }) -}); - -//this endpoint will send an email to the email passed in using the mailer. The email will contain a link so the user can reset their password -app.post('/resetPassword', function(req, res, next) { - //use mailer to send email to the email address passed in. - //console.log(req); - // console.log(req.body); - var email = req.body.email; - console.log("email " + email); - var url = 'http://localhost:3000/password-reset?email=' + email; - var transporter = nodemailer.createTransport({ - service: 'GMAIL', - auth: { - user: 'simplif.ai17@gmail.com', - pass: 'simplif.ai2017' - } - }); - console.log(transporter); - var mailOptions = { - from: 'simplif.ai17@gmail.com', - to: email, - subject: 'Reset password to Simplif.ai', - text: url, - html: '

' +url + '

' - } - console.log(mailOptions.html); - transporter.sendMail(mailOptions, function(error, info){ - console.log(error); - console.log(info); - if(error) { - console.log('error sending email for resetting password'); - } - else { - console.log('Email sent: ' + req.param.url); - } - nodemailer.getTestMessageUrl(info); - transporter.close(); - }); - - -}); - -//this endpoint deletes the user from the database and removes all data associated with them. -app.post('/deleteAccount', function(req,res) { - //deep delete the user data and all of the data it points to - var user = req.body; - var email = user.email; - - - //get the user ID from the email address: - connection.query("SELECT * FROM users WHERE email = ?", [email], function (err, result) { - if (err) { - res.status(500).send({ success: false, error: error }); - } else { - console.log("inside user"); - var id = result[0].idUser; - //query notes for all with this userID: - connection.query("SELECT * FROM notes WHERE userID = ?", [id], function (err, result) { - if (err) { - - } else { - console.log("inside notes"); - for (var i = 0; i < result.length; i++) { - console.log("inside for loop"); - //delete all the summaries: - connection.query("DELETE FROM summaries WHERE noteID = ?", [result[i].idNote], function(err, result) { - if (err) { - console.log("Couldn't delete summary"); - } - }); - - //delete the actual note: - connection.query("DELETE FROM notes WHERE idNote = ?", [result[i].idNote], function(err, result) { - if (err) { - console.log("Couldn't delete note"); - } - }); - } - - //all notes deleted, delete the actual user! - connection.query("DELETE FROM users WHERE idUser = ?", [id], function(err, result) { - if (err) { - console.log("Couldn't delete user"); - } else { - console.log("Deleting user!"); - res.status(200).send({ success: true}); - } - }); - } - }); - } - }); -}); - -//lets the user create an account without google authentication by using our database instead. -app.post('/createAccount', function(req, res) { - - //res.status(500).send({success: false, body: req.body.name}) - console.log('req', req.body); - var user = req.body - var name = user.name - var email = user.email - var password = user.password - var prefersEmailUpdates = user.prefersEmailUpdates - - //check if this email exists already in the database, if so, return an error. - connection.query("SELECT * FROM users WHERE email = ?", [email], function (err, result) { - console.log("inside select"); - if (err) { - res.status(500).send({ success: false, error: err }); - } - console.log('result', result); - if (result.length > 0) { - //sorry, this email is already taken! - console.log("Email address already taken."); - console.log("email collison: " + result[0].email); - res.status(500).send({ success: false, error: "This email address is already taken." }); - } else { - console.log("length 1"); - var newUser = { - name: name, - email: email, - password: password, - feedback: '', - prefersEmailUpdates: prefersEmailUpdates, - noteCount: 0 - } - connection.query('INSERT INTO users SET ?', newUser, function(err, result) { - console.log("inside insert"); - if (err) { - res.status(500).send({success: false, error: err}) - } else { - res.status(200).send({success: true}); - } - }); - } - }); -}); - -app.post('/profile', function(req, res) { - - //fetch the user by email and return it in json - var user = req.body; - var email = user.email; - console.log('req.body', req.body); - connection.query("SELECT * FROM users WHERE email = ?", [email], function (err, result) { - if (result.length == 0) { - res.status(500).send({ success: false, error: "This email address doesn't exist." }); - - } else if (result.length == 1) { - var data = { - success: true, - name: result[0].name, - email: result[0].email, - password: result[0].password, - prefersEmailUpdates: result[0].prefersEmailUpdates, - postCount: result[0].postCount - } - - res.send(data) - - } else { - //more than one user? - console.log("More than one user found..."); - } - }); -}); - -app.post('/editProfile', function(req, res) { - //update name - //update email - var user = req.body; - var email = user.email; - - if (user.newEmail != null) { - //update email - console.log("Update email"); - // 'UPDATE employees SET location = ? Where ID = ?', - - connection.query("UPDATE users SET email = ? WHERE email = ?", [user.newEmail, user.email], function (err, result) { - if (err) { - res.status(500).send({success: false, error: err}) - } - }); - - } else { - console.log("email not updated"); - } - - if (user.newName != null) { - //update name - console.log("Update name"); - connection.query("UPDATE users SET name = ? WHERE email = ?", [user.newName, user.email], function (err, result) { - if (err) { - res.status(500).send({success: false, error: err}) - - } - }); - - } else { - console.log("name not updated"); - - } - - res.status(200).send({success: true}) - - -}); - - -app.listen('8000'); -console.log('Listening on port ' + 8000 + '...'); diff --git a/Backend/config.js b/Backend/config.js deleted file mode 100644 index 7a9b9a6..0000000 --- a/Backend/config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - 'secret': 'secretTesting' -}; diff --git a/Backend/endpoints.md b/Backend/endpoints.md deleted file mode 100644 index f5b13c3..0000000 --- a/Backend/endpoints.md +++ /dev/null @@ -1,76 +0,0 @@ - -### /editProfile -Receives: -{ -email: "sdblatz@gmail.com" -newEmail: "sblatz@purdue.edu" //optional -newName: "Sawyer" //optional -} - -Sends: -{ -sucess: "true" -error: "Email does not exist." //optional -} - -### /profile - -Receives: -{ -email: "sdblatz@gmail.com" -} - -Sends: -{ -sucess: "true" -name: "Sawyer" -email: "sdblatz@gmail.com" -password: "securePass" -prefersEmailUpdates: "0" -postCount: "3" -} - -### /createAccount - -Receives: -{ -email: "sdblatz@gmail.com" -name: "Sawyer" -email: "sdblatz@gmail.com" -password: "securePass" -prefersEmailUpdates: "0" -} - -Sends: -{ -sucess: "true" -error: "Email already exists." //optional -} - -### /deleteAccount - -Receives: -{ -email: "sdblatz@gmail.com" -} - -Sends: -{ -sucess: "true" -error: "Email doesn't exist." //optional -} - -### /changePassword - -Receives: -{ -email: "sdblatz@gmail.com" -password: "oldPassword" -newPassword: "newPassword" -} - -Sends: -{ -sucess: "true" -error: "Email doesn't exist." //optional -} diff --git a/Backend/package-lock.json b/Backend/package-lock.json deleted file mode 100644 index e34c91d..0000000 --- a/Backend/package-lock.json +++ /dev/null @@ -1,945 +0,0 @@ -{ - "name": "backend", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "accepts": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", - "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", - "requires": { - "mime-types": "2.1.17", - "negotiator": "0.6.1" - } - }, - "ajv": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz", - "integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=", - "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "json-schema-traverse": "0.3.1", - "json-stable-stringify": "1.0.1" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" - }, - "base64url": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-2.0.0.tgz", - "integrity": "sha1-6sFuA+oUOO/5Qj1puqNiYu0fcLs=" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "optional": true, - "requires": { - "tweetnacl": "0.14.5" - } - }, - "bignumber.js": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.0.4.tgz", - "integrity": "sha512-LDXpJKVzEx2/OqNbG9mXBNvHuiRL4PzHCGfnANHMJ+fv68Ads3exDVJeGDJws+AoNEuca93bU3q+S0woeUaCdg==" - }, - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "1.0.4", - "debug": "2.6.9", - "depd": "1.1.1", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "1.6.15" - } - }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "requires": { - "hoek": "4.2.0" - } - }, - "buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "requires": { - "delayed-stream": "1.0.0" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "requires": { - "boom": "5.2.0" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "requires": { - "hoek": "4.2.0" - } - } - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "1.0.0" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "ecdsa-sig-formatter": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz", - "integrity": "sha1-S8kmJ07Dtau1AW5+HWCSGsJisqE=", - "requires": { - "base64url": "2.0.0", - "safe-buffer": "5.1.1" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "encodeurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", - "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=" - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "express": { - "version": "4.16.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.1.tgz", - "integrity": "sha512-STB7LZ4N0L+81FJHGla2oboUHTk4PaN1RsOkoRh9OSeEKylvF5hwKYVX1xCLFaCT7MD0BNG/gX2WFMLqY6EMBw==", - "requires": { - "accepts": "1.3.4", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "1.1.1", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "etag": "1.8.1", - "finalhandler": "1.1.0", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "1.1.2", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "2.0.2", - "qs": "6.5.1", - "range-parser": "1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.1", - "serve-static": "1.13.1", - "setprototypeof": "1.1.0", - "statuses": "1.3.1", - "type-is": "1.6.15", - "utils-merge": "1.0.1", - "vary": "1.1.2" - }, - "dependencies": { - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - } - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" - }, - "finalhandler": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", - "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", - "requires": { - "debug": "2.6.9", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", - "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "1.0.0" - } - }, - "google-auth-library": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-0.11.0.tgz", - "integrity": "sha512-vDHBtAjXHMR5T137Xu3ShPqUdABYGQFm6LZJJWtg0gKWfQCMIx1ebQygvr8gZrkHw/0cAjRJjr0sUPgDWfcg7w==", - "requires": { - "gtoken": "1.2.2", - "jws": "3.1.4", - "lodash.isstring": "4.0.1", - "lodash.merge": "4.6.0", - "request": "2.83.0" - } - }, - "google-p12-pem": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-0.1.2.tgz", - "integrity": "sha1-M8RqsCGqc0+gMys5YKmj/8svMXc=", - "requires": { - "node-forge": "0.7.1" - } - }, - "gtoken": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.2.tgz", - "integrity": "sha1-Fyd2oanZasCfwioA9b6DzubeiCA=", - "requires": { - "google-p12-pem": "0.1.2", - "jws": "3.1.4", - "mime": "1.4.1", - "request": "2.83.0" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "requires": { - "ajv": "5.2.3", - "har-schema": "2.0.0" - } - }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "hoek": "4.2.0", - "sntp": "2.0.2" - } - }, - "hoek": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": "1.3.1" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "ipaddr.js": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz", - "integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - }, - "jsonwebtoken": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.0.1.tgz", - "integrity": "sha1-UNrvjQqMfeLNBrwQE7dbBMzz8M8=", - "requires": { - "jws": "3.1.4", - "lodash.includes": "4.3.0", - "lodash.isboolean": "3.0.3", - "lodash.isinteger": "4.0.4", - "lodash.isnumber": "3.0.3", - "lodash.isplainobject": "4.0.6", - "lodash.isstring": "4.0.1", - "lodash.once": "4.1.1", - "ms": "2.0.0", - "xtend": "4.0.1" - } - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "jwa": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.5.tgz", - "integrity": "sha1-oFUs4CIHQs1S4VN3SjKQXDDnVuU=", - "requires": { - "base64url": "2.0.0", - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.9", - "safe-buffer": "5.1.1" - } - }, - "jws": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.4.tgz", - "integrity": "sha1-+ei5M46KhHJ31kRLFGT2GIDgUKI=", - "requires": { - "base64url": "2.0.0", - "jwa": "1.1.5", - "safe-buffer": "5.1.1" - } - }, - "lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" - }, - "lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" - }, - "lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" - }, - "lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" - }, - "lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" - }, - "lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" - }, - "lodash.merge": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.0.tgz", - "integrity": "sha1-aYhLoUSsM/5plzemCG3v+t0PicU=" - }, - "lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" - }, - "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", - "requires": { - "mime-db": "1.30.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "mysql": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.15.0.tgz", - "integrity": "sha512-C7tjzWtbN5nzkLIV+E8Crnl9bFyc7d3XJcBAvHKEVkjrYjogz3llo22q6s/hw+UcsE4/844pDob9ac+3dVjQSA==", - "requires": { - "bignumber.js": "4.0.4", - "readable-stream": "2.3.3", - "safe-buffer": "5.1.1", - "sqlstring": "2.3.0" - } - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, - "node-forge": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.1.tgz", - "integrity": "sha1-naYR6giYL0uUIGs760zJZl8gwwA=" - }, - "nodemailer": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-4.1.2.tgz", - "integrity": "sha512-qDKhvCaGXjSL/cbIZerBY3Ftjobe3R005/uV92K5DqHlnO6tlt3ZS+WxuCXtrGVZJk/JzzA5CnNM9+7tm7klWg==" - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "path": { - "version": "0.12.7", - "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", - "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", - "requires": { - "process": "0.11.10", - "util": "0.10.3" - } - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, - "proxy-addr": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", - "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", - "requires": { - "forwarded": "0.1.2", - "ipaddr.js": "1.5.2" - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - } - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } - }, - "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", - "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.3.1", - "har-validator": "5.0.3", - "hawk": "6.0.2", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", - "oauth-sign": "0.8.2", - "performance-now": "2.1.0", - "qs": "6.5.1", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.3", - "tunnel-agent": "0.6.0", - "uuid": "3.1.0" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - }, - "send": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", - "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", - "requires": { - "debug": "2.6.9", - "depd": "1.1.1", - "destroy": "1.0.4", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "etag": "1.8.1", - "fresh": "0.5.2", - "http-errors": "1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "2.3.0", - "range-parser": "1.2.0", - "statuses": "1.3.1" - } - }, - "serve-static": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", - "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", - "requires": { - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "parseurl": "1.3.2", - "send": "0.16.1" - } - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - }, - "sntp": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", - "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=", - "requires": { - "hoek": "4.2.0" - } - }, - "sqlstring": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.0.tgz", - "integrity": "sha1-UluKT9Jtb3GqYegipsr5dtMa0qg=" - }, - "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - } - }, - "statuses": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", - "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "requires": { - "safe-buffer": "5.1.1" - } - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, - "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", - "requires": { - "punycode": "1.4.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "5.1.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "type-is": { - "version": "1.6.15", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", - "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", - "requires": { - "media-typer": "0.3.0", - "mime-types": "2.1.17" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "requires": { - "inherits": "2.0.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" - } - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - } - } -} diff --git a/Backend/package.json b/Backend/package.json deleted file mode 100644 index 3e5cff7..0000000 --- a/Backend/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "backend", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "body-parser": "^1.18.2", - "express": "^4.15.4", - "google-auth-library": "^0.11.0", - "jsonwebtoken": "^8.0.1", - "mysql": "^2.14.1", - "nodemailer": "^4.1.2", - "parseurl": "^1.3.2", - "path": "^0.12.7", - "request": "^2.83.0" - } -} diff --git a/Backend/yarn.lock b/Backend/yarn.lock deleted file mode 100644 index f14c1c4..0000000 --- a/Backend/yarn.lock +++ /dev/null @@ -1,713 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -accepts@~1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.4.tgz#86246758c7dd6d21a6474ff084a4740ec05eb21f" - dependencies: - mime-types "~2.1.16" - negotiator "0.6.1" - -ajv@^5.1.0: - version "5.2.3" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.3.tgz#c06f598778c44c6b161abafe3466b81ad1814ed2" - dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - json-schema-traverse "^0.3.0" - json-stable-stringify "^1.0.1" - -array-flatten@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - -asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - -aws4@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" - -base64url@2.0.0, base64url@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/base64url/-/base64url-2.0.0.tgz#eac16e03ea1438eff9423d69baa36262ed1f70bb" - -bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" - dependencies: - tweetnacl "^0.14.3" - -bignumber.js@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.0.4.tgz#7c40f5abcd2d6623ab7b99682ee7db81b11889a4" - -body-parser@1.18.2, body-parser@^1.18.2: - version "1.18.2" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454" - dependencies: - bytes "3.0.0" - content-type "~1.0.4" - debug "2.6.9" - depd "~1.1.1" - http-errors "~1.6.2" - iconv-lite "0.4.19" - on-finished "~2.3.0" - qs "6.5.1" - raw-body "2.3.2" - type-is "~1.6.15" - -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - dependencies: - hoek "4.x.x" - -buffer-equal-constant-time@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" - -bytes@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - -combined-stream@^1.0.5, combined-stream@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" - dependencies: - delayed-stream "~1.0.0" - -content-disposition@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" - -content-type@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - -cookie-signature@1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - -cookie@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" - -core-util-is@1.0.2, core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - dependencies: - boom "5.x.x" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - dependencies: - assert-plus "^1.0.0" - -debug@2.6.9: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - dependencies: - ms "2.0.0" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - -depd@1.1.1, depd@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" - -destroy@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" - -ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" - dependencies: - jsbn "~0.1.0" - -ecdsa-sig-formatter@1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.9.tgz#4bc926274ec3b5abb5016e7e1d60921ac262b2a1" - dependencies: - base64url "^2.0.0" - safe-buffer "^5.0.1" - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - -encodeurl@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20" - -escape-html@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - -etag@~1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - -express@^4.15.4: - version "4.16.1" - resolved "https://registry.yarnpkg.com/express/-/express-4.16.1.tgz#6b33b560183c9b253b7b62144df33a4654ac9ed0" - dependencies: - accepts "~1.3.4" - array-flatten "1.1.1" - body-parser "1.18.2" - content-disposition "0.5.2" - content-type "~1.0.4" - cookie "0.3.1" - cookie-signature "1.0.6" - debug "2.6.9" - depd "~1.1.1" - encodeurl "~1.0.1" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.1.0" - fresh "0.5.2" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "~2.3.0" - parseurl "~1.3.2" - path-to-regexp "0.1.7" - proxy-addr "~2.0.2" - qs "6.5.1" - range-parser "~1.2.0" - safe-buffer "5.1.1" - send "0.16.1" - serve-static "1.13.1" - setprototypeof "1.1.0" - statuses "~1.3.1" - type-is "~1.6.15" - utils-merge "1.0.1" - vary "~1.1.2" - -extend@~3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" - -extsprintf@1.3.0, extsprintf@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - -fast-deep-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" - -finalhandler@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.0.tgz#ce0b6855b45853e791b2fcc680046d88253dd7f5" - dependencies: - debug "2.6.9" - encodeurl "~1.0.1" - escape-html "~1.0.3" - on-finished "~2.3.0" - parseurl "~1.3.2" - statuses "~1.3.1" - unpipe "~1.0.0" - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - -form-data@~2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - -forwarded@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" - -fresh@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - dependencies: - assert-plus "^1.0.0" - -google-auth-library@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-0.11.0.tgz#1018444f3f0b62b48757948a0467208559cd2222" - dependencies: - gtoken "^1.2.1" - jws "^3.1.4" - lodash.isstring "^4.0.1" - lodash.merge "^4.6.0" - request "^2.81.0" - -google-p12-pem@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-0.1.2.tgz#33c46ab021aa734fa0332b3960a9a3ffcb2f3177" - dependencies: - node-forge "^0.7.1" - -gtoken@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-1.2.2.tgz#172776a1a9d96ac09fc22a00f5be83cee6de8820" - dependencies: - google-p12-pem "^0.1.0" - jws "^3.0.0" - mime "^1.2.11" - request "^2.72.0" - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" - dependencies: - ajv "^5.1.0" - har-schema "^2.0.0" - -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" - -hoek@4.x.x: - version "4.2.0" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" - -http-errors@1.6.2, http-errors@~1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.2.tgz#0a002cc85707192a7e7946ceedc11155f60ec736" - dependencies: - depd "1.1.1" - inherits "2.0.3" - setprototypeof "1.0.3" - statuses ">= 1.3.1 < 2" - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -iconv-lite@0.4.19: - version "0.4.19" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" - -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - -inherits@2.0.3, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -ipaddr.js@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.5.2.tgz#d4b505bde9946987ccf0fc58d9010ff9607e3fa0" - -is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - -json-stable-stringify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - dependencies: - jsonify "~0.0.0" - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -jwa@^1.1.4: - version "1.1.5" - resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.1.5.tgz#a0552ce0220742cd52e153774a32905c30e756e5" - dependencies: - base64url "2.0.0" - buffer-equal-constant-time "1.0.1" - ecdsa-sig-formatter "1.0.9" - safe-buffer "^5.0.1" - -jws@^3.0.0, jws@^3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/jws/-/jws-3.1.4.tgz#f9e8b9338e8a847277d6444b1464f61880e050a2" - dependencies: - base64url "^2.0.0" - jwa "^1.1.4" - safe-buffer "^5.0.1" - -lodash.isstring@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" - -lodash.merge@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.0.tgz#69884ba144ac33fe699737a6086deffadd0f89c5" - -media-typer@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - -methods@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - -mime-db@~1.30.0: - version "1.30.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" - -mime-types@^2.1.12, mime-types@~2.1.15, mime-types@~2.1.16, mime-types@~2.1.17: - version "2.1.17" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" - dependencies: - mime-db "~1.30.0" - -mime@1.4.1, mime@^1.2.11: - version "1.4.1" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -mysql@^2.14.1: - version "2.15.0" - resolved "https://registry.yarnpkg.com/mysql/-/mysql-2.15.0.tgz#ea16841156343e8f2e47fc8985ec41cdd9573b5c" - dependencies: - bignumber.js "4.0.4" - readable-stream "2.3.3" - safe-buffer "5.1.1" - sqlstring "2.3.0" - -negotiator@0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" - -node-forge@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.7.1.tgz#9da611ea08982f4b94206b3beb4cc9665f20c300" - -nodemailer@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-4.1.2.tgz#82e1fb61ddc7272fe4f34c5ba6adaa99faa8b635" - -oauth-sign@~0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" - -on-finished@~2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - dependencies: - ee-first "1.1.1" - -parseurl@^1.3.2, parseurl@~1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" - -path-to-regexp@0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - -path@^0.12.7: - version "0.12.7" - resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f" - dependencies: - process "^0.11.1" - util "^0.10.3" - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" - -process@^0.11.1: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - -proxy-addr@~2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.2.tgz#6571504f47bb988ec8180253f85dd7e14952bdec" - dependencies: - forwarded "~0.1.2" - ipaddr.js "1.5.2" - -punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - -qs@6.5.1, qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" - -range-parser@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" - -raw-body@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89" - dependencies: - bytes "3.0.0" - http-errors "1.6.2" - iconv-lite "0.4.19" - unpipe "1.0.0" - -readable-stream@2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - safe-buffer "~5.1.1" - string_decoder "~1.0.3" - util-deprecate "~1.0.1" - -request@^2.72.0, request@^2.81.0, request@^2.83.0: - version "2.83.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.6.0" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.1" - forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" - performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" - tunnel-agent "^0.6.0" - uuid "^3.1.0" - -safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" - -send@0.16.1: - version "0.16.1" - resolved "https://registry.yarnpkg.com/send/-/send-0.16.1.tgz#a70e1ca21d1382c11d0d9f6231deb281080d7ab3" - dependencies: - debug "2.6.9" - depd "~1.1.1" - destroy "~1.0.4" - encodeurl "~1.0.1" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "~1.6.2" - mime "1.4.1" - ms "2.0.0" - on-finished "~2.3.0" - range-parser "~1.2.0" - statuses "~1.3.1" - -serve-static@1.13.1: - version "1.13.1" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.13.1.tgz#4c57d53404a761d8f2e7c1e8a18a47dbf278a719" - dependencies: - encodeurl "~1.0.1" - escape-html "~1.0.3" - parseurl "~1.3.2" - send "0.16.1" - -setprototypeof@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" - -setprototypeof@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" - -sntp@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.0.2.tgz#5064110f0af85f7cfdb7d6b67a40028ce52b4b2b" - dependencies: - hoek "4.x.x" - -sqlstring@2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.0.tgz#525b8a4fd26d6f71aa61e822a6caf976d31ad2a8" - -sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: - bcrypt-pbkdf "^1.0.0" - ecc-jsbn "~0.1.1" - jsbn "~0.1.0" - tweetnacl "~0.14.0" - -"statuses@>= 1.3.1 < 2", statuses@~1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" - -string_decoder@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" - dependencies: - safe-buffer "~5.1.0" - -stringstream@~0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" - -tough-cookie@~2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" - dependencies: - punycode "^1.4.1" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - -type-is@~1.6.15: - version "1.6.15" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.15.tgz#cab10fb4909e441c82842eafe1ad646c81804410" - dependencies: - media-typer "0.3.0" - mime-types "~2.1.15" - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -util@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - dependencies: - inherits "2.0.1" - -utils-merge@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - -uuid@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" - -vary@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" diff --git a/Database/README.md b/Database/README.md deleted file mode 100644 index 1c447d2..0000000 --- a/Database/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Database -## Amazon RDS: Simplif.ai's database solution - -Simplif.ai uses Amazon RDS to store data about users, such as: -* email address -* notes -* summaries -* social network accounts - -Our database communicates with the backend to store data when necessary, as well as retrieve information for the backend when it is requested. The class structures for our data in RDS can be found in the design document. - -Note: In order to keep Amazon RDS inside the free tier, we will use less than 20GB of storage. - -More information regarding the setup and use of the RDS can be found [here](https://aws.amazon.com/getting-started/tutorials/create-mysql-db/). - - -The database has been populated with the data as outlined in our class diagram, and can be accessed at the following location with the credentials provided to team members: simplifai.caijj6vztwxw.us-east-2.rds.amazonaws.com - - -MYSQL queries are required in order to interface with the database and more information about them can be found [here](https://www.w3schools.com/nodejs/nodejs_mysql_insert.asp). diff --git a/Frontend/.gitignore b/Frontend/.gitignore deleted file mode 100644 index 963c114..0000000 --- a/Frontend/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# dependencies -/node_modules - -# testing -/coverage - -# production -/build - -# other -.DS_Store - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/Frontend/README.md b/Frontend/README.md deleted file mode 100644 index 69ec41d..0000000 --- a/Frontend/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Frontend - -## About -This folder contains the frontend for our application - -### Environment setup - -* Install yarn `npm install --global yarn` -* Run `yarn install` or `npm install` -* `yarn start` or `npm start` to run the webpack dev server - -## Google Authentication - -Simplif.ai uses Google's authentication API, which allows users to login to our application using their Google credentials. - -Credentials can be found [here](https://console.developers.google.com/apis/credentials?project=simplifai-181000). - -We have followed the instructions for creating an application through the Google API console (found [here](https://developers.google.com/identity/sign-in/web/devconsole-project/), which allows us to authenticate using the API. diff --git a/Frontend/authenticate.html b/Frontend/authenticate.html deleted file mode 100644 index 1bcc9e3..0000000 --- a/Frontend/authenticate.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - -
- - - \ No newline at end of file diff --git a/Frontend/createFolder b/Frontend/createFolder deleted file mode 100644 index e69de29..0000000 diff --git a/Frontend/package-lock.json b/Frontend/package-lock.json deleted file mode 100644 index e817415..0000000 --- a/Frontend/package-lock.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "name": "my-app", - "version": "0.1.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" - }, - "core-js": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", - "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" - }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "requires": { - "iconv-lite": "0.4.19" - } - }, - "fbjs": { - "version": "0.8.16", - "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz", - "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", - "requires": { - "core-js": "1.2.7", - "isomorphic-fetch": "2.2.1", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "promise": "7.3.1", - "setimmediate": "1.0.5", - "ua-parser-js": "0.7.14" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" - }, - "isomorphic-fetch": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", - "requires": { - "node-fetch": "1.7.3", - "whatwg-fetch": "2.0.3" - } - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" - }, - "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "requires": { - "js-tokens": "3.0.2" - } - }, - "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", - "requires": { - "encoding": "0.1.12", - "is-stream": "1.1.0" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - }, - "promise": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", - "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", - "requires": { - "asap": "2.0.6" - } - }, - "prop-types": { - "version": "15.6.0", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.0.tgz", - "integrity": "sha1-zq8IMCL8RrSjX2nhPvda7Q1jmFY=", - "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1" - } - }, - "react": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.0.0.tgz", - "integrity": "sha1-zn348ZQbA28Cssyp29DLHw6FXi0=", - "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "prop-types": "15.6.0" - } - }, - "react-dom": { - "version": "16.0.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.0.0.tgz", - "integrity": "sha1-nMMHnD3NcNTG4BuEqrKn40wwP1g=", - "requires": { - "fbjs": "0.8.16", - "loose-envify": "1.3.1", - "object-assign": "4.1.1", - "prop-types": "15.6.0" - } - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, - "ua-parser-js": { - "version": "0.7.14", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.14.tgz", - "integrity": "sha1-EQ1T+kw/MmwSEpK76skE0uAzh8o=" - }, - "whatwg-fetch": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", - "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=" - } - } -} diff --git a/Frontend/package.json b/Frontend/package.json deleted file mode 100644 index df925d1..0000000 --- a/Frontend/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "proxy": "https://ir.thirty2k.com", - "name": "my-app", - "version": "0.1.0", - "private": true, - "dependencies": { - "react": "^16.0.0", - "react-cookie": "^2.1.1", - "react-dom": "^16.0.0", - "react-google-login": "^2.11.2", - "react-router": "^4.2.0", - "react-router-dom": "^4.2.2", - "react-scripts": "1.0.13" - }, - "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test --env=jsdom", - "eject": "react-scripts eject" - }, - "devDependencies": { - "babel-jest": "^21.2.0", - "babel-preset-es2015": "^6.24.1", - "babel-preset-react": "^6.24.1", - "enzyme": "^3.1.0", - "jest": "^21.2.1", - "react-test-renderer": "^16.0.0" - } -} diff --git a/Frontend/public/favicon.ico b/Frontend/public/favicon.ico deleted file mode 100644 index a11777cc471a4344702741ab1c8a588998b1311a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3870 zcma);c{J4h9>;%nil|2-o+rCuEF-(I%-F}ijC~o(k~HKAkr0)!FCj~d>`RtpD?8b; zXOC1OD!V*IsqUwzbMF1)-gEDD=A573Z-&G7^LoAC9|WO7Xc0Cx1g^Zu0u_SjAPB3vGa^W|sj)80f#V0@M_CAZTIO(t--xg= z!sii`1giyH7EKL_+Wi0ab<)&E_0KD!3Rp2^HNB*K2@PHCs4PWSA32*-^7d{9nH2_E zmC{C*N*)(vEF1_aMamw2A{ZH5aIDqiabnFdJ|y0%aS|64E$`s2ccV~3lR!u<){eS` z#^Mx6o(iP1Ix%4dv`t@!&Za-K@mTm#vadc{0aWDV*_%EiGK7qMC_(`exc>-$Gb9~W!w_^{*pYRm~G zBN{nA;cm^w$VWg1O^^<6vY`1XCD|s_zv*g*5&V#wv&s#h$xlUilPe4U@I&UXZbL z0)%9Uj&@yd03n;!7do+bfixH^FeZ-Ema}s;DQX2gY+7g0s(9;`8GyvPY1*vxiF&|w z>!vA~GA<~JUqH}d;DfBSi^IT*#lrzXl$fNpq0_T1tA+`A$1?(gLb?e#0>UELvljtQ zK+*74m0jn&)5yk8mLBv;=@}c{t0ztT<v;Avck$S6D`Z)^c0(jiwKhQsn|LDRY&w(Fmi91I7H6S;b0XM{e zXp0~(T@k_r-!jkLwd1_Vre^v$G4|kh4}=Gi?$AaJ)3I+^m|Zyj#*?Kp@w(lQdJZf4 z#|IJW5z+S^e9@(6hW6N~{pj8|NO*>1)E=%?nNUAkmv~OY&ZV;m-%?pQ_11)hAr0oAwILrlsGawpxx4D43J&K=n+p3WLnlDsQ$b(9+4 z?mO^hmV^F8MV{4Lx>(Q=aHhQ1){0d*(e&s%G=i5rq3;t{JC zmgbn5Nkl)t@fPH$v;af26lyhH!k+#}_&aBK4baYPbZy$5aFx4}ka&qxl z$=Rh$W;U)>-=S-0=?7FH9dUAd2(q#4TCAHky!$^~;Dz^j|8_wuKc*YzfdAht@Q&ror?91Dm!N03=4=O!a)I*0q~p0g$Fm$pmr$ zb;wD;STDIi$@M%y1>p&_>%?UP($15gou_ue1u0!4(%81;qcIW8NyxFEvXpiJ|H4wz z*mFT(qVx1FKufG11hByuX%lPk4t#WZ{>8ka2efjY`~;AL6vWyQKpJun2nRiZYDij$ zP>4jQXPaP$UC$yIVgGa)jDV;F0l^n(V=HMRB5)20V7&r$jmk{UUIe zVjKroK}JAbD>B`2cwNQ&GDLx8{pg`7hbA~grk|W6LgiZ`8y`{Iq0i>t!3p2}MS6S+ zO_ruKyAElt)rdS>CtF7j{&6rP-#c=7evGMt7B6`7HG|-(WL`bDUAjyn+k$mx$CH;q2Dz4x;cPP$hW=`pFfLO)!jaCL@V2+F)So3}vg|%O*^T1j>C2lx zsURO-zIJC$^$g2byVbRIo^w>UxK}74^TqUiRR#7s_X$e)$6iYG1(PcW7un-va-S&u zHk9-6Zn&>T==A)lM^D~bk{&rFzCi35>UR!ZjQkdSiNX*-;l4z9j*7|q`TBl~Au`5& z+c)*8?#-tgUR$Zd%Q3bs96w6k7q@#tUn`5rj+r@_sAVVLqco|6O{ILX&U-&-cbVa3 zY?ngHR@%l{;`ri%H*0EhBWrGjv!LE4db?HEWb5mu*t@{kv|XwK8?npOshmzf=vZA@ zVSN9sL~!sn?r(AK)Q7Jk2(|M67Uy3I{eRy z_l&Y@A>;vjkWN5I2xvFFTLX0i+`{qz7C_@bo`ZUzDugfq4+>a3?1v%)O+YTd6@Ul7 zAfLfm=nhZ`)P~&v90$&UcF+yXm9sq!qCx3^9gzIcO|Y(js^Fj)Rvq>nQAHI92ap=P z10A4@prk+AGWCb`2)dQYFuR$|H6iDE8p}9a?#nV2}LBCoCf(Xi2@szia7#gY>b|l!-U`c}@ zLdhvQjc!BdLJvYvzzzngnw51yRYCqh4}$oRCy-z|v3Hc*d|?^Wj=l~18*E~*cR_kU z{XsxM1i{V*4GujHQ3DBpl2w4FgFR48Nma@HPgnyKoIEY-MqmMeY=I<%oG~l!f<+FN z1ZY^;10j4M4#HYXP zw5eJpA_y(>uLQ~OucgxDLuf}fVs272FaMxhn4xnDGIyLXnw>Xsd^J8XhcWIwIoQ9} z%FoSJTAGW(SRGwJwb=@pY7r$uQRK3Zd~XbxU)ts!4XsJrCycrWSI?e!IqwqIR8+Jh zlRjZ`UO1I!BtJR_2~7AbkbSm%XQqxEPkz6BTGWx8e}nQ=w7bZ|eVP4?*Tb!$(R)iC z9)&%bS*u(lXqzitAN)Oo=&Ytn>%Hzjc<5liuPi>zC_nw;Z0AE3Y$Jao_Q90R-gl~5 z_xAb2J%eArrC1CN4G$}-zVvCqF1;H;abAu6G*+PDHSYFx@Tdbfox*uEd3}BUyYY-l zTfEsOqsi#f9^FoLO;ChK<554qkri&Av~SIM*{fEYRE?vH7pTAOmu2pz3X?Wn*!ROX ztd54huAk&mFBemMooL33RV-*1f0Q3_(7hl$<#*|WF9P!;r;4_+X~k~uKEqdzZ$5Al zV63XN@)j$FN#cCD;ek1R#l zv%pGrhB~KWgoCj%GT?%{@@o(AJGt*PG#l3i>lhmb_twKH^EYvacVY-6bsCl5*^~L0 zonm@lk2UvvTKr2RS%}T>^~EYqdL1q4nD%0n&Xqr^cK^`J5W;lRRB^R-O8b&HENO||mo0xaD+S=I8RTlIfVgqN@SXDr2&-)we--K7w= zJVU8?Z+7k9dy;s;^gDkQa`0nz6N{T?(A&Iz)2!DEecLyRa&FI!id#5Z7B*O2=PsR0 zEvc|8{NS^)!d)MDX(97Xw}m&kEO@5jqRaDZ!+%`wYOI<23q|&js`&o4xvjP7D_xv@ z5hEwpsp{HezI9!~6O{~)lLR@oF7?J7i>1|5a~UuoN=q&6N}EJPV_GD`&M*v8Y`^2j zKII*d_@Fi$+i*YEW+Hbzn{iQk~yP z>7N{S4)r*!NwQ`(qcN#8SRQsNK6>{)X12nbF`*7#ecO7I)Q$uZsV+xS4E7aUn+U(K baj7?x%VD!5Cxk2YbYLNVeiXvvpMCWYo=by@ diff --git a/Frontend/public/index.html b/Frontend/public/index.html deleted file mode 100644 index e09f9e9..0000000 --- a/Frontend/public/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - simplif.ai - - - -
- - - - - diff --git a/Frontend/public/manifest.json b/Frontend/public/manifest.json deleted file mode 100644 index be607e4..0000000 --- a/Frontend/public/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "short_name": "React App", - "name": "Create React App Sample", - "icons": [ - { - "src": "favicon.ico", - "sizes": "192x192", - "type": "image/png" - } - ], - "start_url": "./index.html", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/Frontend/public/placeholder-favicon.png b/Frontend/public/placeholder-favicon.png deleted file mode 100644 index f7b96bf809a1c912dc013042c8f37907f07383a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1068 zcmV+{1k?M8P)Nb$}q3c(5#_PKnXM#LX<=LV{c7f*YdPK>*J) z_;VtDTTP9gzG(pdtnDr@h-ebYngDAA%n;Fdxr~WeI)8RipkV7Z0go!{OI!S_q3=}F zxo_#*X}AaG2a^xWGCBma24J%Uas`)NwdtBmyC$zz2c8@3YzfJ74uGl}&OQE6vPTfQ zqh`L6jeo3~0CQIBMj5dVFn3B4I>2;65GF!gawF#Wx3wmyXChbdvGmBs zjQeNh+#Bj@2T9MVrn6_cc*~ZcU?o3c5+B5j(cyX!o~5?|^e%h{uBS~u4&ZymaNeo~;oJH_2DPe2{%PM%o-OkH&bay29ur@P8l$g!mVSmyA|1_)U97eXhV|_Xyr!g_U9~=< z?lttR#IpdktERKR5~MJsZIYx=4$QrZIhyxu{S;8zryB0BOGSJ;`JwbeO<>Ow?B@2D{^#(^q_3cMzfj%9HsYmlN=;tv{(9KrjBL=Ba z(@9<5>nBU1{8BtUKDDfPR^N;WeW<4LZ8vJ}s9zJ6D7JK}MneytczOT9U=f)aGKLy`{z90Bl!YB)z1 zUd5uiPXhKb^SKZ(5H_93z|u`7Jf;}V3#$eY3~J3n3ZEk4DaCL)|8?c8#N$k~mzW|< zVisIJp_=aGssYRnYRzFed|oy3%8i2lk!{}^Q ( - - -
-
-
-
-); - -export default App; diff --git a/Frontend/src/App.test.js b/Frontend/src/App.test.js deleted file mode 100644 index b84af98..0000000 --- a/Frontend/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; - -it('renders without crashing', () => { - const div = document.createElement('div'); - ReactDOM.render(, div); -}); diff --git a/Frontend/src/README.md b/Frontend/src/README.md deleted file mode 100644 index c55ccdf..0000000 --- a/Frontend/src/README.md +++ /dev/null @@ -1,2164 +0,0 @@ -This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app). - -Below you will find some information on how to perform common tasks.
-You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md). - -## Table of Contents - -- [Updating to New Releases](#updating-to-new-releases) -- [Sending Feedback](#sending-feedback) -- [Folder Structure](#folder-structure) -- [Available Scripts](#available-scripts) - - [npm start](#npm-start) - - [npm test](#npm-test) - - [npm run build](#npm-run-build) - - [npm run eject](#npm-run-eject) -- [Supported Language Features and Polyfills](#supported-language-features-and-polyfills) -- [Syntax Highlighting in the Editor](#syntax-highlighting-in-the-editor) -- [Displaying Lint Output in the Editor](#displaying-lint-output-in-the-editor) -- [Debugging in the Editor](#debugging-in-the-editor) -- [Formatting Code Automatically](#formatting-code-automatically) -- [Changing the Page ``](#changing-the-page-title) -- [Installing a Dependency](#installing-a-dependency) -- [Importing a Component](#importing-a-component) -- [Code Splitting](#code-splitting) -- [Adding a Stylesheet](#adding-a-stylesheet) -- [Post-Processing CSS](#post-processing-css) -- [Adding a CSS Preprocessor (Sass, Less etc.)](#adding-a-css-preprocessor-sass-less-etc) -- [Adding Images, Fonts, and Files](#adding-images-fonts-and-files) -- [Using the `public` Folder](#using-the-public-folder) - - [Changing the HTML](#changing-the-html) - - [Adding Assets Outside of the Module System](#adding-assets-outside-of-the-module-system) - - [When to Use the `public` Folder](#when-to-use-the-public-folder) -- [Using Global Variables](#using-global-variables) -- [Adding Bootstrap](#adding-bootstrap) - - [Using a Custom Theme](#using-a-custom-theme) -- [Adding Flow](#adding-flow) -- [Adding Custom Environment Variables](#adding-custom-environment-variables) - - [Referencing Environment Variables in the HTML](#referencing-environment-variables-in-the-html) - - [Adding Temporary Environment Variables In Your Shell](#adding-temporary-environment-variables-in-your-shell) - - [Adding Development Environment Variables In `.env`](#adding-development-environment-variables-in-env) -- [Can I Use Decorators?](#can-i-use-decorators) -- [Integrating with an API Backend](#integrating-with-an-api-backend) - - [Node](#node) - - [Ruby on Rails](#ruby-on-rails) -- [Proxying API Requests in Development](#proxying-api-requests-in-development) - - ["Invalid Host Header" Errors After Configuring Proxy](#invalid-host-header-errors-after-configuring-proxy) - - [Configuring the Proxy Manually](#configuring-the-proxy-manually) - - [Configuring a WebSocket Proxy](#configuring-a-websocket-proxy) -- [Using HTTPS in Development](#using-https-in-development) -- [Generating Dynamic `<meta>` Tags on the Server](#generating-dynamic-meta-tags-on-the-server) -- [Pre-Rendering into Static HTML Files](#pre-rendering-into-static-html-files) -- [Injecting Data from the Server into the Page](#injecting-data-from-the-server-into-the-page) -- [Running Tests](#running-tests) - - [Filename Conventions](#filename-conventions) - - [Command Line Interface](#command-line-interface) - - [Version Control Integration](#version-control-integration) - - [Writing Tests](#writing-tests) - - [Testing Components](#testing-components) - - [Using Third Party Assertion Libraries](#using-third-party-assertion-libraries) - - [Initializing Test Environment](#initializing-test-environment) - - [Focusing and Excluding Tests](#focusing-and-excluding-tests) - - [Coverage Reporting](#coverage-reporting) - - [Continuous Integration](#continuous-integration) - - [Disabling jsdom](#disabling-jsdom) - - [Snapshot Testing](#snapshot-testing) - - [Editor Integration](#editor-integration) -- [Developing Components in Isolation](#developing-components-in-isolation) - - [Getting Started with Storybook](#getting-started-with-storybook) - - [Getting Started with Styleguidist](#getting-started-with-styleguidist) -- [Making a Progressive Web App](#making-a-progressive-web-app) - - [Opting Out of Caching](#opting-out-of-caching) - - [Offline-First Considerations](#offline-first-considerations) - - [Progressive Web App Metadata](#progressive-web-app-metadata) -- [Analyzing the Bundle Size](#analyzing-the-bundle-size) -- [Deployment](#deployment) - - [Static Server](#static-server) - - [Other Solutions](#other-solutions) - - [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing) - - [Building for Relative Paths](#building-for-relative-paths) - - [Azure](#azure) - - [Firebase](#firebase) - - [GitHub Pages](#github-pages) - - [Heroku](#heroku) - - [Netlify](#netlify) - - [Now](#now) - - [S3 and CloudFront](#s3-and-cloudfront) - - [Surge](#surge) -- [Advanced Configuration](#advanced-configuration) -- [Troubleshooting](#troubleshooting) - - [`npm start` doesn’t detect changes](#npm-start-doesnt-detect-changes) - - [`npm test` hangs on macOS Sierra](#npm-test-hangs-on-macos-sierra) - - [`npm run build` exits too early](#npm-run-build-exits-too-early) - - [`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku) - - [`npm run build` fails to minify](#npm-run-build-fails-to-minify) - - [Moment.js locales are missing](#momentjs-locales-are-missing) -- [Something Missing?](#something-missing) - -## Updating to New Releases - -Create React App is divided into two packages: - -* `create-react-app` is a global command-line utility that you use to create new projects. -* `react-scripts` is a development dependency in the generated projects (including this one). - -You almost never need to update `create-react-app` itself: it delegates all the setup to `react-scripts`. - -When you run `create-react-app`, it always creates the project with the latest version of `react-scripts` so you’ll get all the new features and improvements in newly created apps automatically. - -To update an existing project to a new version of `react-scripts`, [open the changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md), find the version you’re currently on (check `package.json` in this folder if you’re not sure), and apply the migration instructions for the newer versions. - -In most cases bumping the `react-scripts` version in `package.json` and running `npm install` in this folder should be enough, but it’s good to consult the [changelog](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md) for potential breaking changes. - -We commit to keeping the breaking changes minimal so you can upgrade `react-scripts` painlessly. - -## Sending Feedback - -We are always open to [your feedback](https://github.com/facebookincubator/create-react-app/issues). - -## Folder Structure - -After creation, your project should look like this: - -``` -my-app/ - README.md - node_modules/ - package.json - public/ - index.html - favicon.ico - src/ - App.css - App.js - App.test.js - index.css - index.js - logo.svg -``` - -For the project to build, **these files must exist with exact filenames**: - -* `public/index.html` is the page template; -* `src/index.js` is the JavaScript entry point. - -You can delete or rename the other files. - -You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.<br> -You need to **put any JS and CSS files inside `src`**, otherwise Webpack won’t see them. - -Only files inside `public` can be used from `public/index.html`.<br> -Read instructions below for using assets from JavaScript and HTML. - -You can, however, create more top-level directories.<br> -They will not be included in the production build so you can use them for things like documentation. - -## Available Scripts - -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.<br> -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.<br> -You will also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.<br> -See the section about [running tests](#running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.<br> -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.<br> -Your app is ready to be deployed! - -See the section about [deployment](#deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Supported Language Features and Polyfills - -This project supports a superset of the latest JavaScript standard.<br> -In addition to [ES6](https://github.com/lukehoban/es6features) syntax features, it also supports: - -* [Exponentiation Operator](https://github.com/rwaldron/exponentiation-operator) (ES2016). -* [Async/await](https://github.com/tc39/ecmascript-asyncawait) (ES2017). -* [Object Rest/Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread) (stage 3 proposal). -* [Dynamic import()](https://github.com/tc39/proposal-dynamic-import) (stage 3 proposal) -* [Class Fields and Static Properties](https://github.com/tc39/proposal-class-public-fields) (stage 2 proposal). -* [JSX](https://facebook.github.io/react/docs/introducing-jsx.html) and [Flow](https://flowtype.org/) syntax. - -Learn more about [different proposal stages](https://babeljs.io/docs/plugins/#presets-stage-x-experimental-presets-). - -While we recommend to use experimental proposals with some caution, Facebook heavily uses these features in the product code, so we intend to provide [codemods](https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb) if any of these proposals change in the future. - -Note that **the project only includes a few ES6 [polyfills](https://en.wikipedia.org/wiki/Polyfill)**: - -* [`Object.assign()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) via [`object-assign`](https://github.com/sindresorhus/object-assign). -* [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) via [`promise`](https://github.com/then/promise). -* [`fetch()`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) via [`whatwg-fetch`](https://github.com/github/fetch). - -If you use any other ES6+ features that need **runtime support** (such as `Array.from()` or `Symbol`), make sure you are including the appropriate polyfills manually, or that the browsers you are targeting already support them. - -## Syntax Highlighting in the Editor - -To configure the syntax highlighting in your favorite text editor, head to the [relevant Babel documentation page](https://babeljs.io/docs/editors) and follow the instructions. Some of the most popular editors are covered. - -## Displaying Lint Output in the Editor - ->Note: this feature is available with `react-scripts@0.2.0` and higher.<br> ->It also only works with npm 3 or higher. - -Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint. - -They are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do. - -You would need to install an ESLint plugin for your editor first. Then, add a file called `.eslintrc` to the project root: - -```js -{ - "extends": "react-app" -} -``` - -Now your editor should report the linting warnings. - -Note that even if you edit your `.eslintrc` file further, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes. - -If you want to enforce a coding style for your project, consider using [Prettier](https://github.com/jlongster/prettier) instead of ESLint style rules. - -## Debugging in the Editor - -**This feature is currently only supported by [Visual Studio Code](https://code.visualstudio.com) and [WebStorm](https://www.jetbrains.com/webstorm/).** - -Visual Studio Code and WebStorm support debugging out of the box with Create React App. This enables you as a developer to write and debug your React code without leaving the editor, and most importantly it enables you to have a continuous development workflow, where context switching is minimal, as you don’t have to switch between tools. - -### Visual Studio Code - -You would need to have the latest version of [VS Code](https://code.visualstudio.com) and VS Code [Chrome Debugger Extension](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) installed. - -Then add the block below to your `launch.json` file and put it inside the `.vscode` folder in your app’s root directory. - -```json -{ - "version": "0.2.0", - "configurations": [{ - "name": "Chrome", - "type": "chrome", - "request": "launch", - "url": "http://localhost:3000", - "webRoot": "${workspaceRoot}/src", - "userDataDir": "${workspaceRoot}/.vscode/chrome", - "sourceMapPathOverrides": { - "webpack:///src/*": "${webRoot}/*" - } - }] -} -``` ->Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration). - -Start your app by running `npm start`, and start debugging in VS Code by pressing `F5` or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor. - -### WebStorm - -You would need to have [WebStorm](https://www.jetbrains.com/webstorm/) and [JetBrains IDE Support](https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji) Chrome extension installed. - -In the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and select `JavaScript Debug`. Paste `http://localhost:3000` into the URL field and save the configuration. - ->Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](#advanced-configuration). - -Start your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm. - -The same way you can debug your application in IntelliJ IDEA Ultimate, PhpStorm, PyCharm Pro, and RubyMine. - -## Formatting Code Automatically - -Prettier is an opinionated code formatter with support for JavaScript, CSS and JSON. With Prettier you can format the code you write automatically to ensure a code style within your project. See the [Prettier's GitHub page](https://github.com/prettier/prettier) for more information, and look at this [page to see it in action](https://prettier.github.io/prettier/). - -To format our code whenever we make a commit in git, we need to install the following dependencies: - -```sh -npm install --save husky lint-staged prettier -``` - -Alternatively you may use `yarn`: - -```sh -yarn add husky lint-staged prettier -``` - -* `husky` makes it easy to use githooks as if they are npm scripts. -* `lint-staged` allows us to run scripts on staged files in git. See this [blog post about lint-staged to learn more about it](https://medium.com/@okonetchnikov/make-linting-great-again-f3890e1ad6b8). -* `prettier` is the JavaScript formatter we will run before commits. - -Now we can make sure every file is formatted correctly by adding a few lines to the `package.json` in the project root. - -Add the following line to `scripts` section: - -```diff - "scripts": { -+ "precommit": "lint-staged", - "start": "react-scripts start", - "build": "react-scripts build", -``` - -Next we add a 'lint-staged' field to the `package.json`, for example: - -```diff - "dependencies": { - // ... - }, -+ "lint-staged": { -+ "src/**/*.{js,jsx,json,css}": [ -+ "prettier --single-quote --write", -+ "git add" -+ ] -+ }, - "scripts": { -``` - -Now, whenever you make a commit, Prettier will format the changed files automatically. You can also run `./node_modules/.bin/prettier --single-quote --write "src/**/*.{js,jsx}"` to format your entire project for the first time. - -Next you might want to integrate Prettier in your favorite editor. Read the section on [Editor Integration](https://github.com/prettier/prettier#editor-integration) on the Prettier GitHub page. - -## Changing the Page `<title>` - -You can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “React App” to anything else. - -Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](#adding-a-stylesheet) is done without touching the HTML. - -If you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library. - -If you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](#generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](#pre-rendering-into-static-html-files). - -## Installing a Dependency - -The generated project includes React and ReactDOM as dependencies. It also includes a set of scripts used by Create React App as a development dependency. You may install other dependencies (for example, React Router) with `npm`: - -```sh -npm install --save react-router -``` - -Alternatively you may use `yarn`: - -```sh -yarn add react-router -``` - -This works for any library, not just `react-router`. - -## Importing a Component - -This project setup supports ES6 modules thanks to Babel.<br> -While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead. - -For example: - -### `Button.js` - -```js -import React, { Component } from 'react'; - -class Button extends Component { - render() { - // ... - } -} - -export default Button; // Don’t forget to use export default! -``` - -### `DangerButton.js` - - -```js -import React, { Component } from 'react'; -import Button from './Button'; // Import a component from another file - -class DangerButton extends Component { - render() { - return <Button color="red" />; - } -} - -export default DangerButton; -``` - -Be aware of the [difference between default and named exports](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281). It is a common source of mistakes. - -We suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use `export default Button` and `import Button from './Button'`. - -Named exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like. - -Learn more about ES6 modules: - -* [When to use the curly braces?](http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281) -* [Exploring ES6: Modules](http://exploringjs.com/es6/ch_modules.html) -* [Understanding ES6: Modules](https://leanpub.com/understandinges6/read#leanpub-auto-encapsulating-code-with-modules) - -## Code Splitting - -Instead of downloading the entire app before users can use it, code splitting allows you to split your code into small chunks which you can then load on demand. - -This project setup supports code splitting via [dynamic `import()`](http://2ality.com/2017/01/import-operator.html#loading-code-on-demand). Its [proposal](https://github.com/tc39/proposal-dynamic-import) is in stage 3. The `import()` function-like form takes the module name as an argument and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which always resolves to the namespace object of the module. - -Here is an example: - -### `moduleA.js` - -```js -const moduleA = 'Hello'; - -export { moduleA }; -``` -### `App.js` - -```js -import React, { Component } from 'react'; - -class App extends Component { - handleClick = () => { - import('./moduleA') - .then(({ moduleA }) => { - // Use moduleA - }) - .catch(err => { - // Handle failure - }); - }; - - render() { - return ( - <div> - <button onClick={this.handleClick}>Load</button> - </div> - ); - } -} - -export default App; -``` - -This will make `moduleA.js` and all its unique dependencies as a separate chunk that only loads after the user clicks the 'Load' button. - -You can also use it with `async` / `await` syntax if you prefer it. - -### With React Router - -If you are using React Router check out [this tutorial](http://serverless-stack.com/chapters/code-splitting-in-create-react-app.html) on how to use code splitting with it. You can find the companion GitHub repository [here](https://github.com/AnomalyInnovations/serverless-stack-demo-client/tree/code-splitting-in-create-react-app). - -## Adding a Stylesheet - -This project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**: - -### `Button.css` - -```css -.Button { - padding: 20px; -} -``` - -### `Button.js` - -```js -import React, { Component } from 'react'; -import './Button.css'; // Tell Webpack that Button.js uses these styles - -class Button extends Component { - render() { - // You can use them as regular CSS styles - return <div className="Button" />; - } -} -``` - -**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack. - -In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output. - -If you are concerned about using Webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool. - -## Post-Processing CSS - -This project setup minifies your CSS and adds vendor prefixes to it automatically through [Autoprefixer](https://github.com/postcss/autoprefixer) so you don’t need to worry about it. - -For example, this: - -```css -.App { - display: flex; - flex-direction: row; - align-items: center; -} -``` - -becomes this: - -```css -.App { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} -``` - -If you need to disable autoprefixing for some reason, [follow this section](https://github.com/postcss/autoprefixer#disabling). - -## Adding a CSS Preprocessor (Sass, Less etc.) - -Generally, we recommend that you don’t reuse the same CSS classes across different components. For example, instead of using a `.Button` CSS class in `<AcceptButton>` and `<RejectButton>` components, we recommend creating a `<Button>` component with its own `.Button` styles, that both `<AcceptButton>` and `<RejectButton>` can render (but [not inherit](https://facebook.github.io/react/docs/composition-vs-inheritance.html)). - -Following this rule often makes CSS preprocessors less useful, as features like mixins and nesting are replaced by component composition. You can, however, integrate a CSS preprocessor if you find it valuable. In this walkthrough, we will be using Sass, but you can also use Less, or another alternative. - -First, let’s install the command-line interface for Sass: - -```sh -npm install --save node-sass-chokidar -``` - -Alternatively you may use `yarn`: - -```sh -yarn add node-sass-chokidar -``` - -Then in `package.json`, add the following lines to `scripts`: - -```diff - "scripts": { -+ "build-css": "node-sass-chokidar src/ -o src/", -+ "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive", - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test --env=jsdom", -``` - ->Note: To use a different preprocessor, replace `build-css` and `watch-css` commands according to your preprocessor’s documentation. - -Now you can rename `src/App.css` to `src/App.scss` and run `npm run watch-css`. The watcher will find every Sass file in `src` subdirectories, and create a corresponding CSS file next to it, in our case overwriting `src/App.css`. Since `src/App.js` still imports `src/App.css`, the styles become a part of your application. You can now edit `src/App.scss`, and `src/App.css` will be regenerated. - -To share variables between Sass files, you can use Sass imports. For example, `src/App.scss` and other component style files could include `@import "./shared.scss";` with variable definitions. - -To enable importing files without using relative paths, you can add the `--include-path` option to the command in `package.json`. - -``` -"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/", -"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive", -``` - -This will allow you to do imports like - -```scss -@import 'styles/_colors.scss'; // assuming a styles directory under src/ -@import 'nprogress/nprogress'; // importing a css file from the nprogress node module -``` - -At this point you might want to remove all CSS files from the source control, and add `src/**/*.css` to your `.gitignore` file. It is generally a good practice to keep the build products outside of the source control. - -As a final step, you may find it convenient to run `watch-css` automatically with `npm start`, and run `build-css` as a part of `npm run build`. You can use the `&&` operator to execute two scripts sequentially. However, there is no cross-platform way to run two scripts in parallel, so we will install a package for this: - -```sh -npm install --save npm-run-all -``` - -Alternatively you may use `yarn`: - -```sh -yarn add npm-run-all -``` - -Then we can change `start` and `build` scripts to include the CSS preprocessor commands: - -```diff - "scripts": { - "build-css": "node-sass-chokidar src/ -o src/", - "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive", -- "start": "react-scripts start", -- "build": "react-scripts build", -+ "start-js": "react-scripts start", -+ "start": "npm-run-all -p watch-css start-js", -+ "build": "npm run build-css && react-scripts build", - "test": "react-scripts test --env=jsdom", - "eject": "react-scripts eject" - } -``` - -Now running `npm start` and `npm run build` also builds Sass files. - -**Why `node-sass-chokidar`?** - -`node-sass` has been reported as having the following issues: - -- `node-sass --watch` has been reported to have *performance issues* in certain conditions when used in a virtual machine or with docker. - -- Infinite styles compiling [#1939](https://github.com/facebookincubator/create-react-app/issues/1939) - -- `node-sass` has been reported as having issues with detecting new files in a directory [#1891](https://github.com/sass/node-sass/issues/1891) - - `node-sass-chokidar` is used here as it addresses these issues. - -## Adding Images, Fonts, and Files - -With Webpack, using static assets like images and fonts works similarly to CSS. - -You can **`import` a file right in a JavaScript module**. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF. - -To reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebookincubator/create-react-app/issues/1153). - -Here is an example: - -```js -import React from 'react'; -import logo from './logo.png'; // Tell Webpack this JS file uses this image - -console.log(logo); // /logo.84287d09.png - -function Header() { - // Import result is the URL of your image - return <img src={logo} alt="Logo" />; -} - -export default Header; -``` - -This ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths. - -This works in CSS too: - -```css -.Logo { - background-image: url(./logo.png); -} -``` - -Webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets. - -Please be advised that this is also a custom feature of Webpack. - -**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).<br> -An alternative way of handling static assets is described in the next section. - -## Using the `public` Folder - ->Note: this feature is available with `react-scripts@0.5.0` and higher. - -### Changing the HTML - -The `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](#changing-the-page-title). -The `<script>` tag with the compiled code will be added to it automatically during the build process. - -### Adding Assets Outside of the Module System - -You can also add other assets to the `public` folder. - -Note that we normally encourage you to `import` assets in JavaScript files instead. -For example, see the sections on [adding a stylesheet](#adding-a-stylesheet) and [adding images and fonts](#adding-images-fonts-and-files). -This mechanism provides a number of benefits: - -* Scripts and stylesheets get minified and bundled together to avoid extra network requests. -* Missing files cause compilation errors instead of 404 errors for your users. -* Result filenames include content hashes so you don’t need to worry about browsers caching their old versions. - -However there is an **escape hatch** that you can use to add an asset outside of the module system. - -If you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use a special variable called `PUBLIC_URL`. - -Inside `index.html`, you can use it like this: - -```html -<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> -``` - -Only files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build. - -When you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL. - -In JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes: - -```js -render() { - // Note: this is an escape hatch and should be used sparingly! - // Normally we recommend using `import` for getting asset URLs - // as described in “Adding Images and Fonts” above this section. - return <img src={process.env.PUBLIC_URL + '/img/logo.png'} />; -} -``` - -Keep in mind the downsides of this approach: - -* None of the files in `public` folder get post-processed or minified. -* Missing files will not be called at compilation time, and will cause 404 errors for your users. -* Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change. - -### When to Use the `public` Folder - -Normally we recommend importing [stylesheets](#adding-a-stylesheet), [images, and fonts](#adding-images-fonts-and-files) from JavaScript. -The `public` folder is useful as a workaround for a number of less common cases: - -* You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest). -* You have thousands of images and need to dynamically reference their paths. -* You want to include a small script like [`pace.js`](http://github.hubspot.com/pace/docs/welcome/) outside of the bundled code. -* Some library may be incompatible with Webpack and you have no other option but to include it as a `<script>` tag. - -Note that if you add a `<script>` that declares global variables, you also need to read the next section on using them. - -## Using Global Variables - -When you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable. - -You can avoid this by reading the global variable explicitly from the `window` object, for example: - -```js -const $ = window.$; -``` - -This makes it obvious you are using a global variable intentionally rather than because of a typo. - -Alternatively, you can force the linter to ignore any line by adding `// eslint-disable-line` after it. - -## Adding Bootstrap - -You don’t have to use [React Bootstrap](https://react-bootstrap.github.io) together with React but it is a popular library for integrating Bootstrap with React apps. If you need it, you can integrate it with Create React App by following these steps: - -Install React Bootstrap and Bootstrap from npm. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well: - -```sh -npm install --save react-bootstrap bootstrap@3 -``` - -Alternatively you may use `yarn`: - -```sh -yarn add react-bootstrap bootstrap@3 -``` - -Import Bootstrap CSS and optionally Bootstrap theme CSS in the beginning of your ```src/index.js``` file: - -```js -import 'bootstrap/dist/css/bootstrap.css'; -import 'bootstrap/dist/css/bootstrap-theme.css'; -// Put any other imports below so that CSS from your -// components takes precedence over default styles. -``` - -Import required React Bootstrap components within ```src/App.js``` file or your custom component files: - -```js -import { Navbar, Jumbotron, Button } from 'react-bootstrap'; -``` - -Now you are ready to use the imported React Bootstrap components within your component hierarchy defined in the render method. Here is an example [`App.js`](https://gist.githubusercontent.com/gaearon/85d8c067f6af1e56277c82d19fd4da7b/raw/6158dd991b67284e9fc8d70b9d973efe87659d72/App.js) redone using React Bootstrap. - -### Using a Custom Theme - -Sometimes you might need to tweak the visual styles of Bootstrap (or equivalent package).<br> -We suggest the following approach: - -* Create a new package that depends on the package you wish to customize, e.g. Bootstrap. -* Add the necessary build steps to tweak the theme, and publish your package on npm. -* Install your own theme npm package as a dependency of your app. - -Here is an example of adding a [customized Bootstrap](https://medium.com/@tacomanator/customizing-create-react-app-aa9ffb88165) that follows these steps. - -## Adding Flow - -Flow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept. - -Recent versions of [Flow](http://flowtype.org/) work with Create React App projects out of the box. - -To add Flow to a Create React App project, follow these steps: - -1. Run `npm install --save flow-bin` (or `yarn add flow-bin`). -2. Add `"flow": "flow"` to the `scripts` section of your `package.json`. -3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flowtype.org/docs/advanced-configuration.html) in the root directory. -4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`). - -Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors. -You can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience. -In the future we plan to integrate it into Create React App even more closely. - -To learn more about Flow, check out [its documentation](https://flowtype.org/). - -## Adding Custom Environment Variables - ->Note: this feature is available with `react-scripts@0.2.3` and higher. - -Your project can consume variables declared in your environment as if they were declared locally in your JS files. By -default you will have `NODE_ENV` defined for you, and any other environment variables starting with -`REACT_APP_`. - -**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them. - ->Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebookincubator/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running. - -These environment variables will be defined for you on `process.env`. For example, having an environment -variable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`. - -There is also a special built-in environment variable called `NODE_ENV`. You can read it from `process.env.NODE_ENV`. When you run `npm start`, it is always equal to `'development'`, when you run `npm test` it is always equal to `'test'`, and when you run `npm run build` to make a production bundle, it is always equal to `'production'`. **You cannot override `NODE_ENV` manually.** This prevents developers from accidentally deploying a slow development build to production. - -These environment variables can be useful for displaying information conditionally based on where the project is -deployed or consuming sensitive data that lives outside of version control. - -First, you need to have environment variables defined. For example, let’s say you wanted to consume a secret defined -in the environment inside a `<form>`: - -```jsx -render() { - return ( - <div> - <small>You are running this application in <b>{process.env.NODE_ENV}</b> mode.</small> - <form> - <input type="hidden" defaultValue={process.env.REACT_APP_SECRET_CODE} /> - </form> - </div> - ); -} -``` - -During the build, `process.env.REACT_APP_SECRET_CODE` will be replaced with the current value of the `REACT_APP_SECRET_CODE` environment variable. Remember that the `NODE_ENV` variable will be set for you automatically. - -When you load the app in the browser and inspect the `<input>`, you will see its value set to `abcdef`, and the bold text will show the environment provided when using `npm start`: - -```html -<div> - <small>You are running this application in <b>development</b> mode.</small> - <form> - <input type="hidden" value="abcdef" /> - </form> -</div> -``` - -The above form is looking for a variable called `REACT_APP_SECRET_CODE` from the environment. In order to consume this -value, we need to have it defined in the environment. This can be done using two ways: either in your shell or in -a `.env` file. Both of these ways are described in the next few sections. - -Having access to the `NODE_ENV` is also useful for performing actions conditionally: - -```js -if (process.env.NODE_ENV !== 'production') { - analytics.disable(); -} -``` - -When you compile the app with `npm run build`, the minification step will strip out this condition, and the resulting bundle will be smaller. - -### Referencing Environment Variables in the HTML - ->Note: this feature is available with `react-scripts@0.9.0` and higher. - -You can also access the environment variables starting with `REACT_APP_` in the `public/index.html`. For example: - -```html -<title>%REACT_APP_WEBSITE_NAME% -``` - -Note that the caveats from the above section apply: - -* Apart from a few built-in variables (`NODE_ENV` and `PUBLIC_URL`), variable names must start with `REACT_APP_` to work. -* The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](#generating-dynamic-meta-tags-on-the-server). - -### Adding Temporary Environment Variables In Your Shell - -Defining environment variables can vary between OSes. It’s also important to know that this manner is temporary for the -life of the shell session. - -#### Windows (cmd.exe) - -```cmd -set REACT_APP_SECRET_CODE=abcdef&&npm start -``` - -(Note: the lack of whitespace is intentional.) - -#### Linux, macOS (Bash) - -```bash -REACT_APP_SECRET_CODE=abcdef npm start -``` - -### Adding Development Environment Variables In `.env` - ->Note: this feature is available with `react-scripts@0.5.0` and higher. - -To define permanent environment variables, create a file called `.env` in the root of your project: - -``` -REACT_APP_SECRET_CODE=abcdef -``` - -`.env` files **should be** checked into source control (with the exclusion of `.env*.local`). - -#### What other `.env` files are can be used? - ->Note: this feature is **available with `react-scripts@1.0.0` and higher**. - -* `.env`: Default. -* `.env.local`: Local overrides. **This file is loaded for all environments except test.** -* `.env.development`, `.env.test`, `.env.production`: Environment-specific settings. -* `.env.development.local`, `.env.test.local`, `.env.production.local`: Local overrides of environment-specific settings. - -Files on the left have more priority than files on the right: - -* `npm start`: `.env.development.local`, `.env.development`, `.env.local`, `.env` -* `npm run build`: `.env.production.local`, `.env.production`, `.env.local`, `.env` -* `npm test`: `.env.test.local`, `.env.test`, `.env` (note `.env.local` is missing) - -These variables will act as the defaults if the machine does not explicitly set them.
-Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details. - ->Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need -these defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars). - -## Can I Use Decorators? - -Many popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
-Create React App doesn’t support decorator syntax at the moment because: - -* It is an experimental proposal and is subject to change. -* The current specification version is not officially supported by Babel. -* If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook. - -However in many cases you can rewrite decorator-based code without decorators just as fine.
-Please refer to these two threads for reference: - -* [#214](https://github.com/facebookincubator/create-react-app/issues/214) -* [#411](https://github.com/facebookincubator/create-react-app/issues/411) - -Create React App will add decorator support when the specification advances to a stable stage. - -## Integrating with an API Backend - -These tutorials will help you to integrate your app with an API backend running on another port, -using `fetch()` to access it. - -### Node -Check out [this tutorial](https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/). -You can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo). - -### Ruby on Rails - -Check out [this tutorial](https://www.fullstackreact.com/articles/how-to-get-create-react-app-to-work-with-your-rails-api/). -You can find the companion GitHub repository [here](https://github.com/fullstackreact/food-lookup-demo-rails). - -## Proxying API Requests in Development - ->Note: this feature is available with `react-scripts@0.2.3` and higher. - -People often serve the front-end React app from the same host and port as their backend implementation.
-For example, a production setup might look like this after the app is deployed: - -``` -/ - static server returns index.html with React app -/todos - static server returns index.html with React app -/api/todos - server handles any /api/* requests using the backend implementation -``` - -Such setup is **not** required. However, if you **do** have a setup like this, it is convenient to write requests like `fetch('/api/todos')` without worrying about redirecting them to another host or port during development. - -To tell the development server to proxy any unknown requests to your API server in development, add a `proxy` field to your `package.json`, for example: - -```js - "proxy": "http://localhost:4000", -``` - -This way, when you `fetch('/api/todos')` in development, the development server will recognize that it’s not a static asset, and will proxy your request to `http://localhost:4000/api/todos` as a fallback. The development server will only attempt to send requests without a `text/html` accept header to the proxy. - -Conveniently, this avoids [CORS issues](http://stackoverflow.com/questions/21854516/understanding-ajax-cors-and-security-considerations) and error messages like this in development: - -``` -Fetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. -``` - -Keep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`. - -The `proxy` option supports HTTP, HTTPS and WebSocket connections.
-If the `proxy` option is **not** flexible enough for you, alternatively you can: - -* [Configure the proxy yourself](#configuring-the-proxy-manually) -* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)). -* Use [environment variables](#adding-custom-environment-variables) to inject the right server host and port into your app. - -### "Invalid Host Header" Errors After Configuring Proxy - -When you enable the `proxy` option, you opt into a more strict set of host checks. This is necessary because leaving the backend open to remote hosts makes your computer vulnerable to DNS rebinding attacks. The issue is explained in [this article](https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a) and [this issue](https://github.com/webpack/webpack-dev-server/issues/887). - -This shouldn’t affect you when developing on `localhost`, but if you develop remotely like [described here](https://github.com/facebookincubator/create-react-app/issues/2271), you will see this error in the browser after enabling the `proxy` option: - ->Invalid Host header - -To work around it, you can specify your public development host in a file called `.env.development` in the root of your project: - -``` -HOST=mypublicdevhost.com -``` - -If you restart the development server now and load the app from the specified host, it should work. - -If you are still having issues or if you’re using a more exotic environment like a cloud editor, you can bypass the host check completely by adding a line to `.env.development.local`. **Note that this is dangerous and exposes your machine to remote code execution from malicious websites:** - -``` -# NOTE: THIS IS DANGEROUS! -# It exposes your machine to attacks from the websites you visit. -DANGEROUSLY_DISABLE_HOST_CHECK=true -``` - -We don’t recommend this approach. - -### Configuring the Proxy Manually - ->Note: this feature is available with `react-scripts@1.0.0` and higher. - -If the `proxy` option is **not** flexible enough for you, you can specify an object in the following form (in `package.json`).
-You may also specify any configuration value [`http-proxy-middleware`](https://github.com/chimurai/http-proxy-middleware#options) or [`http-proxy`](https://github.com/nodejitsu/node-http-proxy#options) supports. -```js -{ - // ... - "proxy": { - "/api": { - "target": "", - "ws": true - // ... - } - } - // ... -} -``` - -All requests matching this path will be proxies, no exceptions. This includes requests for `text/html`, which the standard `proxy` option does not proxy. - -If you need to specify multiple proxies, you may do so by specifying additional entries. -You may also narrow down matches using `*` and/or `**`, to match the path exactly or any subpath. -```js -{ - // ... - "proxy": { - // Matches any request starting with /api - "/api": { - "target": "", - "ws": true - // ... - }, - // Matches any request starting with /foo - "/foo": { - "target": "", - "ssl": true, - "pathRewrite": { - "^/foo": "/foo/beta" - } - // ... - }, - // Matches /bar/abc.html but not /bar/sub/def.html - "/bar/*.html": { - "target": "", - // ... - }, - // Matches /baz/abc.html and /baz/sub/def.html - "/baz/**/*.html": { - "target": "" - // ... - } - } - // ... -} -``` - -### Configuring a WebSocket Proxy - -When setting up a WebSocket proxy, there are a some extra considerations to be aware of. - -If you’re using a WebSocket engine like [Socket.io](https://socket.io/), you must have a Socket.io server running that you can use as the proxy target. Socket.io will not work with a standard WebSocket server. Specifically, don't expect Socket.io to work with [the websocket.org echo test](http://websocket.org/echo.html). - -There’s some good documentation available for [setting up a Socket.io server](https://socket.io/docs/). - -Standard WebSockets **will** work with a standard WebSocket server as well as the websocket.org echo test. You can use libraries like [ws](https://github.com/websockets/ws) for the server, with [native WebSockets in the browser](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket). - -Either way, you can proxy WebSocket requests manually in `package.json`: - -```js -{ - // ... - "proxy": { - "/socket": { - // Your compatible WebSocket server - "target": "ws://", - // Tell http-proxy-middleware that this is a WebSocket proxy. - // Also allows you to proxy WebSocket requests without an additional HTTP request - // https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade - "ws": true - // ... - } - } - // ... -} -``` - -## Using HTTPS in Development - ->Note: this feature is available with `react-scripts@0.4.0` and higher. - -You may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the "proxy" feature](#proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS. - -To do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`: - -#### Windows (cmd.exe) - -```cmd -set HTTPS=true&&npm start -``` - -(Note: the lack of whitespace is intentional.) - -#### Linux, macOS (Bash) - -```bash -HTTPS=true npm start -``` - -Note that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page. - -## Generating Dynamic `` Tags on the Server - -Since Create React App doesn’t support server rendering, you might be wondering how to make `` tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this: - -```html - - - - - -``` - -Then, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML! - -If you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases. - -## Pre-Rendering into Static HTML Files - -If you’re hosting your `build` with a static hosting provider you can use [react-snapshot](https://www.npmjs.com/package/react-snapshot) to generate HTML pages for each route, or relative link, in your application. These pages will then seamlessly become active, or “hydrated”, when the JavaScript bundle has loaded. - -There are also opportunities to use this outside of static hosting, to take the pressure off the server when generating and caching routes. - -The primary benefit of pre-rendering is that you get the core content of each page _with_ the HTML payload—regardless of whether or not your JavaScript bundle successfully downloads. It also increases the likelihood that each route of your application will be picked up by search engines. - -You can read more about [zero-configuration pre-rendering (also called snapshotting) here](https://medium.com/superhighfives/an-almost-static-stack-6df0a2791319). - -## Injecting Data from the Server into the Page - -Similarly to the previous section, you can leave some placeholders in the HTML that inject global variables, for example: - -```js - - - - -``` - -Then, on the server, you can replace `__SERVER_DATA__` with a JSON of real data right before sending the response. The client code can then read `window.SERVER_DATA` to use it. **Make sure to [sanitize the JSON before sending it to the client](https://medium.com/node-security/the-most-common-xss-vulnerability-in-react-js-applications-2bdffbcc1fa0) as it makes your app vulnerable to XSS attacks.** - -## Running Tests - ->Note: this feature is available with `react-scripts@0.3.0` and higher.
->[Read the migration guide to learn how to enable it in older projects!](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#migrating-from-023-to-030) - -Create React App uses [Jest](https://facebook.github.io/jest/) as its test runner. To prepare for this integration, we did a [major revamp](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html) of Jest so if you heard bad things about it years ago, give it another try. - -Jest is a Node-based runner. This means that the tests always run in a Node environment and not in a real browser. This lets us enable fast iteration speed and prevent flakiness. - -While Jest provides browser globals such as `window` thanks to [jsdom](https://github.com/tmpvar/jsdom), they are only approximations of the real browser behavior. Jest is intended to be used for unit tests of your logic and your components rather than the DOM quirks. - -We recommend that you use a separate tool for browser end-to-end tests if you need them. They are beyond the scope of Create React App. - -### Filename Conventions - -Jest will look for test files with any of the following popular naming conventions: - -* Files with `.js` suffix in `__tests__` folders. -* Files with `.test.js` suffix. -* Files with `.spec.js` suffix. - -The `.test.js` / `.spec.js` files (or the `__tests__` folders) can be located at any depth under the `src` top level folder. - -We recommend to put the test files (or `__tests__` folders) next to the code they are testing so that relative imports appear shorter. For example, if `App.test.js` and `App.js` are in the same folder, the test just needs to `import App from './App'` instead of a long relative path. Colocation also helps find tests more quickly in larger projects. - -### Command Line Interface - -When you run `npm test`, Jest will launch in the watch mode. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code. - -The watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run: - -![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif) - -### Version Control Integration - -By default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests run fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests. - -Jest will always explicitly mention that it only ran tests related to the files changed since the last commit. You can also press `a` in the watch mode to force Jest to run all tests. - -Jest will always run all tests on a [continuous integration](#continuous-integration) server or if the project is not inside a Git or Mercurial repository. - -### Writing Tests - -To create tests, add `it()` (or `test()`) blocks with the name of the test and its code. You may optionally wrap them in `describe()` blocks for logical grouping but this is neither required nor recommended. - -Jest provides a built-in `expect()` global function for making assertions. A basic test could look like this: - -```js -import sum from './sum'; - -it('sums numbers', () => { - expect(sum(1, 2)).toEqual(3); - expect(sum(2, 2)).toEqual(4); -}); -``` - -All `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/expect.html).
-You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](http://facebook.github.io/jest/docs/expect.html#tohavebeencalled) to create “spies” or mock functions. - -### Testing Components - -There is a broad spectrum of component testing techniques. They range from a “smoke test” verifying that a component renders without throwing, to shallow rendering and testing some of the output, to full rendering and testing component lifecycle and state changes. - -Different projects choose different testing tradeoffs based on how often components change, and how much logic they contain. If you haven’t decided on a testing strategy yet, we recommend that you start with creating simple smoke tests for your components: - -```js -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; - -it('renders without crashing', () => { - const div = document.createElement('div'); - ReactDOM.render(, div); -}); -``` - -This test mounts a component and makes sure that it didn’t throw during rendering. Tests like this provide a lot value with very little effort so they are great as a starting point, and this is the test you will find in `src/App.test.js`. - -When you encounter bugs caused by changing components, you will gain a deeper insight into which parts of them are worth testing in your application. This might be a good time to introduce more specific tests asserting specific expected output or behavior. - -If you’d like to test components in isolation from the child components they render, we recommend using [`shallow()` rendering API](http://airbnb.io/enzyme/docs/api/shallow.html) from [Enzyme](http://airbnb.io/enzyme/). To install it, run: - -```sh -npm install --save enzyme react-test-renderer -``` - -Alternatively you may use `yarn`: - -```sh -yarn add enzyme react-test-renderer -``` - -You can write a smoke test with it too: - -```js -import React from 'react'; -import { shallow } from 'enzyme'; -import App from './App'; - -it('renders without crashing', () => { - shallow(); -}); -``` - -Unlike the previous smoke test using `ReactDOM.render()`, this test only renders `` and doesn’t go deeper. For example, even if `` itself renders a `
- - -); - -export default Footer; diff --git a/Frontend/src/pages/components/Nav.js b/Frontend/src/pages/components/Nav.js deleted file mode 100644 index c451c9a..0000000 --- a/Frontend/src/pages/components/Nav.js +++ /dev/null @@ -1,63 +0,0 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router-dom'; -import { withCookies, Cookies } from 'react-cookie'; -import { instanceOf } from 'prop-types'; -import '../../css/nav.css'; - -class Nav extends Component { - static propTypes = { - cookies: instanceOf(Cookies).isRequired - }; - constructor(props) { - super(props); - this.state = { - open: false - }; - } - onOpen = (e) => { - this.setState({ - open: !this.state.open - }); - } - logout = () => { - const { cookies } = this.props; - cookies.set('isAuthenticated', false); - cookies.remove('jwt'); - } - render() { - const { cookies } = this.props; - const isAuthenticated = cookies.get('isAuthenticated'); - const login = cookies.get('login'); - if (isAuthenticated === "false" && login === true) { - return (); - } - return ( -
-
- {this.state.open - ? - ( - ); - } -} -export default withCookies(Nav); diff --git a/Frontend/src/pages/login/Login.js b/Frontend/src/pages/login/Login.js deleted file mode 100644 index fb749e3..0000000 --- a/Frontend/src/pages/login/Login.js +++ /dev/null @@ -1,85 +0,0 @@ -import React, { Component } from 'react'; -import { instanceOf } from 'prop-types'; -import { withCookies, Cookies } from 'react-cookie'; -import LoginForm from './LoginForm'; -import { Redirect } from 'react-router-dom'; - -import '../../css/login.css'; -import '../../css/register.css'; -import apiFetch from '../../utils/api.js'; -import plane from '../../assets/background/white-plane.svg'; - -class Login extends Component { - static propTypes = { - cookies: instanceOf(Cookies).isRequired - }; - constructor(props) { - super(props); - this.state = { - redirectToReferrer: false, - error: null - }; - } - handleSubmit = (e) => { - e.preventDefault(); - e.persist(); - const req = { - email: e.target.email.value, - password: e.target.password.value, - } - console.log('req', req); - const { cookies } = this.props; - - - return apiFetch('login',{ - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - email: e.target.email.value, - password: e.target.password.value - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - this.setState({ error: json.error }); - const { cookies } = this.props; - cookies.set('isAuthenticated', false, { path: '/' }); - console.log('cookie', cookies.get('isAuthenticated')); - } - else { - console.log('json',json); - const { cookies } = this.props; - cookies.set('isAuthenticated', true); - cookies.set('login', true); - cookies.set('jwt', json.token); - this.setState({redirectToReferrer: true, error: null}); - cookies.set('email', e.target.email.value, { path: '/' }); - } - }); - }; - render() { - if (this.state.redirectToReferrer === true) { - console.log('im now authenticated'); - return (); - } - return ( -
- plane -
- simplif.ai -
-

Create an account

-
- -
-
- ); - } -} - -export default withCookies(Login); diff --git a/Frontend/src/pages/login/LoginForm.js b/Frontend/src/pages/login/LoginForm.js deleted file mode 100644 index 7ba6d87..0000000 --- a/Frontend/src/pages/login/LoginForm.js +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import '../../css/login.css'; -import '../../css/register.css'; - -const LoginForm = ({ login , error }) => ( -
-
- {error ? `Error= ${error}` : null} -
- - - - -
- - Forgot your password? -
- Create an Account -
-); - -export default LoginForm; diff --git a/Frontend/src/pages/login/PasswordReset.js b/Frontend/src/pages/login/PasswordReset.js deleted file mode 100644 index aea715c..0000000 --- a/Frontend/src/pages/login/PasswordReset.js +++ /dev/null @@ -1,76 +0,0 @@ -import React, { Component } from 'react'; -import '../../css/login.css' -import coffee from '../../assets/background/paper-coffee.svg'; -import apiFetch from '../../utils/api.js'; -import { withCookies, Cookies } from 'react-cookie'; -import { instanceOf } from 'prop-types'; - -class PasswordReset extends Component { - constructor(props) { - super(props); - this.state = { - error: null - }; - } - - static propTypes = { - cookies: instanceOf(Cookies).isRequired - }; - updatePassword = (e) => { - e.preventDefault(); - const { cookies } = this.props; - const email = cookies.get('email'); - const req = { - email: email, - password: e.target.password.value, - newPassword: e.target.npassword.value - } - console.log('req', req); - return apiFetch('changePassword', { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - email: email, - password: e.target.password.value, - newPassword: e.target.npassword.value - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - this.setState({ error: json.error }); - } - else { - console.log('json',json); - console.log('password was updated'); - } - }); - } - render() { - return( -
- coffee-icon -

Reset Password

-
-
-
- {this.state.error ? `Error= ${this.state.error}` : null} -
- - - - - - Already have an account? Sign In -
-
-
- ); - } -} - -export default withCookies(PasswordReset); diff --git a/Frontend/src/pages/login/Register.js b/Frontend/src/pages/login/Register.js deleted file mode 100644 index 6bf0a40..0000000 --- a/Frontend/src/pages/login/Register.js +++ /dev/null @@ -1,62 +0,0 @@ -import React, { Component } from 'react'; -import '../../css/register.css'; -import headphones from '../../assets/background/white-headphones.svg'; -import apiFetch from '../../utils/api.js'; -import '../../css/login.css'; - -class Register extends Component { - register = (e) => { - e.preventDefault(); - return apiFetch('createAccount',{ - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - name: e.target.fname.value, - email: e.target.email.value, - password: e.target.password.value, - prefersEmailUpdates: 0 - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.message); - } - else { - console.log('register success json',json); - } - }); - - } - render() { - const { error } = this.props; - return ( -
-
- simplif.ai -
- headphones -

Create an account

-
-
-
- {error ? `Error=${error}` : null} -
- - - - - -
- - Already have an account? Sign In -
-
-
- ); - } -} -export default Register; diff --git a/Frontend/src/pages/login/RequestPasswordReset.js b/Frontend/src/pages/login/RequestPasswordReset.js deleted file mode 100644 index a45eef0..0000000 --- a/Frontend/src/pages/login/RequestPasswordReset.js +++ /dev/null @@ -1,54 +0,0 @@ -import React, { Component } from 'react'; -import apiFetch from '../../utils/api.js'; -import '../../css/login.css'; - -class PasswordReset extends Component { - requestPasswordReset = (e) => { - e.preventDefault(); - const req = { - email: e.target.email.value - }; - console.log('req', req); - return apiFetch('resetPassword', { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - email: req.email - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - } - else { - console.log('json on success',json); - console.log('request was sent'); - } - }); - - } - render() { - return ( -
-

Request Password Reset

-
-
- - - - Already have an account? Sign In - Or register for an account. -
-
-
- ); - } -} - -export default PasswordReset; diff --git a/Frontend/src/pages/login/simplif-03.svg b/Frontend/src/pages/login/simplif-03.svg deleted file mode 100644 index 0d00ffd..0000000 --- a/Frontend/src/pages/login/simplif-03.svg +++ /dev/null @@ -1,13 +0,0 @@ -
- - - - - - - - - - - -
\ No newline at end of file diff --git a/Frontend/src/pages/login/simplif-logotype-04.svg b/Frontend/src/pages/login/simplif-logotype-04.svg deleted file mode 100644 index 1f51c98..0000000 --- a/Frontend/src/pages/login/simplif-logotype-04.svg +++ /dev/null @@ -1 +0,0 @@ -simplif-logotypesimplif.ai \ No newline at end of file diff --git a/Frontend/src/pages/profile/Profile.js b/Frontend/src/pages/profile/Profile.js deleted file mode 100644 index 6b10606..0000000 --- a/Frontend/src/pages/profile/Profile.js +++ /dev/null @@ -1,284 +0,0 @@ -import React, { Component } from 'react'; -import '../../css/profile.css'; -import { Redirect } from 'react-router-dom'; -import { withCookies, Cookies } from 'react-cookie'; -import { instanceOf } from 'prop-types'; -import apiFetch from '../../utils/api.js'; - -//TODO: replace w/ props of summary stuff - //also profile stuff - -class Profile extends Component { - static propTypes = { - cookies: instanceOf(Cookies).isRequired - }; - constructor(props) { - super(props); - this.state = { - name: '', - email: '', - preferEmailUpdates: false, - error: null, - editMode: false, - redirect: false, - editPassword: false - }; - } - componentDidMount() { - const { cookies } = this.props; - const email = cookies.get('email'); - console.log('email', email); - return apiFetch('profile',{ - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - email: email - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - this.setState({ error: json.error }); - const { cookies } = this.props; - } - else { - console.log('componentDidMount on load',json); - const { cookies } = this.props; - this.setState({ - error: null, - name: json.name, - email: json.email, - preferEmailUpdates: json.preferEmailUpdates - }); - } - }); - } - editProfile = (e) => { - this.setState({ editMode: false }); - e.persist(); - const req = { - email: this.state.email, - newEmail: e.target.email.value, - newName: e.target.name.value - } - console.log('req', req); - return apiFetch('editProfile',{ - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - email: this.state.email, - newEmail: e.target.email.value, - newName: e.target.name.value - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - this.setState({ error: json.error }); - const { cookies } = this.props; - } - else { - console.log('json',json); - const { cookies } = this.props; - this.setState({ - error: null, - name: e.target.name.value, - email: e.target.email.value - }); - cookies.set('email', e.target.email.value); - } - }); - } - toggleEditMode = (e) => { - this.setState({ editMode: true }); - } - deleteAccount = (e) => { - const { cookies } = this.props; - const email = cookies.get('email'); - return apiFetch('deleteAccount',{ - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - email: email - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - this.setState({ error: json.error }); - } - else { - console.log('json',json); - const { cookies } = this.props; - cookies.set('isAuthenticated', false); - cookies.remove('jwt'); - cookies.remove('email'); - this.setState({ redirect: true }); - } - }); - } - toggleUpdatePassword = (e) => { - this.setState({ editPassword: true }); - } - updatePassword = (e) => { - e.preventDefault(); - this.setState({ editPassword: false}) - const { cookies } = this.props; - const email = cookies.get('email'); - const req = { - email: email, - password: e.target.password.value, - newPassword: e.target.npassword.value - } - console.log('req', req); - return apiFetch('changePassword', { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - body: JSON.stringify({ - email: email, - password: e.target.password.value, - newPassword: e.target.npassword.value - }) - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - this.setState({ error: json.error }); - } - else { - console.log('json',json); - console.log('password was updated'); - } - }); - } - googleLogin = () => { - return apiFetch('loginToGoogle',{ - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - method: 'POST', - }).then((response) => response.json()) - .then((json) => { - console.log('response', json); - if(json.success === false) { - console.log('error', json.error); - this.setState({ error: json.error }); - const { cookies } = this.props; - cookies.set('isAuthenticated', false, { path: '/' }); - console.log('cookie', cookies.get('isAuthenticated')); - } - else { - console.log('json',json); - const { cookies } = this.props; - cookies.set('isAuthenticated', true); - cookies.set('login', true); - cookies.set('jwt-google', json.token); - } - }); - } - render() { - const { cookies } = this.props; - const isAuthenticated = cookies.get('isAuthenticated'); - if (isAuthenticated === "false" || !isAuthenticated || this.state.redirect === true) { - return (); - } - return ( -
-
- cute prof pic -
{this.state.name}
-

{this.state.email}

-
- -
- - - - - -
-
-
- Example Summary1 -
-
- Example Summary 1 lorem ipsum woooo look at all the text that has been summarized here -
-
-
-
-
- Example Summary2 -
-
- Example Summary 2 lorem ipsum woooo look at all the text that has been summarized here -
-
-
-
-
- Example Summary3 -
-
- Example Summary 3 lorem ipsum woooo look at all the text that has been summarized here -
-
-
-
- - {this.state.editMode ? ( -
-
- {this.state.error ? `Error= ${this.state.error}` : null} -
- - - - -
- -
- ) : null - } - - - - {this.state.editPassword ? - (
-
- {this.state.error ? `Error= ${this.state.error}` : null} -
- - - - -
- -
- ) : null - } - -
-
- ); - } -} - -export default withCookies(Profile); diff --git a/Frontend/src/pages/summary/index.js b/Frontend/src/pages/summary/index.js deleted file mode 100644 index cf438c2..0000000 --- a/Frontend/src/pages/summary/index.js +++ /dev/null @@ -1,135 +0,0 @@ -import React, { Component } from 'react'; -import { withCookies, Cookies } from 'react-cookie'; -import { instanceOf } from 'prop-types'; -import { Redirect } from 'react-router-dom'; -import apiFetch from '../../utils/api.js'; -import '../../css/summary.css'; -import edit_icon_orange from '../../assets/pencil-icon-orange.svg'; -import plane from '../../assets/background/white-plane.svg'; - -class Summary extends Component { - static propTypes = { - cookies: instanceOf(Cookies).isRequired - }; - constructor(props) { - super(props); - this.state = { - redirectToReferrer: false, - summary: {}, - sentences: [], - response: {}, - brevity: 50, - toggleEdit: false, - sentenceCount: null, - text: '', - receivedSummary: false - }; - } - updateSummary = () => { - const summary = []; - const sentenceCount = Math.floor(this.state.brevity * (1/100) * this.state.response.length); - this.setState({ - sentenceCount: sentenceCount - }); - const sentences = []; - this.state.response.forEach(sentence => { - if (sentence[1] <= sentenceCount) { - summary.push(sentence[0]); - } - sentences.push(sentence[0]); - }); - console.log('sentences', sentences.join(' ')); - console.log('summary', summary.join(' ')); - - this.setState({ - summary: summary.join(' '), - text: summary.join(' ') - }); - // this.state.sentenceCount - } - summarize = (e) => { - e.preventDefault(); - e.persist(); - return apiFetch('sumarizertext', { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - text: e.target.textarea.value - }), - method: 'POST' - }).then(response => - response.json() - ).then((json) => { - if (json.success === false) { - console.log('error', json.error); - } - else { - // call funtion to send data to page - console.log('success',json); - // const summary = []; - // const sentenceCount = Math.floor(this.state.brevity * (1/100) * json.text.length); - this.setState({ - response: json.text, - receivedSummary: true - }); - console.log('response', json); - this.updateSummary(); - // const sentences = []; - // json.text.forEach(sentence => { - // if (sentence[1] <= sentenceCount) { - // summary.push(sentence[0]); - // } - // sentences.push(sentence[0]); - // }); - // e.target.textarea.value = summary.join(' '); - // console.log('sentences', sentences.join(' ')); - // console.log('summary', summary.join(' ')); - // this.setState({ summary: summary.join(' ')}); - } - }); - } - handleKeyUp = (e) => { - e.target.style.height = '1px'; - e.target.style.height = 25 + e.target.scrollHeight + 'px'; - } - onEdit = (e) => { - this.setState({ text: e.target.value }); - } - changeBrevity = (e) => { - this.setState({ - brevity: e.target.value, - toggleEdit: true, - sentenceCount: Math.floor(this.state.brevity * (1/100) * this.state.sentences.length) - }); - if (this.state.receivedSummary === true) { - this.updateSummary(); - } - } - render() { - const { cookies } = this.props; - const isAuthenticated = cookies.get('isAuthenticated'); - if (isAuthenticated === "false" || !isAuthenticated) { - return (); - } - return ( -
- {this.state.toggleEdit ? plane : null} -
-

Title

- - -