DailyJS

DailyJS

The JavaScript blog.


Tagnatural-language
Featured

music node modules natural-language

Node Roundup: natural, node-beatport, node-schema-org

Posted on .

natural

I was recently doing some work that involved stemming. It wasn't very
fun. Anyway, I found natural by
Chris Umbel
(License) which offers tools for stemming, classification, phonetics and
inflection:

var natural = require('natural'),
    classifier = new natural.BayesClassifier();

natural.PorterStemmer.stem('reading');
// 'read'

classifier.train(
  [{classification: 'happy', text: 'I love pizza'},
   {classification: 'happy', text: 'javascript is awesome'},
   {classification: 'sad', text: 'I hate tax'}
]);

classifier.classify('how does alex feel about pizza?');
// 'happy'
classifier.classify('how does alex feel about tax?');
// 'sad'

node-beatport

node-beatport is a client library for the Beatport API.
Beatport is a service for buying and downloading electronic music, so the API provides a way of querying
track, artist, chart or genre details.

var Beatport = require('beatport')

// initialize client
var bp = Beatport()

// resources (i.e: featured/releases) as methods (camelCased, i.e: featuredReleases)
bp.releases({
  facets: [ 'genreName:Trance', 'performerName:Above&Beyond' ]
, perPage: 5
, page: 1
}, function(err, results, metadata) {
  // do something
})

bp.labelDetail({ id: 804 }, function(err, results, metadata) {
  // do something
})

I found it surprising that Beatport has an API -- I don't think I've
seen other music retailers offering this kind of service.

node-schema-org

node-schema-org by Charlie Robbins is a library for parsing the
microdata schemas found on schema.org.

At the moment it will just output all of the scemas as JSON files:

$ npm install -g schema-org
$ read-schema-org
warn:   Removing all schemas in /usr/local/lib/node_modules/schema-org/schemas
info:   Spawning: node /usr/local/lib/node_modules/schema-org/list-schemas.js
info:   Contacting: http://schema.org/docs/full.html

This actually spawns lots of background jobs and totally owned my
machine, so be wary of using it in its current state.