 # Main scoring algorithm
 #
 
-doScore = (subject, subject_lw, prepQuery) ->
+scoreMain = (subject, subject_lw, prepQuery) ->
   query = prepQuery.query
   query_lw = prepQuery.query_lw
 

# Score adjustment for path
#

pathScore = (subject, subject_lw, prepQuery, fullPathScore) ->
  return 0 if fullPathScore is 0


  # Skip trailing slashes
  end = subject.length - 1
  end-- while subject[end] is PathSeparator

  # Get position of basePath of subject.
  basePos = subject.lastIndexOf(PathSeparator, end)

  depth = prepQuery.depth

  # Get that many folder from subject
  while basePos > -1 and depth-- > 0
    basePos = subject.lastIndexOf(PathSeparator, basePos - 1)

  # Get basePath score, if BaseName is the whole string, no need to recompute
  # We still need to apply the folder depth and filename penalty.
  basePathScore = if (basePos is -1) then fullPathScore else
    extAdjust * scoreMain(subject.slice(basePos + 1, end + 1), subject_lw.slice(basePos + 1, end + 1), prepQuery)

  # Final score is linear interpolation between base score and full path score.
  # For low directory depth, interpolation favor base Path then include more of full path as depth increase
