linguine-node is a Node.js web server for use in the Linguine natural language processing workbench. The server presents a client-facing web interface, which allows users to upload, view, tag, and analyze text files. It communicates with a Python server with JSON messages, and presents the results on-screen to the user.
To add a new analysis or cleanup operation to this project:
- Add the operation to the correct list in
assets/js/analysis/new.controller.js
- Create a
visualizeOperation()
function for the operation inassets/js/analysis/show.controller.js
- Add the operation as a case in the
visualize()
function inassets/js/analysis/show.controller.js
In assets/js/analysis/new.controller.js
, add the operation into the analysisTypes
, cleanupTypes
, or tokenizerTypes
list, depending on if the operation is an analysis, something to clean text, or something to tokenize the text into separate word tokens.
{
name: "Foo Bar",// The operation name to display to the user
unfriendly_name: "foobar", // The name of the operation identifier used in the Python operation builder
description: "A foo bar turns your text into a baz using a library." // A description of the operation to display to the user
}
Create a visualize function in assets/js/analysis/show.controller.js
to display the results of the analysis operation.
$scope.visualizeFoobar = function() {
// DOM element #graph is the location on the page where visualizations can be placed
// Results of the analysis operation can be accessed at $scope.analysis.result
}
Add the visualization to the list of cases in assets/js/analysis/show.controller.js
.
$scope.visualize = function () {
if ($scope.analysis.analysis === "tfidf" ) {
$scope.visualizeTfidf();
} else if ($scope.analysis.analysis == "wordcloudop") {
$scope.visualizeWordcloud();
}
}
linguine-node assembles an HTTP request to send to the Python server. The request is assembled in routes/analysis.js
. This is the template used for building the request.
{
"corpora_ids": ["12345"], //Collection of corpora to pipe into analysis
"cleanup": ["stopwords"], //Cleanup steps to add
"operation": "nlp-relation", //Type of analysis to be preformed
"tokenizer": "", //Tokenizer used (if required)
"library": "", //Library associated w/ analysis (if required)
"transaction_id": "", //(Field to be populated by linguine-python)
"analysis_name": "Relation Extraction (Stanford CoreNLP)", //Name to display in text fields
"time_created": 1461342250445, //Used to calculate ETA of analyses
"user_id": "12345" //Unique identifier of user who created analysis
}
npm install
npm run ldap
bower install
gulp build
(Orgulp
if you want watch enabled and unminified assets)npm start
To run tests:
npm install
bower install
npm test
export NODE_ENV=developent
sudo npm install -g bower
sudo npm install -g gulp
npm install
bower install
- During bower install, you may be asked to choose a version of
angular
. choose the version required bylinguine-node
. gulp build
npm start
- Navigate to http://localhost:3000 and you should finally see the site up and running!