Question

I have a text file and want to rank entities by occurrences and output to a...

I have a text file and want to rank entities by occurrences and output to a text file in the following format:

e.g.

Bob TAB person TAB 120

Scotland TAB location TAB 105

George TAB person TAB 83

After this I want to rank the co-occurrence (in a sentence) of the top 10 entity pairs and write to a text file:

Bob TAB George TAB 20

Scotland TAB Bob TAB 15

etc...

How do I do this in python?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

file1 = open("MyFile.txt","a")

//Open a file using 'open'

L = ["Bob TAB person TAB 120 \n","Scotland TAB location TAB 105 \n","George TAB person TAB 83 \n"]

print "Output"

print file1.read()

print

Add a comment
Know the answer?
Add Answer to:
I have a text file and want to rank entities by occurrences and output to a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT