Skip to content

Commit daf77a3

Browse files
committed
various changes from demo prep
1 parent 0e27671 commit daf77a3

File tree

9 files changed

+51
-4
lines changed

9 files changed

+51
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
package com.pipelinescript;
3+
public class Pipeline
4+
{
5+
6+
public static void main(String[] args) throws Exception
7+
{
8+
Function head = new Function("head");
9+
Function scrape = new Function("newspaper/scrape.py");
10+
Function download = new Function("newspaper/download.py");
11+
FileManager.write("source.txt", "http://www.nytimes.com");
12+
FileManager.write("urls.csv", PluginManager.execute(scrape, "source.txt" ));
13+
FileManager.split("url#.txt", PluginManager.execute(head, "urls.csv" ));
14+
ProcessManager.executeParallel(download, "url#.txt", "text#.txt");
15+
System.out.println(PluginManager.execute(head, "text#.txt" ));
16+
}
17+
18+
}

PipelineScript/src/com/pipelinescript/PluginManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static String execute(String exec, String... args)
4444
{
4545

4646
String cmd = exec+arguments;
47-
System.out.println(cmd);
47+
System.err.println(cmd);
4848

4949
Process pr = Runtime.getRuntime().exec(cmd);
5050
BufferedReader bfr = new BufferedReader(new InputStreamReader(pr.getInputStream()));

examples/file_io.pls

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"this is some example text, and it is exemplary" -> "text.txt"
2+
3+
print @"text.txt"

examples/newspaper_ner.pls examples/newspaper_names.pls

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function scrape = !"newspaper/scrape.py"
2-
function head = !"head"
2+
function head = !"head -n 5"
33
function download = !"newspaper/download.py"
44
function get_names = !"stanford-ner/ner.py"
55
function count = !"count.py"

examples/newspaper_simple.pls

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function head = !"head"
2+
function scrape = !"newspaper/scrape.py"
3+
function download = !"newspaper/download.py"
4+
5+
"http://www.nytimes.com" -> "source.txt"
6+
scrape("source.txt") -> "urls.csv"
7+
head("urls.csv") -< "url#.txt"
8+
&download("url#.txt") => "text#.txt"
9+
10+
print head("text#.txt")

examples/newspaper_words.pls

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function scrape = !"newspaper/scrape.py"
2-
function head = !"head"
2+
function head = !"head -n 5"
33
function download = !"newspaper/download.py"
44
function tokenize = !"tokenize.py"
55
function count = !"count.py"

examples/scripts.pls

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function words = !"tokenize.py"
2+
function counts = !"count.py"
3+
4+
"the boy and the girl played with the dog and the cat" -> "text.txt"
5+
6+
words("text.txt") -> "words.txt"
7+
counts("words.txt") -> "counts.csv"
8+
9+
print @"counts.csv"

examples/shell.pls

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"1\n2\n3\n4\n5\n6\n7\n8\n9" -> "data.txt"
2+
3+
function head = !"head -n 3"
4+
5+
head("data.txt") -> "head.txt"
6+
7+
print @"head.txt"

pls.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
python pls.py $1 > PipelineScript/src/com/pipelinescript/Pipeline.java 2> /dev/null
22
javac -d PipelineScript/bin PipelineScript/src/com/pipelinescript/*.java 2> /dev/null
33
java -cp PipelineScript/bin com.pipelinescript.Pipeline
4-
rm PipelineScript/src/com/pipelinescript/Pipeline.java
4+
#rm PipelineScript/src/com/pipelinescript/Pipeline.java
55
rm PipelineScript/bin/com/pipelinescript/Pipeline.class
66
rm parser.out parsetab.py parsetab.pyc 2> /dev/null

0 commit comments

Comments
 (0)