<commit_before>Skadi
=====

Skadi parses [Dota 2](http://www.dota2.com) replay files.

**This project is in its early stages, and things are subject to change without much notice. Consequently, Skadi is best used for development purposes at this time. For up-to-date information, join #dota2replay on Quakenet IRC.**


The Wiki
========

I hereby resolve that the Wiki pages of this repository will not suck. In them, you will find as much information as I have time to type. Start [here](https://github.com/onethirtyfive/skadi/wiki/Skadi:-More-Than-You-Ever-Wanted-to-Know).

Be sure to check out the "Pages" section.


In a Hurry?
===========

To parse replay data, you'll need a `Demo`:

```python
from skadi.replay import demo as rd
import io

with io.open('123123123.dem', 'r+b') as infile:
  demo = rd.construct(infile)

  # And then you'll ask it for a `stream`:
  stream = demo.stream(tick=12345) # tick arg optional, defaults to 0

  # And iterate over each tick:
  for tick, string_tables, world in stream:

    # world contains information about all the entities:
    for ehandle, state in world:
      # an ehandle is a replay-wide unique identifier for an entity
      # the state is just a plain old hash of keys and values
      print ehandle, len(state)
```

Each key in the state is a two-item tuple:

    (property origin, property name)

To uniquely identify a piece of state, you need both of these bits of info. This is because entity classes are part of an elaborate hierarchy--they inherit properties from parent, all the way up to their `baseclass`. Investigate the state. The property names should make sense. Play with the values you get from the keys and you'll start discovering a wealth of game data.

If you encounter a property name with the prefix 'm_h', or if the name indicates something relational, you might have found an `ehandle`. You can ask the `world` for an entity by ehandle with the method `find`. It will return that entity's state. With this, you can relate entities to one another--the data does that a lot!


Dependencies
============

Über-hacker @Noxville points out a helpful way of installing everything in Ubuntu:
<commit_msg>readme update<commit_after>Skadi
=====

Skadi parses [Dota 2](http://www.dota2.com) replay files.

**This project is in its early stages, and things are subject to change without much notice. Consequently, Skadi is best used for development purposes at this time. For up-to-date information, join #dota2replay on Quakenet IRC.**


The Wiki
========

I hereby resolve that the Wiki pages of this repository will not suck. In them, you will find as much information as I have time to type. Start [here](https://github.com/onethirtyfive/skadi/wiki/Skadi:-More-Than-You-Ever-Wanted-to-Know).

Be sure to check out the "Pages" section.


In a Hurry?
===========

Check out some simple usage in [bin/skadi](https://github.com/onethirtyfive/skadi/blob/master/bin/skadi).

Each key in the state is a two-item tuple:

    (property origin, property name)

To uniquely identify a piece of state, you need both of these bits of info. This is because entity classes are part of an elaborate hierarchy--they inherit properties from parent, all the way up to their `baseclass`. Investigate the state. The property names should make sense. Play with the values you get from the keys and you'll start discovering a wealth of game data.

If you encounter a property name with the prefix 'm_h', or if the name indicates something relational, you might have found an `ehandle`. You can ask the `world` for an entity by ehandle with the method `find`. It will return that entity's state. With this, you can relate entities to one another--the data does that a lot!


Dependencies
============

Über-hacker @Noxville points out a helpful way of installing everything in Ubuntu:

{'fraction_non_alphanumeric': 0.08498435870698644, 'fraction_numerical': 0.005474452554744526, 'mean_word_length': 4.062005277044855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, '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': '271927', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1022, 'n_words': 558}