Skip to content

Commit 6e0bfec

Browse files
author
Chris Park
committed
Modified examples to new format
1 parent 73429d2 commit 6e0bfec

18 files changed

+52
-35
lines changed

examples/base64_input.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1717
var args = parser.parseArgs();
1818

1919
var docParams = new DocumentParameters();
20-
var content = new Buffer("Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS ").toString('base64');
20+
var entities_text_data = "Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS";
21+
var content = new Buffer(entities_text_data).toString('base64');
2122

2223
docParams.setItem("content", content);
2324
docParams.setItem("contentType", rosetteConstants.dataFormat.UNSPECIFIED);
@@ -28,6 +29,6 @@ api.entities(docParams, false, function(err, res) {
2829
throw err;
2930
}
3031
else {
31-
console.log(res);
32+
console.log(JSON.stringify(res, null, 2));
3233
}
3334
});

examples/categories.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ var parser = new ArgumentParser({
1212
addHelp: true,
1313
description: "Get the category of a piece of a document at a URL"
1414
});
15+
var categories_url_data = "http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/";
1516
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1617
parser.addArgument(["--url"], {help: "Optional URL for data",
17-
defaultValue: "http://www.onlocationvacations.com/2015/03/05/the-new-ghostbusters-movie-begins-filming-in-boston-in-june/"});
18+
defaultValue: categories_url_data});
1819
var args = parser.parseArgs();
1920

2021
var docParams = new DocumentParameters();
@@ -26,6 +27,6 @@ api.categories(docParams, function(err, res) {
2627
throw err;
2728
}
2829
else {
29-
console.log(res);
30+
console.log(JSON.stringify(res, null, 2));
3031
}
3132
});

examples/entities.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1616
var args = parser.parseArgs();
1717

1818
var docParams = new DocumentParameters();
19-
var content = "Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS ";
19+
var entities_text_data = "Bill Murray will appear in new Ghostbusters film: Dr. Peter Venkman was spotted filming a cameo in Boston this… http://dlvr.it/BnsFfS";
20+
var content = entities_text_data;
2021

2122
docParams.setItem("content", content);
2223

@@ -26,6 +27,6 @@ api.entities(docParams, false, function(err, res) {
2627
throw err;
2728
}
2829
else {
29-
console.log(res);
30+
console.log(JSON.stringify(res, null, 2));
3031
}
3132
});

examples/entities_linked.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1616
var args = parser.parseArgs();
1717

1818
var docParams = new DocumentParameters();
19-
var content = "Last month director Paul Feig announced the movie will have an all-star female cast including Kristen Wiig, Melissa McCarthy, Leslie Jones and Kate McKinnon.";
19+
var entities_linked_text_data = "Last month director Paul Feig announced the movie will have an all-star female cast including Kristen Wiig, Melissa McCarthy, Leslie Jones and Kate McKinnon.";
20+
var content = entities_linked_text_data;
2021
docParams.setItem("content", content);
2122

2223
var api = new Api(args.key);
@@ -25,6 +26,6 @@ api.entities(docParams, true, function(err, res) {
2526
throw err;
2627
}
2728
else {
28-
console.log(res);
29+
console.log(JSON.stringify(res, null, 2));
2930
}
3031
});

examples/info.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ api.info(function(err, res) {
2020
throw err;
2121
}
2222
else {
23-
console.log(res);
23+
console.log(JSON.stringify(res, null, 2));
2424
}
2525
});

examples/language.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1616
var args = parser.parseArgs();
1717

1818
var docParams = new DocumentParameters();
19-
var content = "Por favor Señorita, says the man.";
19+
var language_data = "Por favor Señorita, says the man.";
20+
var content = language_data;
2021
docParams.setItem("content", content);
2122

2223
var api = new Api(args.key);
@@ -25,6 +26,6 @@ api.language(docParams, function(err, res) {
2526
throw err;
2627
}
2728
else {
28-
console.log(res);
29+
console.log(JSON.stringify(res, null, 2));
2930
}
3031
});

examples/matched-name.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ var parser = new ArgumentParser({
1515
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1616
var args = parser.parseArgs();
1717

18-
var name1 = {"text": "Michael Jackson", "language": "eng", "entityType": "PERSON"};
19-
var name2 = {"text": "迈克尔·杰克逊", "entityType": "PERSON"};
18+
var matched_name_data1 = "Michael Jackson";
19+
var matched_name_data2 = "迈克尔·杰克逊";
20+
var name1 = {"text": matched_name_data1, "language": "eng", "entityType": "PERSON"};
21+
var name2 = {"text": matched_name_data2, "entityType": "PERSON"};
2022
var matchParams = new NameMatchingParameters(name1, name2);
2123

2224
var api = new Api(args.key);
@@ -25,6 +27,6 @@ api.matchedName(matchParams, function(err, res) {
2527
throw err;
2628
}
2729
else {
28-
console.log(res);
30+
console.log(JSON.stringify(res, null, 2));
2931
}
3032
});

examples/morphology_complete.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1717
var args = parser.parseArgs();
1818

1919
var docParams = new DocumentParameters();
20-
var content = "The quick brown fox jumped over the lazy dog. Yes he did.";
20+
var morphology_complete_data = "The quick brown fox jumped over the lazy dog. Yes he did.";
21+
var content = morphology_complete_data;
2122
docParams.setItem("content", content);
2223

2324
var api = new Api(args.key);
@@ -26,6 +27,6 @@ api.morphology(docParams, null, function(err, res) {
2627
throw err;
2728
}
2829
else {
29-
console.log(res);
30+
console.log(JSON.stringify(res, null, 2));
3031
}
3132
});

examples/morphology_compound-components.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1717
var args = parser.parseArgs();
1818

1919
var docParams = new DocumentParameters();
20-
var content = "Rechtsschutzversicherungsgesellschaften";
20+
var morphology_compound_components_data = "Rechtsschutzversicherungsgesellschaften";
21+
var content = morphology_compound_components_data;
2122
docParams.setItem("content", content);
2223

2324
var api = new Api(args.key);
@@ -26,6 +27,6 @@ api.morphology(docParams, rosetteConstants.morpholoyOutput.COMPOUND_COMPONENTS,
2627
throw err;
2728
}
2829
else {
29-
console.log(res);
30+
console.log(JSON.stringify(res, null, 2));
3031
}
3132
});

examples/morphology_han-readings.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ parser.addArgument(["--key"], {help: "Rosette API key", required: true});
1717
var args = parser.parseArgs();
1818

1919
var docParams = new DocumentParameters();
20-
var content = "北京大学生物系主任办公室内部会议";
20+
var morphology_han_readings_data = "北京大学生物系主任办公室内部会议";
21+
var content = morphology_han_readings_data;
2122
docParams.setItem("content", content);
2223

2324
var api = new Api(args.key);
@@ -26,6 +27,6 @@ api.morphology(docParams, rosetteConstants.morpholoyOutput.HAN_READINGS, functio
2627
throw err;
2728
}
2829
else {
29-
console.log(res);
30+
console.log(JSON.stringify(res, null, 2));
3031
}
3132
});

0 commit comments

Comments
 (0)