Skip to content

Commit

Permalink
Summarized only weighted frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
caramelWaffle committed May 19, 2019
1 parent e09f225 commit a20a908
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 9 additions & 4 deletions TextSummarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

# Read comment from CSV file
path = 'C:\\Users\\Tanachart\\Desktop\\dataset\\'
filename = "12_Cyprus.csv"
csvdf = pd.read_csv(path + filename, header=None)
article_text = ' '.join(csvdf[0])
filename = "1_Population.csv"
dataset = pd.read_csv(path + filename, header=None)
article_text = ' '.join(dataset[0])

# Removing Square Brackets and Extra Spaces
article_text = re.sub(r'\[[0-9]*\]', ' ', article_text)
Expand Down Expand Up @@ -56,7 +56,12 @@
numberOfLine = round(len(nltk.word_tokenize(formatted_article_text)) / 100)
if numberOfLine > 3:
numberOfLine = 3
summary_sentences = heapq.nlargest(3, sentence_scores, key=sentence_scores.get)
summary_sentences = heapq.nlargest(4, sentence_scores, key=sentence_scores.get)

# key = list(sentence_scores.keys())
# print(key[0])
# print(sentence_scores.keys())
# print(word_frequencies.keys())

print(filename)
print("========== ORIGINAL SENTENCES ==========")
Expand Down
6 changes: 3 additions & 3 deletions summarized_comment.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ Number of sentences : 3

11_JapanPassport.csv
========== ORIGINAL SENTENCES ==========
['First of all, Japanese people are so accustomed to their own culture that living overseas would be rather uncomfortable.', 'This would apply to food and entertainment to generalise.', 'Second of all, Japanese are rich and would like to make business.', 'They go to other countries for travel or making trade.', 'They don’t have to stay at other countries illegally.', 'I guess that is the reason they are considered as welcomed and harmless by many governments.', 'Meanwhile, passport issue is a bilateral thing.', 'To some extent it means Japan would like to give many other countries passports the same convenient.', 'I knew the feeling of holding the most powerful passport on earth very well, I went to a country in the north Africa with my friend from Japan and we stayed there for more than two months.', "While staying there I couldn't travel to any other country while my Japanese friend could just book flight tickets and goes anywhere he want.", 'I was so jealous of him, which every country could have the freedom to travel liken the japanese Oh my god!', 'I have just known that the strongest passport is actually from a country in Asia — Japan.', 'Firstly, I though it might be any country from Europe like maybe France, the United Kingdom or the Netherlands since UK and France have colonised countless amount of country during the colonisation era, so there might be some connections remains between those countries.', 'what i got from japaness culture is that they are working really hard and they take every thing so hard, from education, working in office and even life, so they really are working to have in impact in whole world market in term of technology but they also want to have an impact in whole world in term of politics.', 'so when they are working so hard its good to see such thing and is expected from such country.', 'I think the Japanese people do not really stay abroad for a long time even though the travelling.', 'So in my opinion, they familiar with their own culture.', 'They may feel uncomfortable if they do not stay at their own home.', 'They concern about the visa period rather than stay illegal.', "Hence, the foreign affairs offices grant visa free access to their countries to the Japanese I think because Japanese people don't want to live anywhere else in general as the country, and the general public is relatively well off.", 'Japanese people are so accustomed to their own culture that living overseas would be rather uncomfortable.', 'This would apply to food and entertainment to generalise.', 'The Japanese government have been extending a lot of financial aids to developing countries from the 70s until lately.', 'Unlike the US, Japanese Government do not have any relationship problem with the Muslim countries.', 'With these facts combined, Japanese people are trusted to go back to their country, rather than staying illegally.', 'Hence, the foreign affairs offices grant visa free access to their countries to the Japanese.']
Number of words : 504
['First of all, Japanese people are so accustomed to their own culture that living overseas would be rather uncomfortable.', 'This would apply to food and entertainment to generalise.', 'Second of all, Japanese are rich and would like to make business.', 'They go to other countries for travel or making trade.', 'They don’t have to stay at other countries illegally.', 'I guess that is the reason they are considered as welcomed and harmless by many governments.', 'Meanwhile, passport issue is a bilateral thing.', 'To some extent it means Japan would like to give many other countries passports the same convenient.', 'I knew the feeling of holding the most powerful passport on earth very well, I went to a country in the north Africa with my friend from Japan and we stayed there for more than two months.', "While staying there I couldn't travel to any other country while my Japanese friend could just book flight tickets and goes anywhere he want.", 'I was so jealous of him, which every country could have the freedom to travel liken the japanese Oh my god!', 'I have just known that the strongest passport is actually from a country in Asia — Japan.', 'Firstly, I though it might be any country from Europe like maybe France, the United Kingdom or the Netherlands since UK and France have colonised countless amount of country during the colonisation era, so there might be some connections remains between those countries.', 'what i got from japaness culture is that they are working really hard and they take every thing so hard, from education, working in office and even life, so they really are working to have in impact in whole world market in term of technology but they also want to have an impact in whole world in term of politics.', 'so when they are working so hard its good to see such thing and is expected from such country.', 'I think the Japanese people do not really stay abroad for a long time even though the travelling.', 'So in my opinion, they familiar with their own culture.', 'They may feel uncomfortable if they do not stay at their own home.', 'They concern about the visa period rather than stay illegal.', 'Hence, the foreign affairs offices grant visa free access to their countries to the Japanese']
Number of words : 387
========== SUMMARY SENTENCES ==========
While staying there I couldn't travel to any other country while my Japanese friend could just book flight tickets and goes anywhere he want. First of all, Japanese people are so accustomed to their own culture that living overseas would be rather uncomfortable. Japanese people are so accustomed to their own culture that living overseas would be rather uncomfortable.
While staying there I couldn't travel to any other country while my Japanese friend could just book flight tickets and goes anywhere he want. so when they are working so hard its good to see such thing and is expected from such country. To some extent it means Japan would like to give many other countries passports the same convenient.
Number of sentences : 3

12_Cyprus.csv
Expand Down

0 comments on commit a20a908

Please sign in to comment.