统计单词频率
1 Str = """Authoritie's aim to better regulate online economy, guide its healthy development 2 3 Chinese authorities have officially opened an anti-monopoly probe into e-commerce giant Alibaba Group and will summon its affiliate Ant Group for a meeting about financial regulations, the latest moves to strengthen antitrust practices and prevention of the "disorderly expansion of capital". 4 5 The State Administration for Market Regulation has launched an investigation into Alibaba for alleged monopolistic conduct, including implementing an "exclusive dealing agreement", Xinhua News Agency reported on Thursday. 6 7 The issue largely refers to the company's practice of forcing merchants to choose either Alibaba's platform or its rival site to sell their products instead of being eligible to work with both, potentially crowding out competitors. 8 9 In a statement on Thursday, Alibaba said it will-actively cooperate with the investigation, and the operation of the company's businesses currently remain normal. 10 11 Meanwhile, financial regulators, including the central bank and the banking and securities watchdogs, will summon Alibaba's financial technology arm Ant to a meeting to regulate the operation and development of its financial business, the People's Bank of China said on Thursday. 12 13 Ant said it had received the notice of the meeting and pledged to "seriously study and strictly comply with all regulatory requirements and make full efforts to fulfill all related work". 14 15 Alibaba's Hong Kong-listed stocks plunged 8.13 percent on Thursday. 16 17 Overshadowed by the Alibaba investigation, other internet majors such as Tencent, JD and Meituan all saw their shares tumble on the same day. 18 19 With market resources concentrating on leading companies, certain "risks and hidden dangers" have surfaced in the development of the online economy, according to a commentary in People's Daily on Thursday.""" 20 21 TranStr = "" 22 for i in range(len(Str)): 23 if Str[i] == "\a": 24 TranStr += " a" 25 elif Str[i] == "\b": 26 TranStr += " b" 27 elif Str[i] == "\f": 28 TranStr += " f" 29 elif Str[i] == "\n": 30 TranStr += " n " 31 #无法判断是换行,还是文件名路径,如果是是回车用n替换就会变成下一行单子的首字母,但是文件路径的可能性不大,换行频率高,牺牲文件路径 32 elif Str[i] == "\r": 33 TranStr += " r" 34 elif Str[i] == "\t": 35 TranStr += " t" 36 elif Str[i] == "\v": 37 TranStr += " v" 38 elif Str[i] == "\\": 39 TranStr += " " 40 elif Str[i] == "\'": 41 TranStr += "'" 42 elif Str[i] == "\"": 43 TranStr += '"' 44 elif Str[i] == '\?': 45 TranStr += '?' 46 elif Str[i] == "\0": 47 TranStr += "0" 48 else: 49 TranStr += Str[i] 50 51 52 NewStr = "" 53 TranStr = TranStr.casefold() 54 55 for i in range(len(TranStr)): 56 if 97 <= ord(TranStr[i]) <= 122 or TranStr[i] == "-" : 57 NewStr += TranStr[i] 58 elif len(NewStr) > 0 and NewStr[-1] != " ": 59 NewStr += " " 60 else: 61 continue 62 63 WordList = NewStr.split(" ") 64 WordFreq = [] 65 66 for word in WordList: 67 WordFreq.append(WordList.count(word)) 68 Dict = dict(zip(WordList, WordFreq)) 69 70 print(sorted(Dict.items(), key=lambda item:item[1]))
------------------------------------------------------------------------------------------------------
坚持每天进步一点点,一年将是一大步
-------------------------------------------------------------------------------------------------------

浙公网安备 33010602011771号