code: def test_basic_cleaning():
      # from better_profanity import profanity
      # https://pypi.org/project/alt-profanity-check/
      from profanity_check import predict
  
      df_list = []
      for data in useful_oig_files:
          # for data in useful_oig_files[:5]:
          # for data in ['unified_openai_summarize_tldr.jsonl.parquet']:
          print("Processing %s" % data, flush=True)
          df = pd.read_parquet(data)
          df = df.reset_index(drop=True)
          # NOTE: Not correct if multiple human-bot interactions, but those dialogs even more desired
          # avg_chars = len(df['text'][0])/(df['text'][0].count(human)+df['text'][0].count(bot))
          df["avg_words"] = df["text"].apply(
              lambda x: x.count(" ")
              / (x.count(human) + x.count(bot))
              / 2.0
          )
          df["avg_bot_words"] = df["text"].apply(
              lambda x: x.split(bot)[1].count(" ") / x.count(bot)
          )
          # df['bad_words'] = df['text'].apply(lambda x: profanity.contains_profanity(x))
          # low_quality_patterns = ['Write the rest of this wikipedia article']
          res = predict(df["text"])
          df["bad_words"] = res
          df = df.reset_index(drop=True)
          df = df[df["bad_words"] == 0]
          df = df[["text", "avg_words", "avg_bot_words"]]
          df = df.drop_duplicates(keep="first")
          print(
              df[df["avg_words"] == df["avg_words"].max()][
                  "text"
              ].values
          )
          median_words = np.median(df["avg_words"])
          min_words_per_entity = max(30, 0.8 * median_words)
          max_words_per_entity = 2048  # too hard to learn from for now
          df = df[df["avg_words"] > min_words_per_entity]
          df = df[df["avg_words"] < max_words_per_entity]
  
          min_words_per_entity = max(
              20, 0.5 * median_words
          )  # bot should say stuff for now
          max_words_per_entity = 2048  # too hard to learn from for now
          df = df[df["avg_bot_words"] > min_words_per_entity]
          df = df[df["avg_bot_words"] < max_words_per_entity]
  
          df_list.append(df)
          print(
              "Done processing %s -> %s rows" % (data, df.shape[0]),
              flush=True,
          )
      df_final = pd.concat(df_list)
      df_final.to_parquet(
          "h2oGPT.cleaned.human_bot.parquet", index=False
      )
  
imports: import ast
  import concurrent.futures
  import contextlib
  import hashlib
  import json
  import os
  import shutil
  import signal
  import sys
  import traceback
  from concurrent.futures import ProcessPoolExecutor
  import psutil
  import pytest
  import pandas
  import numpy
  from tqdm import tqdm
  from utils import flatten_list, remove
  from joblib import Parallel, delayed, effective_n_jobs
  from sklearn.utils import gen_even_slices
  from sklearn.utils.validation import _num_samples
label_desc: Use image node_id 24 for calling a global function with example usage: test_basic_cleaning() without return types