<commit_before>#! /usr/bin/python
import os
from os.path import join
from os import path
from subprocess import call, Popen

DIR = path.dirname(path.realpath(__file__))

try:
    # update and upgrade all packages
    call('sudo apt-get update -y'.split())
    call('sudo apt-get upgrade -y'.split())
    # install java
    call('sudo apt-get install curl openjdk-7-jre-headless -y'.split())
except OSError:
    # if apt isn't installed, need to run yum commands
    pass

#install elastic search
if 'elasticsearch-1.0.0.tar.gz' not in os.listdir(DIR):
    call(['wget', 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.0.tar.gz'])
    call(['tar', '-xvzf', join(DIR, 'elasticsearch-1.0.0.tar.gz')])

    # install git river
    call('bin/plugin --install com.bazoud.elasticsearch/elasticsearch-river-git/0.0.2'.split())

# start elasticsearch
Popen(join(DIR, 'elasticsearch-1.0.0/bin/elasticsearch'))<commit_msg>fixed git river<commit_after>#! /usr/bin/python
import os
from os.path import join
from os import path
from subprocess import call, Popen

DIR = path.dirname(path.realpath(__file__))

try:
    # update and upgrade all packages
    call('sudo apt-get update -y'.split())
    call('sudo apt-get upgrade -y'.split())
    # install java
    call('sudo apt-get install curl openjdk-7-jre-headless -y'.split())
except OSError:
    # if apt isn't installed, need to run yum commands
    pass

#install elastic search
if 'elasticsearch-1.0.0.tar.gz' not in os.listdir(DIR):
    call(['wget', 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.0.tar.gz'])
    call(['tar', '-xvzf', join(DIR, 'elasticsearch-1.0.0.tar.gz')])

    # install git river
    call([join(DIR, 'elasticsearch-1.0.0/bin/plugin')] + '--install com.bazoud.elasticsearch/elasticsearch-river-git/0.0.2'.split())

# start elasticsearch
Popen(join(DIR, 'elasticsearch-1.0.0/bin/elasticsearch'))
{'fraction_non_alphanumeric': 0.15241057542768274, 'fraction_numerical': 0.018144116122343183, 'mean_word_length': 3.961439588688946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1619928', 'n_tokens_mistral': 648, 'n_tokens_neox': 652, 'n_words': 156}