<commit_before># stweam

[![Build Status](https://travis-ci.org/tanem/stweam.png?branch=master)](https://travis-ci.org/tanem/stweam)
[![Coverage Status](https://coveralls.io/repos/tanem/stweam/badge.png?branch=master)](https://coveralls.io/r/tanem/stweam?branch=master)
[![NPM version](https://badge.fury.io/js/stweam.svg)](http://badge.fury.io/js/stweam)

A module that connects to the public Twitter stream, returning statuses for tracked keywords.

## Requirements

 * Node.js version 0.11.x (for the `harmony` flag which exposes generators)
 * Keys obtained from dev.twitter.com after [setting up a new app](https://apps.twitter.com/app/new)

## Installation

```sh
$ npm install stweam --save
```

## Example

```js
// => example.js

var Stweam = require('stweam');

var stweam = new Stweam({
  consumerKey: 'consumerKey',
  consumerSecret: 'consumerSecret',
  token: 'token',
  tokenSecret: 'tokenSecret'
});

stweam.on('info', function(msg){
  // Do something with the log msg.
});

stweam.on('tweet', function(tweet){
  // Do something with the tweet.  
});

stweam.track('beaker');
```

To run:

```sh
$ node --harmony example.js
```

## API

### new Stweam(opts:Object)

Initialise a new `Stweam` with the given `opts`.

`opts` should contain:

 * consumerKey
 * consumerSecret
 * token
 * tokenSecret

### Stweam#track(keywords:String)

Sets the phrases that will determine what is delivered on the stream,
then starts the app or reconnects if there was already an existing connection.

Note that the default [language](https://dev.twitter.com/docs/streaming-apis/parameters#language) is `en`.

## Events

### tweet

Emitted each time tweet text is written to `Stweam`.

### info

Emitted to provide detail about regular operation.
<commit_msg>Update docs<commit_after># stweam

[![Build Status](https://travis-ci.org/tanem/stweam.png?branch=master)](https://travis-ci.org/tanem/stweam)
[![Coverage Status](https://coveralls.io/repos/tanem/stweam/badge.png?branch=master)](https://coveralls.io/r/tanem/stweam?branch=master)
[![NPM version](https://badge.fury.io/js/stweam.svg)](http://badge.fury.io/js/stweam)

A module that connects to the public Twitter stream, returning statuses for tracked keywords.

## Requirements

 * Node.js version 0.11.x (for the `harmony` flag which exposes generators)
 * Keys obtained from dev.twitter.com after [setting up a new app](https://apps.twitter.com/app/new)

## Installation

```sh
$ npm install stweam --save
```

## Example

```js
// => example.js

var Stweam = require('stweam');

var stweam = new Stweam({
  consumerKey: 'consumerKey',
  consumerSecret: 'consumerSecret',
  token: 'token',
  tokenSecret: 'tokenSecret'
});

stweam.on('info', function(msg){
  // Do something with the log msg.
});

stweam.on('tweet', function(tweet){
  // Do something with the tweet.  
});

stweam.track('beaker');
```

To run:

```sh
$ node --harmony example.js
```

## API

### var stweam = new Stweam(opts)

Initialise a new `Stweam` with the given `opts`.

`opts` should contain:

 * consumerKey
 * consumerSecret
 * token
 * tokenSecret

### stweam.track(keywords)

Sets the phrases that will determine what is delivered on the stream,
then starts the app or reconnects if there was already an existing connection.

Note that the default [language](https://dev.twitter.com/docs/streaming-apis/parameters#language) is `en`.

## Events

### stweam.on('tweet', function(tweet){})

Emitted each time tweet text is written to `Stweam`.

### stweam.on('info', function(msg){})

Provides detail about regular operation, rather than spamming stdout.

{'fraction_non_alphanumeric': 0.15217391304347827, 'fraction_numerical': 0.0016722408026755853, 'mean_word_length': 4.53858024691358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 14, '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': '434441', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1201, 'n_words': 325}