From cbdc73c355c4ebc22a8a3f7301e0038c766f4048 Mon Sep 17 00:00:00 2001 From: David Fuhry <david@129a-records.de> Date: Mon, 26 Nov 2018 18:15:35 +0100 Subject: [PATCH 1/4] Added Master.R stub --- r/Master.R | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 r/Master.R diff --git a/r/Master.R b/r/Master.R new file mode 100644 index 0000000..ae34ed0 --- /dev/null +++ b/r/Master.R @@ -0,0 +1,51 @@ +### This script consolidates everything +### Just examples for now + +## Librarys + +#library(SomeLibrary) + +## Load Scripts + +#source("getBirthday.R") +#source("getSomethingElse.R") + +## Fetch data via API + +source("GetData.R") + +# TODO: Change script to be a function +# Data is now in articles + +## Data processing + +results <- lapply(articles, function(x) { + ## Data cleaning + + # cleaned.text <- someCleanFunctioN(x$Text) + + ## Data preprocessing/annotating + + # annotated.text <- annotationFunction(x$Text) + + ## Extract information from Text + + # someFact <- getFactFromTextFunctioN(annotated.text) + + # someOtherFact <- getOtherFactFromText(x$Text) + + ## Create Results + + # data.frame(Name = x$Name, + # FactOne = someFact, + # FactTwo = someOtherFact) + +}) + +results <- do.call(rbind, results) + +## Results are now in results + +## Format for rasa + +# someFormatFunction(results) -- GitLab From 495d1fe46ed29008ac8a9857dfc3c829866ac09d Mon Sep 17 00:00:00 2001 From: David Fuhry <david@129a-records.de> Date: Wed, 28 Nov 2018 15:36:38 +0100 Subject: [PATCH 2/4] Minor refactoring --- r/Master.R | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/r/Master.R b/r/Master.R index ae34ed0..413224f 100644 --- a/r/Master.R +++ b/r/Master.R @@ -1,5 +1,7 @@ +#!/usr/bin/env Rscript + + ### This script consolidates everything -### Just examples for now ## Librarys @@ -7,15 +9,13 @@ ## Load Scripts -#source("getBirthday.R") -#source("getSomethingElse.R") - -## Fetch data via API +source("r/GetData.R") +#source("r/getBirthday.R") +#source("r/getSomethingElse.R") -source("GetData.R") +## Fetch data -# TODO: Change script to be a function -# Data is now in articles +articles <- getData(use.cache = TRUE) ## Data processing -- GitLab From 3527f3bf5f2d16d14837d7314a866c4c652b8def Mon Sep 17 00:00:00 2001 From: David Fuhry <david@129a-records.de> Date: Wed, 28 Nov 2018 15:54:44 +0100 Subject: [PATCH 3/4] Variable renaming --- r/Master.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/r/Master.R b/r/Master.R index 413224f..43770a5 100644 --- a/r/Master.R +++ b/r/Master.R @@ -19,20 +19,20 @@ articles <- getData(use.cache = TRUE) ## Data processing -results <- lapply(articles, function(x) { +results <- lapply(articles, function(data) { ## Data cleaning - # cleaned.text <- someCleanFunctioN(x$Text) + # cleaned.text <- someCleanFunctioN(data$Text) ## Data preprocessing/annotating - # annotated.text <- annotationFunction(x$Text) + # annotated.text <- annotationFunction(data$Text) ## Extract information from Text # someFact <- getFactFromTextFunctioN(annotated.text) - # someOtherFact <- getOtherFactFromText(x$Text) + # someOtherFact <- getOtherFactFromText(data$Text) ## Create Results -- GitLab From 68d4f7aa10ea9240d307bd088937443f3a8fbf7d Mon Sep 17 00:00:00 2001 From: David Fuhry <david@129a-records.de> Date: Wed, 28 Nov 2018 16:29:05 +0100 Subject: [PATCH 4/4] Minor changes --- r/Master.R | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/r/Master.R b/r/Master.R index 43770a5..068ac04 100644 --- a/r/Master.R +++ b/r/Master.R @@ -9,16 +9,24 @@ ## Load Scripts +cat("Sourcing R scripts... ") + source("r/GetData.R") #source("r/getBirthday.R") #source("r/getSomethingElse.R") +cat("Done.\n") + ## Fetch data +cat("Starting data import...\n") + articles <- getData(use.cache = TRUE) ## Data processing +cat("Processing data...\n") + results <- lapply(articles, function(data) { ## Data cleaning -- GitLab