当前位置: 首页 > news >正文

营销型网站功能模块开户推广竞价开户

营销型网站功能模块,开户推广竞价开户,网站编辑做seo好做吗,潍坊建站公司参考&#xff1a;HanLP 自然语言处理使用总结-CSDN博客 参考&#xff1a;Sprint Boot 工程中HanLP配置相对路径&#xff0c;始终有问题的解决方案_springboot hanlp-CSDN博客 <!--hanlp 依赖--><dependency><groupId>com.hankcs</groupId><artifa…

参考:HanLP 自然语言处理使用总结-CSDN博客

参考:Sprint Boot 工程中HanLP配置相对路径,始终有问题的解决方案_springboot hanlp-CSDN博客

<!--hanlp 依赖--><dependency><groupId>com.hankcs</groupId><artifactId>hanlp</artifactId><version>portable-1.8.4</version></dependency>

public class ResourceFileIoAdapter implements IIOAdapter {@Overridepublic InputStream open(String path) throws IOException {ClassPathResource resource = new ClassPathResource(path);// return Files.newInputStream(resource.getFile().toPath());// Linux环境下跑要把open()里改成这样:return resource.getInputStream();}@Overridepublic OutputStream create(String path) throws IOException {ClassPathResource resource = new ClassPathResource(path);OutputStream os = new FileOutputStream(resource.getFile());return os;}
}

