<commit_before># xml-converter

A collection of small ruby scripts to convert [version 0.7](http://cricsheet.org/format/) [Cricsheet YAML data files](http://cricsheet.org/downloads/) into XML, and to allow validation of the XML against [the schema file (schema.xsd)](schema.xsd).

These scripts are used to generate the XML data available in the [Cricsheet XML project](https://github.com/cricsheet/cricsheet-xml).

## Installation

You can manage the dependencies using [Bundler](http://bundler.io/). Once you have it installed you can install the dependencies using:

```bash
$ bundle install
```

## Usage

`convert.rb` is a ruby script, which can be configured using command-line arguments. See `./convert.rb --help` for all available options.

`validate.rb` is also a ruby script, which cannot be configured. It simply takes a list of XML files to be validated against the schema, and outputs any errors it finds for each file.

## Examples

### Converting YAML to XML

In all of the examples that follow the resulting XML will be saved with with a `.xml` extension. For example, `foobar.yaml` will be converted to `foobar.xml`.

Convert a single YAML file, and save the resulting XML into the default output folder (`./tmp`).

```bash
$ ./convert.rb data.yaml
```

Convert the provided YAML files, and save the resulting XML into the default output folder (`./tmp`).

```bash
$ ./convert.rb *yaml
```

Convert the provided YAML files, and save the resulting XML into a specified folder.

```bash
$ ./convert.py -f some/other/folder 1.yaml 2.yaml
```

### Validating XML

Validate a single XML file against the schema.

```bash
$ ./validate.rb data.xml
```

Validate multiple XML files against the schema.

```bash
$ ./validate.rb data.xml other_data.xml
```

## Credits

Thanks to <NAME> for the initial version of the schema file, which I then extended. Without his efforts the XML version would never have happened.
<commit_msg>Fixed a typo in the README. covert.py -> covert.rb<commit_after># xml-converter

A collection of small ruby scripts to convert [version 0.7](http://cricsheet.org/format/) [Cricsheet YAML data files](http://cricsheet.org/downloads/) into XML, and to allow validation of the XML against [the schema file (schema.xsd)](schema.xsd).

These scripts are used to generate the XML data available in the [Cricsheet XML project](https://github.com/cricsheet/cricsheet-xml).

## Installation

You can manage the dependencies using [Bundler](http://bundler.io/). Once you have it installed you can install the dependencies using:

```bash
$ bundle install
```

## Usage

`convert.rb` is a ruby script, which can be configured using command-line arguments. See `./convert.rb --help` for all available options.

`validate.rb` is also a ruby script, which cannot be configured. It simply takes a list of XML files to be validated against the schema, and outputs any errors it finds for each file.

## Examples

### Converting YAML to XML

In all of the examples that follow the resulting XML will be saved with with a `.xml` extension. For example, `foobar.yaml` will be converted to `foobar.xml`.

Convert a single YAML file, and save the resulting XML into the default output folder (`./tmp`).

```bash
$ ./convert.rb data.yaml
```

Convert the provided YAML files, and save the resulting XML into the default output folder (`./tmp`).

```bash
$ ./convert.rb *yaml
```

Convert the provided YAML files, and save the resulting XML into a specified folder.

```bash
$ ./convert.rb -f some/other/folder 1.yaml 2.yaml
```

### Validating XML

Validate a single XML file against the schema.

```bash
$ ./validate.rb data.xml
```

Validate multiple XML files against the schema.

```bash
$ ./validate.rb data.xml other_data.xml
```

## Credits

Thanks to <NAME> for the initial version of the schema file, which I then extended. Without his efforts the XML version would never have happened.

{'fraction_non_alphanumeric': 0.10258378101816322, 'fraction_numerical': 0.0020465592223074956, 'mean_word_length': 4.058214747736093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '2028190', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1075, 'n_words': 527}