<commit_before>class SegmentMatcher
  constructor: (segment) ->
    @segment = segment.join('')

  matches: (scope) ->
    scope is @segment

class AsterixMatcher
  constructor: ->

  matches: ->
    true

class ScopeMatcher
  constructor: (first, others) ->
    @segments = [first]
    @segments.push(segment[1]) for segment in others

  matches: (scope) ->
    scopeSegments = scope.split('.')
    if scopeSegments.length < @segments.length
      return false

    for segment, index in @segments
      unless segment.matches(scopeSegments[index])
        return false
    true

class PathMatcher
  constructor: (first, others) ->
    @matchers = [first]
    @matchers.push(matcher[1]) for matcher in others

  matches: (scopes) ->
    matcher = @matchers.shift()
    for scope in scopes
      matcher = @matchers.shift() if matcher.matches(scope)
      return true unless matcher?
    false

class OrMatcher
  constructor: (@left, @right) ->

  matches: (scopes) ->
    @left.matches(scopes) or @right.matches(scopes)

class AndMatcher
  constructor: (@left, @right) ->
<commit_msg>Index into array instead of removing matchers<commit_after>class SegmentMatcher
  constructor: (segment) ->
    @segment = segment.join('')

  matches: (scope) ->
    scope is @segment

class AsterixMatcher
  constructor: ->

  matches: ->
    true

class ScopeMatcher
  constructor: (first, others) ->
    @segments = [first]
    @segments.push(segment[1]) for segment in others

  matches: (scope) ->
    scopeSegments = scope.split('.')
    if scopeSegments.length < @segments.length
      return false

    for segment, index in @segments
      unless segment.matches(scopeSegments[index])
        return false
    true

class PathMatcher
  constructor: (first, others) ->
    @matchers = [first]
    @matchers.push(matcher[1]) for matcher in others

  matches: (scopes) ->
    index = 0
    matcher = @matchers[index]
    for scope in scopes
      matcher = @matchers[++index] if matcher.matches(scope)
      return true unless matcher?
    false

class OrMatcher
  constructor: (@left, @right) ->

  matches: (scopes) ->
    @left.matches(scopes) or @right.matches(scopes)

class AndMatcher
  constructor: (@left, @right) ->

{'fraction_non_alphanumeric': 0.1177797833935018, 'fraction_numerical': 0.002256317689530686, 'mean_word_length': 3.1988636363636362, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6979953', 'n_tokens_mistral': 691, 'n_tokens_neox': 677, 'n_words': 190}