<commit_before># Arff
An Arff generator written in Pharo.

Arff is a format defined by [Weka](http://www.cs.waikato.ac.nz/ml/weka/) to be used for data importation.
This project implements a representation of weka's arff concepts as objects in Pharo  and is able to generate valid arff strings.

See [Arff file spec](https://weka.wikispaces.com/ARFF) to learn more about this format.

## Install
~~~
Metacello new
    baseline: 'Arff';
    repository: 'github://juliendelplanque/Arff/repository';
    load
~~~

## Use this project as a dependency
Simply add this code snippet to your baseline:
~~~
spec baseline: 'Arff' with: [
    spec repository: 'github://juliendelplanque/Arff/repository' ].
~~~

## Example
The following code:
~~~
doc := ArffDocument new.
doc
    relation: 'temperature';
    addDateAttribute: 'time' format: 'yyyy-MM-dd HH:mm:ss';
    addNumericAttribute: 'temperature';
    addNominalAttribute: 'weather' specification: #('sunny' 'cloudy').

doc
    addInstance: #('2015-01-01 12:00:00' 5  'sunny');
    addInstance: #('2015-02-01 18:40:00' 8  'sunny');
    addInstance: #('2015-03-01 05:04:00' 3  'cloudy');
    addInstance: #('2015-04-01 13:01:20' 15 'cloudy');
    addInstance: #('2015-05-01 09:07:00' 12  'sunny');
    addInstance: #('2015-06-01 12:20:00' 6  'cloudy').

doc asString
~~~

Generates the arff string:
~~~
@relation temperature
@attribute time date "yyyy-MM-dd HH:mm:ss"
@attribute temperature numeric
@attribute weather {sunny,cloudy}
@data
"2015-01-01 12:00:00",5,"sunny"
"2015-02-01 18:40:00",8,"sunny"
"2015-03-01 05:04:00",3,"cloudy"
"2015-04-01 13:01:20",15,"cloudy"
"2015-05-01 09:07:00",12,"sunny"
"2015-06-01 12:20:00",6,"cloudy"
~~~

## TODO
- Add messages in ArffDocument to make the DSL simpler.
- Manage real Date object in ArffDateAttribute (for now string are used).
- Add an object to represent '?' (missing data) for now, the character $? is used.
- Add possibility to add comment in an ArffDocument.

Pull requests are welcome. :)
<commit_msg>Updated README.<commit_after># Arff
An Arff generator written in Pharo.

Arff is a format defined by [Weka](http://www.cs.waikato.ac.nz/ml/weka/) to be used for data importation.
This project implements a representation of weka's arff concepts as objects in Pharo  and is able to generate valid arff strings.

See [Arff file spec](https://weka.wikispaces.com/ARFF) to learn more about this format.

## Install
~~~
Metacello new
    baseline: 'Arff';
    repository: 'github://juliendelplanque/Arff/repository';
    load
~~~

## Use this project as a dependency
Simply add this code snippet to your baseline:
~~~
spec baseline: 'Arff' with: [
    spec repository: 'github://juliendelplanque/Arff/repository' ].
~~~

## Example
The following code:
~~~
doc := ArffDocument new.
doc
    relation: 'temperature';
    addDateAttribute: 'time' format: 'yyyy-MM-dd HH:mm:ss';
    addNumericAttribute: 'temperature';
    addNominalAttribute: 'weather' specification: #('sunny' 'cloudy').

doc
    addInstance: #('2015-01-01 12:00:00' 5  'sunny');
    addInstance: #('2015-02-01 18:40:00' 8  'sunny');
    addInstance: #('2015-03-01 05:04:00' 3  'cloudy');
    addInstance: #('2015-04-01 13:01:20' 15 'cloudy');
    addInstance: #('2015-05-01 09:07:00' 12  'sunny');
    addInstance: #('2015-06-01 12:20:00' 6  'cloudy').

doc asString
~~~

Generates the arff string:
~~~
@relation temperature
@attribute time date "yyyy-MM-dd HH:mm:ss"
@attribute temperature numeric
@attribute weather {sunny,cloudy}
@data
"2015-01-01 12:00:00",5,"sunny"
"2015-02-01 18:40:00",8,"sunny"
"2015-03-01 05:04:00",3,"cloudy"
"2015-04-01 13:01:20",15,"cloudy"
"2015-05-01 09:07:00",12,"sunny"
"2015-06-01 12:20:00",6,"cloudy"
~~~

## TODO
- Add messages in ArffDocument to make the DSL simpler.
- Add an object to represent '?' (missing data) for now, the character $? is used.
- Add possibility to add comment in an ArffDocument.

Pull requests are welcome. :)

{'fraction_non_alphanumeric': 0.15327910523640062, 'fraction_numerical': 0.09354346720894764, 'mean_word_length': 4.35374149659864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5542409', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1373, 'n_words': 414}