lib/read.js
function initializeNode (node) {
  if (!node || node.length === 0) {
    return 0
  }
  const tag = node.get(0).name
  if (nodeTypes.mostPositive.indexOf(tag) >= 0) {
    return 5 + getClassWeight(node)
  }
  if (nodeTypes.positive.indexOf(tag) >= 0) {
    return 3 + getClassWeight(node)
  }
  if (nodeTypes.negative.indexOf(tag) >= 0) {
    return -3 + getClassWeight(node)
  }
  if (nodeTypes.mostNegative.indexOf(tag) >= 0) {
    return -5 + getClassWeight(node)
  }
  return -1
}
function initializeNode (node) {
  if (!node || node.length === 0) {
    return 0
  }
  const tag = node.get(0).name
  if (nodeTypes.mostPositive.indexOf(tag) >= 0) {
    return 5 + getClassWeight(node)
  }
  if (nodeTypes.positive.indexOf(tag) >= 0) {
    return 3 + getClassWeight(node)
  }
  if (nodeTypes.negative.indexOf(tag) >= 0) {
    return -3 + getClassWeight(node)
  }
  if (nodeTypes.mostNegative.indexOf(tag) >= 0) {
    return -5 + getClassWeight(node)
  }
  return -1
}
function initializeNode ( node ) { if ( ! node || node . length === 0 ) { return 0 } const tag = node . get ( 0 ) . name if ( nodeTypes . mostPositive . indexOf ( tag ) >= 0 ) { return 5 + getClassWeight ( node ) } if ( nodeTypes . positive . indexOf ( tag ) >= 0 ) { return 3 + getClassWeight ( node ) } if ( nodeTypes . negative . indexOf ( tag ) >= 0 ) { return - 3 + getClassWeight ( node ) } if ( nodeTypes . mostNegative . indexOf ( tag ) >= 0 ) { return - 5 + getClassWeight ( node ) } return - 1 }
Check the type of node, and get its Weight
Check the type of node and get its Weight