<commit_before>import { INodeFilter } from './node-filter'

export class CloseKeywordFilter implements INodeFilter {
  public createFilterTreeWalker(doc: Document): TreeWalker {
    throw new Error('Method not implemented.')
  }

  public filter(node: Node): Promise<readonly Node[] | null> {
    throw new Error('Method not implemented.')
  }
}<commit_msg>Filter tree walker (no text inside pre, code, a tags)<commit_after>import { INodeFilter } from './node-filter'

export class CloseKeywordFilter implements INodeFilter {
  /**
   *  Close keyword filter iterates on all text nodes that are not inside a pre,
   *  code, or anchor tag.
   */
  public createFilterTreeWalker(doc: Document): TreeWalker {
    return doc.createTreeWalker(doc, NodeFilter.SHOW_TEXT, {
      acceptNode: node => {
        return node.parentNode !== null &&
          ['CODE', 'PRE', 'A'].includes(node.parentNode.nodeName)
          ? NodeFilter.FILTER_SKIP
          : NodeFilter.FILTER_ACCEPT
      },
    })
  }

  public filter(node: Node): Promise<readonly Node[] | null> {
    throw new Error('Method not implemented.')
  }
}
{'fraction_non_alphanumeric': 0.11320754716981132, 'fraction_numerical': 0.0, 'mean_word_length': 3.5284552845528454, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '7315541', 'n_tokens_mistral': 322, 'n_tokens_neox': 314, 'n_words': 93}