<commit_before>package com.thaiopensource.relaxng;

import java.util.Vector;
import java.util.Hashtable;
import java.io.PrintWriter;
import java.io.OutputStream;

import org.relaxng.datatype.Datatype;

public class PatternDumper {
  private boolean startTagOpen = false;
  private Vector tagStack = new Vector();
  private PrintWriter writer;
  private int level = 0;
  private boolean suppressIndent = false;
  private Vector patternList = new Vector();
  private Hashtable patternTable = new Hashtable();

  PatternVisitor patternVisitor = new DumpPatternVisitor();
  PatternVisitor sequencePatternVisitor = new SequenceDumpPatternVisitor();
  PatternVisitor choicePatternVisitor = new ChoiceDumpPatternVisitor();
  PatternVisitor interleavePatternVisitor = new InterleaveDumpPatternVisitor();
  NameClassVisitor nameClassVisitor = new DumpNameClassVisitor();
  NameClassVisitor choiceNameClassVisitor = new ChoiceDumpNameClassVisitor();
  NameClassVisitor differenceNameClassVisitor = new DifferenceDumpNameClassVisitor();

  static public void dump(PrintWriter writer, Pattern p) {
    new PatternDumper(writer).dump(p);
  }

  static public void dump(OutputStream out, Pattern p) {
    new PatternDumper(new PrintWriter(out)).dump(p);
  }

  PatternDumper(PrintWriter writer) {
    this.writer = writer;
  }

  void dump(Pattern p) {
    write("<?xml version=\"1.0\"?>");
    startElement("grammar");
    attribute("xmlns", PatternReader.relaxngURI);<commit_msg>Fix reference to relaxngURI.<commit_after>package com.thaiopensource.relaxng;

import java.util.Vector;
import java.util.Hashtable;
import java.io.PrintWriter;
import java.io.OutputStream;

import org.relaxng.datatype.Datatype;

public class PatternDumper {
  private boolean startTagOpen = false;
  private Vector tagStack = new Vector();
  private PrintWriter writer;
  private int level = 0;
  private boolean suppressIndent = false;
  private Vector patternList = new Vector();
  private Hashtable patternTable = new Hashtable();

  PatternVisitor patternVisitor = new DumpPatternVisitor();
  PatternVisitor sequencePatternVisitor = new SequenceDumpPatternVisitor();
  PatternVisitor choicePatternVisitor = new ChoiceDumpPatternVisitor();
  PatternVisitor interleavePatternVisitor = new InterleaveDumpPatternVisitor();
  NameClassVisitor nameClassVisitor = new DumpNameClassVisitor();
  NameClassVisitor choiceNameClassVisitor = new ChoiceDumpNameClassVisitor();
  NameClassVisitor differenceNameClassVisitor = new DifferenceDumpNameClassVisitor();

  static public void dump(PrintWriter writer, Pattern p) {
    new PatternDumper(writer).dump(p);
  }

  static public void dump(OutputStream out, Pattern p) {
    new PatternDumper(new PrintWriter(out)).dump(p);
  }

  PatternDumper(PrintWriter writer) {
    this.writer = writer;
  }

  void dump(Pattern p) {
    write("<?xml version=\"1.0\"?>");
    startElement("grammar");
    attribute("xmlns", PatternReader.relaxng10URI);
{'fraction_non_alphanumeric': 0.0891223314130803, 'fraction_numerical': 0.0027109454422229754, 'mean_word_length': 5.663656884875847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 2, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '7242951', 'n_tokens_mistral': 810, 'n_tokens_neox': 788, 'n_words': 210}