import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

d=pd.read_csv("fra.txt",sep="\t",header=None,usecols=[0,1],names=["English","French"],nrows=50000)
d=d.dropna().drop_duplicates("English")
x=np.array(["Hello!","I know.","Thanks.","We won.","Who won?"])
t=d.set_index("English")["French"].to_dict()
y=np.array([t.get(s,"Translation unavailable") for s in x])
r=pd.DataFrame({"English":x,"French":y})
print(r.to_string(index=False))
fig,ax=plt.subplots(figsize=(10,3))
ax.axis("off")
ax.table(cellText=r.values,colLabels=r.columns,loc="center",cellLoc="center")
ax.set_title("English → French Machine Translation")
plt.show()