0
Readlines and Open
Hey guys! I have read the file anglizismen.txt with the python function open.How can I insert the anglicisms into an empty frequency table? Next step I should open another file : europarl.de-en with the python function open. But it didn’t work out ... this file I Must iterate line by line with python function readlines over the file. In the end I must check for each word of each line whether it is listed in the anglicisms frequency table . If it is so I must increase the number of occurrences of this anglicisms by one to collected for each anglicism the frequency of occurrence in the corpus . I don’t have any idea how I should start https://code.sololearn.com/c5z4cxpm8QR8/?ref=app
2 odpowiedzi
0
Not sure what you mean by "frequency table", I can only assume you mean a list...so..
how about something like this to start:-
f = open("test.txt", "r")
mylist = f.read().split()
print(mylist)
Why are you doing it line by line, is there a reason you have to it that way?
0
Here's a start...three more line of code and.... it's done...(If I understand what your trying to do).
frequency = []
anglizismen = open("anglizismen.txt", "r").read().split()
europarl_de_en = open("europarl.de-en.txt", "r").read()