Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

mix/schenkerian

Folders and files

NameName
Last commit message
Last commit date
Jun 22, 2020
Jun 19, 2020
Feb 12, 2018
Jun 30, 2020
Feb 22, 2021
Oct 21, 2014
Feb 19, 2018
Feb 9, 2019
Nov 2, 2018
Feb 17, 2018
Apr 6, 2019
Mar 8, 2021
Mar 3, 2021

Repository files navigation

CircleCI Code Climate

HTML Schenkerian analyzer

Greenkeeper badge

Schenkerian analysis is a method of musical analysis by interpreting the underlying structure of a tonal work and to help reading the score according to that structure.

This library is that, but for HTML built on top of Natural Node which includes term frequency, string similarities, and tokenizing. Given most webpages (attempt) to use the semantics of HTML, it takes into account not only term frequency, but the weight of an HTML tag, placement in document, and other useful forms of denoting significance (like Open Graph).

Install

$ npm install schenkerian --save

Usage

var analyze = require('schenkerian')

analyze({
  url: 'http://dustindiaz.com',
  body: '<html>...</html>' // optional. if absent, the module will `request` the given webpage
})
.then(function (result) {
  console.log(result)
})

output

{
"totalWords": 637,
"permalink": "http://dustindiaz.com/",
"title": "Dustin Diaz",
"relevance": [
    {
      "word": "javascript",
      "score": 1.074,
      "count": 47
    },
    {
      "word": "ender",
      "score": 0.571,
      "count": 25
    },
    {
      "word": "follow",
      "score": 0.228,
      "count": 10
    },
    {
      "word": "css",
      "score": 0.228,
      "count": 10
    },
    {
      "word": "qwery tiny selector",
      "score": 0.14,
      "count": 3
    },
    {
      "word": "open submodule library",
      "score": 0.14,
      "count": 3
    },
    {
      "word": "js open submodule",
      "score": 0.14,
      "count": 3
    },
    {
      "word": "ender js open",
      "score": 0.14,
      "count": 3
    },
    {
      "word": "mvc framework node",
      "score": 0.14,
      "count": 3
    },
    {
      "word": "tiny selector engine",
      "score": 0.14,
      "count": 3
    }
  ]
}