码迷,mamicode.com
首页 >  
搜索关键字:hats words    ( 2272个结果
运用结巴库分析三国演义的人物出场次数
import jieba txt = open("D:\\三国演义.txt", "r", encoding='ANSI').read() words = jieba.lcut(txt) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for wor ...
分类:其他好文   时间:2020-04-13 16:43:10    阅读次数:204
leetcode-184周赛-5380-数组中的字符串匹配
题目描述: 自己的提交: class Solution: def stringMatching(self, words: List[str]) -> List[str]: def strStr(haystack: str, needle: str) -> int: if not needle:ret ...
分类:编程语言   时间:2020-04-12 20:41:27    阅读次数:67
Weekly Contest 184
1408. String Matching in an Array Given an array of string words. Return all strings in words which is substring of another word in any order. String  ...
分类:其他好文   时间:2020-04-12 18:45:33    阅读次数:75
20.4.12 周赛 数组中的字符串匹配 简单
题目 给你一个字符串数组 words ,数组中的每个字符串都可以看作是一个单词。请你按 任意 顺序返回 words 中是其他单词的子字符串的所有单词。 如果你可以删除 words[j] 最左侧和/或最右侧的若干字符得到 word[i] ,那么字符串 words[i] 就是 words[j] 的一个子 ...
分类:编程语言   时间:2020-04-12 14:47:20    阅读次数:74
Leetcode 184周赛题解
前一宿没睡好,困的不行,写的有点慢.. 5380. 数组中的字符串匹配 题目描述: 给你一个字符串数组 words ,数组中的每个字符串都可以看作是一个单词。请你按 任意 顺序返回 words 中是其他单词的子字符串的所有单词。如果你可以删除 words[j] 最左侧和/或最右侧的若干字符得到 wo ...
分类:其他好文   时间:2020-04-12 12:46:52    阅读次数:75
翻转字符串里的单词
试题地址:https://leetcode-cn.com/problems/reverse-words-in-a-string/ 试题思路: go自带strings.Fields()函数,可以剔除多余空格 试题代码: func reverseWords(s string) string { strL ...
分类:其他好文   时间:2020-04-10 14:45:08    阅读次数:72
Java异常的捕获和处理(一)
一、异常的捕获和处理 KEY WORDS : try, catch, finally, throw, throws. (一)syntax(代码) try{ //需要运行的代码 }catch(异常类型 异常变量名){ //异常处理代码 }finally{ //异常发生,方法返回之前,需要执行的代码 } ...
分类:编程语言   时间:2020-04-10 09:12:44    阅读次数:102
jieba
1 #jieba文本分析 2 import jieba 3 txt = open("C:/Users/86136/Documents/python文件测试/test.txt","rt",encoding="utf-8") 4 words=jieba.lcut(txt.read()) 5 counts ...
分类:其他好文   时间:2020-04-09 20:20:20    阅读次数:108
运用jieba库统计词频及制作词云
一、对新时代中国特色社会主义做词频统计 import jieba txt = open("新时代中国特色社会主义.txt","r",encoding="utf-8").read() words = jieba.lcut(txt) counts = {} for word in words: if l ...
分类:其他好文   时间:2020-04-08 11:34:30    阅读次数:103
jiaba库的使用《活着》字频分析
import jieba txt = open("huozhe.txt", "r", encoding="utf-8").read() words = jieba.lcut(txt) counts = {} for word in words: if len(word) == 1: continue ...
分类:其他好文   时间:2020-04-07 22:51:50    阅读次数:116
2272条   上一页 1 ... 11 12 13 14 15 ... 228 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!