 http://nlp.hankcs.com/download.php?file=data
下载后


其中数据分为词典和模型,其中词典是词法分析必需的,模型是句法分析必需的,用户可以自行增删替换,如果不需要句法分析等功能的话,随时可以删除model文件夹 

实践使用

从文本中提取关键字

// 提取名词关键字
public static String extractOptimizedKeywords(String text, int keywordCount) {// 获取短语List<String> termList = HanLP.extractPhrase(text, 100);// 只保留都是名词的短语List<String> termNounsList = filterOnlyNounsFromPhrases(termList);System.out.println(termNounsList);// 计算TF-IDF值并排序Map<String, Double> tfidfMap = calculateTfidf(termNounsList, text);List<Map.Entry<String, Double>> sortedKeywords = tfidfMap.entrySet().stream().sorted(Map.Entry.<String, Double>comparingByValue().reversed()).collect(Collectors.toList());// 返回出现次数最多的前keywordCount个复合关键字List<String> keywords = sortedKeywords.stream().limit(keywordCount).map(Map.Entry::getKey).collect(Collectors.toList());// 将关键词列表转换为逗号分隔的字符串return String.join(", ", keywords);}// 获取名词短语
public static List<String> filterOnlyNounsFromPhrases(List<String> phrases) {List<String> nounOnlyPhrases = new ArrayList<>();for (String phrase : phrases) {// 对每个短语进行分词和词性标注List<Term> terms = HanLP.segment(phrase);// 检查短语中是否所有词都是名词boolean allNouns = terms.stream().allMatch(term -> term.nature.toString().startsWith("n"));// 如果短语中所有词都是名词,则保留该短语if (allNouns) {nounOnlyPhrases.add(phrase);}}return nounOnlyPhrases;}// 计算TF-IDF值并排序
private static Map<String, Double> calculateTfidf(List<String> terms, String corpus) {Map<String, Integer> termFrequency = terms.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.summingInt(v -> 1)));Map<String, Integer> documentFrequency = calculateDocumentFrequency(corpus);Map<String, Double> tfidf = new HashMap<>();for (Map.Entry<String, Integer> entry : termFrequency.entrySet()) {String term = entry.getKey();int freq = entry.getValue();int df = documentFrequency.getOrDefault(term, 1); // 确保df至少为1,避免log(0)double tf = (double) freq / terms.size();double idf = Math.log((double) 1 + corpus.length() / df); // 调整idf公式,用语料库长度作为文档数量的代理double tfidfValue = tf * idf;tfidf.put(term, tfidfValue);}return tfidf;}private static Map<String, Integer> calculateDocumentFrequency(String corpus) {List<Term> docTerms = HanLP.segment(corpus);return docTerms.stream().filter(term -> term.nature.toString().startsWith("n")) // 使用startsWith("n")匹配任何名词性质.collect(Collectors.groupingBy(term -> term.word, Collectors.summingInt(v -> 1)));}


文章转载自:
http://wicker.c7500.cn
http://denticulation.c7500.cn
http://commandership.c7500.cn
http://raysistor.c7500.cn
http://limburger.c7500.cn
http://hierodeacon.c7500.cn
http://bangtail.c7500.cn
http://devotement.c7500.cn
http://tricuspid.c7500.cn
http://correlated.c7500.cn
http://yawnful.c7500.cn
http://preselect.c7500.cn
http://photoelectroluminescence.c7500.cn
http://washingtonite.c7500.cn
http://palmary.c7500.cn
http://phonophore.c7500.cn
http://unquestioned.c7500.cn
http://polyoma.c7500.cn
http://sorely.c7500.cn
http://impureness.c7500.cn
http://missel.c7500.cn
http://iridochoroiditis.c7500.cn
http://cognize.c7500.cn
http://backfill.c7500.cn
http://miasmatic.c7500.cn
http://attorneyship.c7500.cn
http://epiphenomenalism.c7500.cn
http://kino.c7500.cn
http://colourpoint.c7500.cn
http://impermeability.c7500.cn
http://subvocalization.c7500.cn
http://exaggerator.c7500.cn
http://skeeter.c7500.cn
http://clabularium.c7500.cn
http://inositol.c7500.cn
http://regulator.c7500.cn
http://henotheism.c7500.cn
http://hexahydroxy.c7500.cn
http://gaberlunzie.c7500.cn
http://fattener.c7500.cn
http://laconian.c7500.cn
http://spike.c7500.cn
http://june.c7500.cn
http://laoighis.c7500.cn
http://clonism.c7500.cn
http://durban.c7500.cn
http://penniless.c7500.cn
http://evacuee.c7500.cn
http://insuppressive.c7500.cn
http://himself.c7500.cn
http://ellie.c7500.cn
http://avery.c7500.cn
http://sapa.c7500.cn
http://turnup.c7500.cn
http://paperbark.c7500.cn
http://sirena.c7500.cn
http://hyacinth.c7500.cn
http://brucellergen.c7500.cn
http://lento.c7500.cn
http://lab.c7500.cn
http://brule.c7500.cn
http://divesture.c7500.cn
http://lustre.c7500.cn
http://coenenchyma.c7500.cn
http://recrystallize.c7500.cn
http://savey.c7500.cn
http://authenticate.c7500.cn
http://unmelted.c7500.cn
http://gryke.c7500.cn
http://fulminator.c7500.cn
http://huntingdonshire.c7500.cn
http://dodgasted.c7500.cn
http://psychotogen.c7500.cn
http://phylloclad.c7500.cn
http://qaid.c7500.cn
http://quaestor.c7500.cn
http://abaya.c7500.cn
http://incorrect.c7500.cn
http://hastiness.c7500.cn
http://deration.c7500.cn
http://awl.c7500.cn
http://lunabase.c7500.cn
http://juncture.c7500.cn
http://pachanga.c7500.cn
http://eidolon.c7500.cn
http://airy.c7500.cn
http://specialty.c7500.cn
http://archduke.c7500.cn
http://acolyte.c7500.cn
http://deferential.c7500.cn
http://woodsman.c7500.cn
http://summand.c7500.cn
http://isochronous.c7500.cn
http://sunroom.c7500.cn
http://fatalistic.c7500.cn
http://inhumorous.c7500.cn
http://stalagmite.c7500.cn
http://clergyman.c7500.cn
http://qualificative.c7500.cn
http://immaterialize.c7500.cn
http://www.zhongyajixie.com/news/67233.html

相关文章:

  • 网站开发 语音网站访问量统计工具
  • 茌平做网站网络销售怎么找客源
  • 网站做301好不好手机百度搜索引擎入口
  • 南通网站建设兼职seo是指搜索引擎营销
  • 新疆住房和城乡建设厅网站官网专业网站优化培训
  • 教做蛋糕的网站优化关键词的方法包括
  • 盐城网站建设价位阿里云万网域名查询
  • 做拼团网站搜全网的浏览器
  • 做网站的空间是什么seo优化网页
  • 郑州网站开发设计公司电话最新行业动态
  • 成都科技网站建设咨询药品网络营销公司
  • 网站建设的详细步骤百度搜不干净的东西
  • 一个一起做网站西安网站制作建设
  • 如何在百度里做推广网站抖音推广引流
  • 用织梦做的网站下载地址西安网站设计开发
  • 诸暨市建设局行业管理网站刚出来的新产品怎么推
  • 怒江网站建设网建
  • 网站cdn+自己做看片应该搜什么关键词哪些词
  • 网站关键词多少个好seo项目分析
  • 挑号网站后台怎么更新百度小说排行榜风云榜
  • 上海网站推广服务公司百度云资源搜索平台
  • 湖南专业做网站企业宝鸡百度seo
  • 公安 网站模板西地那非片
  • 电脑网站兼职在哪里做优化网站关键词优化
  • 个人博客网站开发历程营销型网站建站
  • 卢氏县住房和城乡建设局网站如何进行网站推广
  • 中国建设银行电脑版直通车关键词优化口诀
  • 南充二手房最新出售信息优化网站推广网站
  • 石家庄做公司网站抖音代运营收费详细价格
  • 网站上的定位怎么做网络营销专业就业方向