码迷,mamicode.com
首页 > 其他好文 > 详细

词频统计

时间:2018-03-26 22:35:56      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:remember   key   sep   cannot   min   hal   compare   HERE   from   

news = """Leaving school is not a long time, but what I felt is so much. I find I’m enrolled in another full-time school called "life". Each day in this school I will have the opportunity to learn lessons. I may like the lessons or hate them, but I have designed them as part of my curriculum. Why am I here? What is my purpose? Humans being have sought to discover the meaning of life for a very long time. What we and our ancestors have overlooked, however, there is no one can answer. The meaning of life is different for every individual. Each person has his or her own purpose and distinct or unique path, separate from anyone else‘s. As we travel our life path, we will be presented with numerous lessons that we will need to learn in order to fulfill that purpose. The lessons we presented with are specific to us; learning these lessons is the key to discovering and fulfilling the meaning of and relevance to our own life. As we travel through our lifetime, we may encounter challenging lessons that others don‘t have to face, while other spends years struggling with challenges that we don‘t need to deal with. Some of our friends may never know why we suffer through great uncomfortable and painful experience while they are blessed with a wonderful happiness, just as we cannot be sure why we struggle financially while our peers enjoy abundance. The only thing we can count on, for a certain, is that we will be presented with all the lessons that we specifically need to learn; whether we choose to learn them or not is entirely up to us. The challenge here, therefore, is to align ourselves with our own unique path by learning individual lessons. This is one of the most difficult challenges we have to face in our lifetime, as sometimes our path will be radically different from others. But, remember, don‘t compare our path to the people around us and focus on the disparity between their lessons and ours. We also need to remember that maybe we only need to face with lessons that we are capable of learning and are specific to our own growth. This process may not be easy, but the rewards are well worth the struggle. That’ why I insist on my way even though it is difficult and uncomfortable I suffered. No matter how difficult it is, don‘t give up. Please try your best to solve the problems. Sometimes you will need to release all of your stress in different way that can make you feel better. Release in a good way. Life is the most challenging in the world that can motivate or stimulate you. Never mind! Life is challenging, but it is not so terrible. No matter how difficult the problem is, if we go forward step by step in a right direction, try to solve it step by step. I’m sure that the problem will be worked out. So, let’s work together in strive, to reach our goal, make our dreams come true. Tomorrow should be a better day, will be our day"""
Leaving school is not a long time  but what I felt is so much  I find I m enrolled in another full-time school called  life   Each day in this school I will have the opportunity to learn lessons  I may like the lessons or hate them  but I have designed them as part of my curriculum  Why am I here  What is my purpose  Humans being have sought to discover the meaning of life for a very long time  What we and our ancestors have overlooked  however  there is no one can answer  The meaning of life is different for every individual  Each person has his or her own purpose and distinct or unique path  separate from anyone else s  As we travel our life path  we will be presented with numerous lessons that we will need to learn in order to fulfill that purpose  The lessons we presented with are specific to us; learning these lessons is the key to discovering and fulfilling the meaning of and relevance to our own life  As we travel through our lifetime  we may encounter challenging lessons that others don t have to face  while other spends years struggling with challenges that we don t need to deal with  Some of our friends may never know why we suffer through great uncomfortable and painful experience while they are blessed with a wonderful happiness  just as we cannot be sure why we struggle financially while our peers enjoy abundance  The only thing we can count on  for a certain  is that we will be presented with all the lessons that we specifically need to learn; whether we choose to learn them or not is entirely up to us  The challenge here  therefore  is to align ourselves with our own unique path by learning individual lessons  This is one of the most difficult challenges we have to face in our lifetime  as sometimes our path will be radically different from others  But  remember  don t compare our path to the people around us and focus on the disparity between their lessons and ours  We also need to remember that maybe we only need to face with lessons that we are capable of learning and are specific to our own growth  This process may not be easy  but the rewards are well worth the struggle  That  why I insist on my way even though it is difficult and uncomfortable I suffered  No matter how difficult it is  don t give up  Please try your best to solve the problems  Sometimes you will need to release all of your stress in different way that can make you feel better  Release in a good way  Life is the most challenging in the world that can motivate or stimulate you  Never mind! Life is challenging  but it is not so terrible  No matter how difficult the problem is  if we go forward step by step in a right direction  try to solve it step by step  I m sure that the problem will be worked out  So  let s work together in strive  to reach our goal  make our dreams come true  Tomorrow should be a better day  will be our day

  

