text_plain_output_1.png
from  numpy import array, argmax, random, take

import matplotlib.pyplot as plt

import pandas as pd

def read_text(filename):
    file = open(filename, mode='rt', encoding='utf-8')
    text = file.read()
    file.close()
    return text

def to_lines(text):
    sents = text.strip().split('\n')
    sents = [i.split('\t') for i in sents]
    return sents

data = read_text('../input/german-to-english/deu.txt')
deu_eng = to_lines(data)
deu_eng = array(deu_eng)

deu_eng = deu_eng[:50000, :]

eng_l = []
deu_l = []
for i in deu_eng[:, 0]:
    eng_l.append(len(i.split()))
for i in deu_eng[:, 1]:
    deu_l.append(len(i.split()))

length_df = pd.DataFrame({'eng': eng_l, 'deu': deu_l})

length_df.hist(bins=30)
plt.show