<commit_before>= ChessIcu

For reading or writing files of chess tournament data.


== Install

  sudo gem install chess_icu --source http://gemcutter.org

For Ruby prior to version 1.9 you also need:

  sudo gem install fastercsv
  
  
== Usage

There are two main uses for this gem:

* You have chess tournament data that needs to be written to a file in one of the supported formats.
  For example, your data is in a spreadsheet but you need it in Krause format so you can upload it to the FIDE rating server.

* You have a file in a supported format and you need to extract the information it contains.
  For example, you have a Krause formatted file and want to extract the data and insert it into a database.

The currently supported formats (more are planned) are:

* ICU::Tournament::Krause - the format used by FIDE.
* ICU::Tournament::ForeignCSV - used by Irish players to report their individual results in foreign tournaments.


== Writing Files

Here's how the 1972 Fischer-Spassky match could be formatted to Krause. First a tournament object is created
and the players (just two in this case) are added with unique ID numbers. To keep the example short, not all
the information that a Krause file might contain is included here (see ICU::Tournament::Krause for more details).

  t = ICU::Tournament.new('World Championship', '1972-07-11')
  t.add_player(ICU::Player.new('<NAME>.', 'Fischer', 1))
  t.add_player(ICU::Player.new('<NAME>.', 'Spassky', 2))

Then the results for each round are added using the ID numbers to refer the players.

  t.add_result(ICU::Result.new(1, 1, 'L', :opponent => 2, :colour => 'B'))

Read this as: in round 1, player 1 lost against opponent 2 with the black pieces.

  t.add_result(ICU::Result.new(2, 1, 'L', :opponent => 2, :colour => 'W', :rateable => false))
<commit_msg>Fixed another typo in README<commit_after>= ChessIcu

For reading or writing files of chess tournament data.


== Install

  sudo gem install chess_icu --source http://gemcutter.org

For Ruby prior to version 1.9 you also need:

  sudo gem install fastercsv
  
  
== Usage

There are two main uses for this gem:

* You have chess tournament data that needs to be written to a file in one of the supported formats.
  For example, your data is in a spreadsheet but you need it in Krause format so you can upload it to the FIDE rating server.

* You have a file in a supported format and you need to extract the information it contains.
  For example, you have a Krause formatted file and want to extract the data and insert it into a database.

The currently supported formats (more are planned) are:

* ICU::Tournament::Krause - the format used by FIDE.
* ICU::Tournament::ForeignCSV - used by Irish players to report their individual results in foreign tournaments.


== Writing Files

Here's how the 1972 Fischer-Spassky match could be formatted to Krause. First a tournament object is created
and the players (just two in this case) are added with unique ID numbers. To keep the example short, not all
the information that a Krause file might contain is included here (see ICU::Tournament::Krause for more details).

  t = ICU::Tournament.new('World Championship', '1972-07-11')
  t.add_player(ICU::Player.new('<NAME>.', 'Fischer', 1))
  t.add_player(ICU::Player.new('<NAME>.', 'Spassky', 2))

Then the results for each round are added using the ID numbers to refer to the players.

  t.add_result(ICU::Result.new(1, 1, 'L', :opponent => 2, :colour => 'B'))

Read this as: in round 1, player 1 lost against opponent 2 with the black pieces.

  t.add_result(ICU::Result.new(2, 1, 'L', :opponent => 2, :colour => 'W', :rateable => false))

{'fraction_non_alphanumeric': 0.08633879781420765, 'fraction_numerical': 0.01366120218579235, 'mean_word_length': 4.127450980392157, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2580817', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1019, 'n_words': 529}