news = news.lower()
newList1 = news.split(" ")
dict={}
>>> for i in newList1:
	dict[i]=newList1.count(i)
 dictList = list(item.items())
dictList.sort(key= lambda x:x[1],reverse=True)
 
[(‘‘, 58), (‘to‘, 22), (‘the‘, 20), (‘we‘, 20), (‘is‘, 16), (‘our‘, 14), (‘that‘, 12), (‘i‘, 10), (‘lessons‘, 10), (‘in‘, 9), (‘and‘, 9), (‘will‘, 8), (‘of‘, 8), (‘be‘, 8), (‘with‘, 8), (‘a‘, 7), (‘life‘, 7), (‘have‘, 6), (‘need‘, 6), (‘but‘, 5), (‘or‘, 5), (‘as‘, 5), (‘path‘, 5), (‘are‘, 5), (‘not‘, 4), (‘may‘, 4), (‘why‘, 4), (‘can‘, 4), (‘own‘, 4), (‘don‘, 4), (‘t‘, 4), (‘difficult‘, 4), (‘it‘, 4), (‘step‘, 4), (‘school‘, 3), (‘what‘, 3), (‘so‘, 3), (‘day‘, 3), (‘this‘, 3), (‘learn‘, 3), (‘them‘, 3), (‘my‘, 3), (‘purpose‘, 3), (‘meaning‘, 3), (‘for‘, 3), (‘no‘, 3), (‘different‘, 3), (‘presented‘, 3), (‘learning‘, 3), (‘challenging‘, 3), (‘face‘, 3), (‘while‘, 3), (‘on‘, 3), (‘by‘, 3), (‘way‘, 3), (‘you‘, 3), (‘long‘, 2), (‘time‘, 2), (‘m‘, 2), (‘each‘, 2), (‘here‘, 2), (‘one‘, 2), (‘individual‘, 2), (‘unique‘, 2), (‘from‘, 2), (‘s‘, 2), (‘travel‘, 2), (‘specific‘, 2), (‘through‘, 2), (‘lifetime‘, 2), (‘others‘, 2), (‘challenges‘, 2), (‘never‘, 2), (‘uncomfortable‘, 2), (‘sure‘, 2), (‘struggle‘, 2), (‘only‘, 2), (‘all‘, 2), (‘up‘, 2), (‘us‘, 2), (‘most‘, 2), (‘sometimes‘, 2), (‘remember‘, 2), (‘matter‘, 2), (‘how‘, 2), (‘try‘, 2), (‘your‘, 2), (‘solve‘, 2), (‘release‘, 2), (‘make‘, 2), (‘better‘, 2), (‘problem‘, 2), (‘leaving‘, 1), (‘felt‘, 1), (‘much‘, 1), (‘find‘, 1), (‘enrolled‘, 1), (‘another‘, 1), (‘full-time‘, 1), (‘called‘, 1), (‘opportunity‘, 1), (‘like‘, 1), (‘hate‘, 1), (‘designed‘, 1), (‘part‘, 1), (‘curriculum‘, 1), (‘am‘, 1), (‘humans‘, 1), (‘being‘, 1), (‘sought‘, 1), (‘discover‘, 1), (‘very‘, 1), (‘ancestors‘, 1), (‘overlooked‘, 1), (‘however‘, 1), (‘there‘, 1), (‘answer‘, 1), (‘every‘, 1), (‘person‘, 1), (‘has‘, 1), (‘his‘, 1), (‘her‘, 1), (‘distinct‘, 1), (‘separate‘, 1), (‘anyone‘, 1), (‘else‘, 1), (‘numerous‘, 1), (‘order‘, 1), (‘fulfill‘, 1), (‘us;‘, 1), (‘these‘, 1), (‘key‘, 1), (‘discovering‘, 1), (‘fulfilling‘, 1), (‘relevance‘, 1), (‘encounter‘, 1), (‘other‘, 1), (‘spends‘, 1), (‘years‘, 1), (‘struggling‘, 1), (‘deal‘, 1), (‘some‘, 1), (‘friends‘, 1), (‘know‘, 1), (‘suffer‘, 1), (‘great‘, 1), (‘painful‘, 1), (‘experience‘, 1), (‘they‘, 1), (‘blessed‘, 1), (‘wonderful‘, 1), (‘happiness‘, 1), (‘just‘, 1), (‘cannot‘, 1), (‘financially‘, 1), (‘peers‘, 1), (‘enjoy‘, 1), (‘abundance‘, 1), (‘thing‘, 1), (‘count‘, 1), (‘certain‘, 1), (‘specifically‘, 1), (‘learn;‘, 1), (‘whether‘, 1), (‘choose‘, 1), (‘entirely‘, 1), (‘challenge‘, 1), (‘therefore‘, 1), (‘align‘, 1), (‘ourselves‘, 1), (‘radically‘, 1), (‘compare‘, 1), (‘people‘, 1), (‘around‘, 1), (‘focus‘, 1), (‘disparity‘, 1), (‘between‘, 1), (‘their‘, 1), (‘ours‘, 1), (‘also‘, 1), (‘maybe‘, 1), (‘capable‘, 1), (‘growth‘, 1), (‘process‘, 1), (‘easy‘, 1), (‘rewards‘, 1), (‘well‘, 1), (‘worth‘, 1), (‘insist‘, 1), (‘even‘, 1), (‘though‘, 1), (‘suffered‘, 1), (‘give‘, 1), (‘please‘, 1), (‘best‘, 1), (‘problems‘, 1), (‘stress‘, 1), (‘feel‘, 1), (‘good‘, 1), (‘world‘, 1), (‘motivate‘, 1), (‘stimulate‘, 1), (‘mind!‘, 1), (‘terrible‘, 1), (‘if‘, 1), (‘go‘, 1), (‘forward‘, 1), (‘right‘, 1), (‘direction‘, 1), (‘worked‘, 1), (‘out‘, 1), (‘let‘, 1), (‘work‘, 1), (‘together‘, 1), (‘strive‘, 1), (‘reach‘, 1), (‘goal‘, 1), (‘dreams‘, 1), (‘come‘, 1), (‘true‘, 1), (‘tomorrow‘, 1), (‘should‘, 1)]
 
