<commit_before>kekka
=====

Kekka is a thin ruby library on top of the XML format [ISAF XRR](http://www.sailing.org/xml) (XML Regatta Reporting). In its first version it takes care of parsing the XML and putting data in convenient hashes - it also manages the relations between different data sets. In future versions exports will be supported also.


Usage
-----

To get hold of it:

    require 'kekka'

To create a kekka:

    kekka = Kekka.parse open('/path/to/xrr')

The argument to parse can be exactly the same as what [nokogiris](http://nokogiri.org/) [parse method](http://nokogiri.org/Nokogiri/XML/Document.html#method-c-parse) accepts. A kekka is actually a Hash so it is possible to use all Hash methods on it and its parts. The resulting Hash is structured exactly as the XML. On the first level there are persons, boats, teams and events. Symbols are used to get collectionesque subparts. For example - to get to boats:

    kekka[:boats]

Elements that got an idea are put in a Hash with the id as key. So to get to the boat with id '9':

    kekka[:boats]['9']

Attributes are downcased (by nokogiri) and used as keys in the Hash for its instance. To get the sail number for a boat:

    kekka[:boats]['9']['sailnumber']

Events have a deeper structure inside. To get to races for the event with id '9':

    kekka[:events]['9'][:races]

To get the race status for the race with id '32':

    kekka[:events]['9'][:races]['32']['racestatus']

It is starting to get deep now and it is probably wise to split such a thing into parts.

    event = kekka[:events]['9']
    race = event[:races]['32']
    race['racestatus']

The event also have divisions that contains both race results and series results (the latter being the sum of race results for a team). Results does not have ids so they are represented with an array. You would probably want to get all results for a race in a division and could then do seomthing like:

    event = kekka[:events]['9']
    division = event[:divisions]['4711']
    division[:raceresults].select { |one_result| one_result['raceid'] == '32' }

Doing things like this easier may be added in future versions.


Copyright
---------

Copyright (c) 2012 <NAME>. See LICENSE.txt for further details.
<commit_msg>documentation about this last change<commit_after>kekka
=====

Kekka is a thin ruby library on top of the XML format [ISAF XRR](http://www.sailing.org/xml) (XML Regatta Reporting). In its first version it takes care of parsing the XML and putting data in convenient hashes - it also manages the relations between different data sets. In future versions exports will be supported also.


Usage
-----

To get hold of it:

    require 'kekka'

To create a kekka:

    kekka = Kekka.parse open('/path/to/xrr')

The argument to parse can be exactly the same as what [nokogiris](http://nokogiri.org/) [parse method](http://nokogiri.org/Nokogiri/XML/Document.html#method-c-parse) accepts. A kekka is actually a Hash so it is possible to use all Hash methods on it and its parts. The resulting Hash is structured exactly as the XML. On the first level there are persons, boats, teams and events. Symbols are used to get collectionesque subparts. For example - to get to boats:

    kekka[:boats]

Elements that got an idea are put in a Hash with the id as key. So to get to the boat with id '9':

    kekka[:boats]['9']

Attributes are downcased (by nokogiri) and used as keys in the Hash for its instance. To get the sail number for a boat:

    kekka[:boats]['9']['sailnumber']

Events have a deeper structure inside. To get to races for the event with id '9':

    kekka[:events]['9'][:races]

To get the race status for the race with id '32':

    kekka[:events]['9'][:races]['32']['racestatus']

It is starting to get deep now and it is probably wise to split such a thing into parts.

    event = kekka[:events]['9']
    race = event[:races]['32']
    race['racestatus']

The event also have divisions that contains both race results and series results (the latter being the sum of race results for a team). Results does not have ids so they are represented with an array. You would probably want to get all results for a race in a division and could then do seomthing like:

    event = kekka[:events]['9']
    division = event[:divisions]['4711']
    division[:raceresults].select { |one_result| one_result['raceid'] == '32' }

Doing things like this easier may be added in future versions.


Manipulation
------------

Kekka adds the field 'boatclass' to the boat based on the division that the boat raced in.


Copyright
---------

Copyright (c) 2012 <NAME>. See LICENSE.txt for further details.

{'fraction_non_alphanumeric': 0.0952073930797335, 'fraction_numerical': 0.010315925209542231, 'mean_word_length': 3.7489795918367346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '2511847', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1312, 'n_words': 668}