<commit_before>#!/usr/bin/env python
#-*- coding: utf-8 -*-

"""
transcoder_web provides a web interface for three transcoders
"""
# @author chengdujin
# @contact <EMAIL>
# @created Aug. 10, 2013


import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('../..')

import web
from data_processor import transcoder

render = web.template.render('templates/')
urls = (
    "/transcode", "Transcoders"
)


class Transcoders:

    def GET(self):
        data = web.input(url="this should not be seen", language='no language')
        return self._transcode(data.language, data.url)

    def _transcode(self, language, url):
        """
        call each transcoder
        """
        title_simplr, content_simplr = transcoder.convert(
            language=language, link=url, transcoder='chengdujin', stdout=True)
        title_burify, content_burify = transcoder.convert(
            language=language, link=url, transcoder='readability', stdout=True)
        title_uck, content_uck = transcoder.convert(
            language=language, link=url, transcoder='uck', stdout=True)
        return render.combiner(title_simplr, content_simplr, \
                title_burify, content_burify, title_uck, content_uck, \
                'Original Webpage')


if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()
<commit_msg>autopep8ed<commit_after>#!/usr/bin/env python
#-*- coding: utf-8 -*-

"""
transcoder_web provides a web interface for three transcoders
"""
# @author chengdujin
# @contact <EMAIL>
# @created Aug. 10, 2013


import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('../..')

import web
from data_processor import transcoder

render = web.template.render('templates/')
urls = (
    "/transcode", "Transcoders"
)


class Transcoders:

    """
    Class to call different transcoders
    """

    def __init__(self):
        pass

    def GET(self):
        data = web.input(url="this should not be seen", language='no language')
        return self._transcode(data.language, data.url)

    def _transcode(self, language, url):
        """
        call each transcoder
        """
        title_simplr, content_simplr = transcoder.convert(
            language=language, link=url, transcoder='chengdujin', stdout=True)
        title_burify, content_burify = transcoder.convert(
            language=language, link=url, transcoder='readability', stdout=True)
        title_uck, content_uck = transcoder.convert(
            language=language, link=url, transcoder='uck', stdout=True)
        return render.combiner(title_simplr, content_simplr,
                               title_burify, content_burify, title_uck, content_uck,
                               'Original Webpage')


if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()

{'fraction_non_alphanumeric': 0.12314749470712774, 'fraction_numerical': 0.005998588567395907, 'mean_word_length': 3.021276595744681, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '3826602', 'n_tokens_mistral': 891, 'n_tokens_neox': 856, 'n_words': 198}