>>> i=0
>>> for w in dictList:
	if(i<20):
		i=i+1
		print(w)

  

news = news.lower()newList1 = news.split(" ")dict={}>>> for i in newList1:dict[i]=newList1.count(i) dictList = list(item.items())dictList.sort(key= lambda x:x[1],reverse=True) [(‘‘, 58), (‘to‘, 22), (‘the‘, 20), (‘we‘, 20), (‘is‘, 16), (‘our‘, 14), (‘that‘, 12), (‘i‘, 10), (‘lessons‘, 10), (‘in‘, 9), (‘and‘, 9), (‘will‘, 8), (‘of‘, 8), (‘be‘, 8), (‘with‘, 8), (‘a‘, 7), (‘life‘, 7), (‘have‘, 6), (‘need‘, 6), (‘but‘, 5), (‘or‘, 5), (‘as‘, 5), (‘path‘, 5), (‘are‘, 5), (‘not‘, 4), (‘may‘, 4), (‘why‘, 4), (‘can‘, 4), (‘own‘, 4), (‘don‘, 4), (‘t‘, 4), (‘difficult‘, 4), (‘it‘, 4), (‘step‘, 4), (‘school‘, 3), (‘what‘, 3), (‘so‘, 3), (‘day‘, 3), (‘this‘, 3), (‘learn‘, 3), (‘them‘, 3), (‘my‘, 3), (‘purpose‘, 3), (‘meaning‘, 3), (‘for‘, 3), (‘no‘, 3), (‘different‘, 3), (‘presented‘, 3), (‘learning‘, 3), (‘challenging‘, 3), (‘face‘, 3), (‘while‘, 3), (‘on‘, 3), (‘by‘, 3), (‘way‘, 3), (‘you‘, 3), (‘long‘, 2), (‘time‘, 2), (‘m‘, 2), (‘each‘, 2), (‘here‘, 2), (‘one‘, 2), (‘individual‘, 2), (‘unique‘, 2), (‘from‘, 2), (‘s‘, 2), (‘travel‘, 2), (‘specific‘, 2), (‘through‘, 2), (‘lifetime‘, 2), (‘others‘, 2), (‘challenges‘, 2), (‘never‘, 2), (‘uncomfortable‘, 2), (‘sure‘, 2), (‘struggle‘, 2), (‘only‘, 2), (‘all‘, 2), (‘up‘, 2), (‘us‘, 2), (‘most‘, 2), (‘sometimes‘, 2), (‘remember‘, 2), (‘matter‘, 2), (‘how‘, 2), (‘try‘, 2), (‘your‘, 2), (‘solve‘, 2), (‘release‘, 2), (‘make‘, 2), (‘better‘, 2), (‘problem‘, 2), (‘leaving‘, 1), (‘felt‘, 1), (‘much‘, 1), (‘find‘, 1), (‘enrolled‘, 1), (‘another‘, 1), (‘full-time‘, 1), (‘called‘, 1), (‘opportunity‘, 1), (‘like‘, 1), (‘hate‘, 1), (‘designed‘, 1), (‘part‘, 1), (‘curriculum‘, 1), (‘am‘, 1), (‘humans‘, 1), (‘being‘, 1), (‘sought‘, 1), (‘discover‘, 1), (‘very‘, 1), (‘ancestors‘, 1), (‘overlooked‘, 1), (‘however‘, 1), (‘there‘, 1), (‘answer‘, 1), (‘every‘, 1), (‘person‘, 1), (‘has‘, 1), (‘his‘, 1), (‘her‘, 1), (‘distinct‘, 1), (‘separate‘, 1), (‘anyone‘, 1), (‘else‘, 1), (‘numerous‘, 1), (‘order‘, 1), (‘fulfill‘, 1), (‘us;‘, 1), (‘these‘, 1), (‘key‘, 1), (‘discovering‘, 1), (‘fulfilling‘, 1), (‘relevance‘, 1), (‘encounter‘, 1), (‘other‘, 1), (‘spends‘, 1), (‘years‘, 1), (‘struggling‘, 1), (‘deal‘, 1), (‘some‘, 1), (‘friends‘, 1), (‘know‘, 1), (‘suffer‘, 1), (‘great‘, 1), (‘painful‘, 1), (‘experience‘, 1), (‘they‘, 1), (‘blessed‘, 1), (‘wonderful‘, 1), (‘happiness‘, 1), (‘just‘, 1), (‘cannot‘, 1), (‘financially‘, 1), (‘peers‘, 1), (‘enjoy‘, 1), (‘abundance‘, 1), (‘thing‘, 1), (‘count‘, 1), (‘certain‘, 1), (‘specifically‘, 1), (‘learn;‘, 1), (‘whether‘, 1), (‘choose‘, 1), (‘entirely‘, 1), (‘challenge‘, 1), (‘therefore‘, 1), (‘align‘, 1), (‘ourselves‘, 1), (‘radically‘, 1), (‘compare‘, 1), (‘people‘, 1), (‘around‘, 1), (‘focus‘, 1), (‘disparity‘, 1), (‘between‘, 1), (‘their‘, 1), (‘ours‘, 1), (‘also‘, 1), (‘maybe‘, 1), (‘capable‘, 1), (‘growth‘, 1), (‘process‘, 1), (‘easy‘, 1), (‘rewards‘, 1), (‘well‘, 1), (‘worth‘, 1), (‘insist‘, 1), (‘even‘, 1), (‘though‘, 1), (‘suffered‘, 1), (‘give‘, 1), (‘please‘, 1), (‘best‘, 1), (‘problems‘, 1), (‘stress‘, 1), (‘feel‘, 1), (‘good‘, 1), (‘world‘, 1), (‘motivate‘, 1), (‘stimulate‘, 1), (‘mind!‘, 1), (‘terrible‘, 1), (‘if‘, 1), (‘go‘, 1), (‘forward‘, 1), (‘right‘, 1), (‘direction‘, 1), (‘worked‘, 1), (‘out‘, 1), (‘let‘, 1), (‘work‘, 1), (‘together‘, 1), (‘strive‘, 1), (‘reach‘, 1), (‘goal‘, 1), (‘dreams‘, 1), (‘come‘, 1), (‘true‘, 1), (‘tomorrow‘, 1), (‘should‘, 1)] >>> i=0>>> for w in dictList:if(i<20):i=i+1print(w)

词频统计

标签:remember   key   sep   cannot   min   hal   compare   HERE   from   

原文地址:https://www.cnblogs.com/sewhen/p/8654105.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!