<commit_before>// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import React, { useState } from 'react';

import { StringExt } from '@lumino/algorithm';

import { InputGroup } from '@jupyterlab/ui-components';

import { ReactWidget } from '@jupyterlab/apputils';

import { Contents } from '@jupyterlab/services';

import { DirListing } from './listing';

/**
 * The class name added to the filebrowser crumbs node.
 */
export interface IFilterBoxProps {
  listing: DirListing;
  placeholder?: string;
}

/**
 * A text match score with associated content item.
 */
interface IScore {
  /**
   * The numerical score for the text match.
   */
  score: number;

  indices: number[] | null;

  /**
   * The command item associated with the match.
   */
  item: Contents.IModel;
}

/**
 * Perform a fuzzy search on a single item.
 */
function fuzzySearch(item: Contents.IModel, query: string): IScore | null {
  let source = `${item.name}`;

  // Set up the match score and indices array.
  let score = Infinity;<commit_msg>Add typedoc on indices attribute<commit_after>// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import React, { useState } from 'react';

import { StringExt } from '@lumino/algorithm';

import { InputGroup } from '@jupyterlab/ui-components';

import { ReactWidget } from '@jupyterlab/apputils';

import { Contents } from '@jupyterlab/services';

import { DirListing } from './listing';

/**
 * The class name added to the filebrowser crumbs node.
 */
export interface IFilterBoxProps {
  listing: DirListing;
  placeholder?: string;
}

/**
 * A text match score with associated content item.
 */
interface IScore {
  /**
   * The numerical score for the text match.
   */
  score: number;

  /**
   * The indices of the text matches.
   */
  indices: number[] | null;

  /**
   * The command item associated with the match.
   */
  item: Contents.IModel;
}

/**
 * Perform a fuzzy search on a single item.
 */
function fuzzySearch(item: Contents.IModel, query: string): IScore | null {
  let source = `${item.name}`;

  // Set up the match score and indices array.
  let score = Infinity;
{'fraction_non_alphanumeric': 0.11963882618510158, 'fraction_numerical': 0.0, 'mean_word_length': 3.440881763527054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3086487', 'n_tokens_mistral': 684, 'n_tokens_neox': 660, 'n_words': 241}