class_docstr: Computes the weak labels of a multi-label text classification dataset by applying a given list of rules.
  
  Args:
      dataset: Name of the dataset to which the rules will be applied.
      rules: A list of rules (labeling functions). They must return a string, list of strings, or ``None`` in case of
          abstention. If None, we will use the rules of the dataset (Default).
      ids: An optional list of record ids to filter the dataset before applying the rules.
      query: An optional ElasticSearch query with the
          `query string syntax <https://docs.argilla.io/en/latest/practical_guides/filter_dataset.html>`_
          to filter the dataset before applying the rules.
  
  Raises:
      NoRulesFoundError: When you do not provide rules, and the dataset has no rules either.
      DuplicatedRuleNameError: When you provided multiple rules with the same name.
      NoRecordsFoundError: When the filtered dataset is empty.
  
  Examples:
      >>> # Get the 3 dimensional weak label matrix from a multi-label classification dataset with rules:
      >>> weak_labels = WeakMultiLabels(dataset="my_dataset")
      >>> weak_labels.matrix()
      >>> weak_labels.summary()
      >>>
      >>> # Get the 3 dimensional weak label matrix from rules defined in Python:
      >>> def awesome_rule(record: TextClassificationRecord) -> str:
      ...     return ["Positive", "Slang"] if "next level" in record.text else None
      >>> another_rule = Rule(query="amped OR psyched", label=["Positive", "Slang"])
      >>> weak_labels = WeakMultiLabels(dataset="my_dataset", rules=[awesome_rule, another_rule])
      >>> weak_labels.matrix()
      >>> weak_labels.summary()
class_docstr_tok: ["Computes","the","weak","labels","of","a","multi-label","text","classification","dataset","by","applying","a","given","list","of","rules",".","Args",":","dataset",":","Name","of","the","dataset","to","which","the","rules","will","be","applied",".","rules",":","A","list","of","rules","(","labeling","functions",")",".","They","must","return","a","string",",","list","of","strings",",","or","``","None","``","in","case","of","abstention",".","If","None",",","we","will","use","the","rules","of","the","dataset","(","Default",")",".","ids",":","An","optional","list","of","record","ids","to","filter","the","dataset","before","applying","the","rules",".","query",":","An","optional","ElasticSearch","query","with","the","`","query","string","syntax","<","https",":","\/\/docs.argilla.io\/en\/latest\/practical_guides\/filter_dataset.html",">","`","_","to","filter","the","dataset","before","applying","the","rules",".","Raises",":","NoRulesFoundError",":","When","you","do","not","provide","rules",",","and","the","dataset","has","no","rules","either",".","DuplicatedRuleNameError",":","When","you","provided","multiple","rules","with","the","same","name",".","NoRecordsFoundError",":","When","the","filtered","dataset","is","empty",".","Examples",":",">",">",">","#","Get","the","3","dimensional","weak","label","matrix","from","a","multi-label","classification","dataset","with","rules",":",">",">",">","weak_labels","=","WeakMultiLabels","(","dataset=","''","my_dataset","''",")",">",">",">","weak_labels.matrix","(",")",">",">",">","weak_labels.summary","(",")",">",">",">",">",">",">","#","Get","the","3","dimensional","weak","label","matrix","from","rules","defined","in","Python",":",">",">",">","def","awesome_rule","(","record",":","TextClassificationRecord",")","-",">","str",":","...","return","[","``","Positive","''",",","``","Slang","''","]","if","``","next","level","''","in","record.text","else","None",">",">",">","another_rule","=","Rule","(","query=","''","amped","OR","psyched","''",",","label=","[","``","Positive","''",",","``","Slang","''","]",")",">",">",">","weak_labels","=","WeakMultiLabels","(","dataset=","''","my_dataset","''",",","rules=","[","awesome_rule",",","another_rule","]",")",">",">",">","weak_labels.matrix","(",")",">",">",">","weak_labels.summary","(",")"]
docstr: Shows records in a pandas DataFrame, optionally filtered by weak labels and non-abstaining rules.
  
  If you provide both ``labels`` and ``rules``, we take the intersection of both filters.
  
  Args:
      labels: All of these labels are in the record's weak labels. If None, do not filter by labels.
      rules: All of these rules did not abstain for the record. If None, do not filter by rules.
          You can refer to the rules by their (function) name or by their index in the ``self.rules`` list.
  
  Returns:
      The optionally filtered records as a pandas DataFrame.
docstr_tok: ["Shows","records","in","a","pandas","DataFrame",",","optionally","filtered","by","weak","labels","and","non-abstaining","rules",".","If","you","provide","both","``","labels","``","and","``","rules","``",",","we","take","the","intersection","of","both","filters",".","Args",":","labels",":","All","of","these","labels","are","in","the","record","'s","weak","labels",".","If","None",",","do","not","filter","by","labels",".","rules",":","All","of","these","rules","did","not","abstain","for","the","record",".","If","None",",","do","not","filter","by","rules",".","You","can","refer","to","the","rules","by","their","(","function",")","name","or","by","their","index","in","the","``","self.rules","``","list",".","Returns",":","The","optionally","filtered","records","as","a","pandas","DataFrame","."]
code: def show_records(
      self,
      labels: Optional[List[str]] = None,
      rules: Optional[List[Union[str, int]]] = None,
  ) -> pd.DataFrame:
      """Shows records in a pandas DataFrame, optionally filtered by weak labels and non-abstaining rules.
  
      If you provide both ``labels`` and ``rules``, we take the intersection of both filters.
  
      Args:
          labels: All of these labels are in the record's weak labels. If None, do not filter by labels.
          rules: All of these rules did not abstain for the record. If None, do not filter by rules.
              You can refer to the rules by their (function) name or by their index in the ``self.rules`` list.
  
      Returns:
          The optionally filtered records as a pandas DataFrame.
      """
      # get labels mask
      if labels is not None:
          labels = [self._labels.index(label) for label in labels]
          idx_by_labels = np.all(
              ((self.matrix() == 1).sum(1) > 0)[:, labels], axis=1
          )
      else:
          idx_by_labels = np.ones_like(self._records).astype(bool)
  
      # get rule mask
      if rules is not None:
          rules = [
              self._rules_name2index[rule]
              if isinstance(rule, str)
              else rule
              for rule in rules
          ]
          idx_by_rules = (
              self.matrix()[:, rules, :].sum(axis=2) >= 0
          ).sum(axis=1) == len(rules)
      else:
          idx_by_rules = np.ones_like(self._records).astype(bool)
  
      # apply mask
      filtered_records = np.array(self._records)[
          idx_by_labels & idx_by_rules
      ]
  
      return pd.DataFrame(map(lambda x: x.dict(), filtered_records))
  
imports: import warnings
  from collections import Counter
  from typing import Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  from tqdm.auto import tqdm
  from argilla import load
  from argilla.client.datasets import DatasetForTextClassification
  from argilla.client.models import TextClassificationRecord
  from argilla.labeling.text_classification.rule import Rule, load_rules
label_desc: Use image node_id 9 for calling the WeakMultiLabels obj's underlying member method code with example usage: obj.show_records(labels, rules) and returns: pd