<commit_before>#!/usr/bin/env python

from extract_converter import ExtractConverter
import click


def convert(x):
    meta = {
        #meta['all'] = [w['item'] for w in x['result']['content']]
        'amalia': x['result']['Amalia_Json']
    }
    available_data = ['video_persons']
    return meta, available_data


@click.command()
@click.option('--reset', is_flag=True, help="reset data_available")
@click.option('--clean', is_flag=True, help="reset data_available and remove existing meta.source")
def run(reset, clean):
    conv = ExtractConverter('video_persons', convert)
    conv.run()

<commit_msg>preprocess: make Amalia optional<commit_after>#!/usr/bin/env python

from extract_converter import ExtractConverter
import click


def convert(x):
  available_data = ['video_persons']
  meta = {}
  try:
    meta['amalia'] = x['result']['Amalia_Json']
    available_data.append('video_persons-amalia')
  except Exception as e:
    print "no Amalia data:", e
  return meta, available_data


@click.command()
@click.option('--reset', is_flag=True, help="reset data_available")
@click.option('--clean', is_flag=True, help="reset data_available and remove existing meta.source")
def run(reset, clean):
    conv = ExtractConverter('video_persons', convert)
    conv.run()


{'fraction_non_alphanumeric': 0.1480031323414252, 'fraction_numerical': 0.0, 'mean_word_length': 4.916666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '7471037', 'n_tokens_mistral': 408, 'n_tokens_neox': 396, 'n_words': 96}