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

java分析公司名称:AI智能工具助力提取地名、品牌名、行业名

java分析公司名称:AI智能工具助力提取地名、品牌名、行业名

一、java智能提取地名

/*** 通过“武汉”补全省市区* @throws Exception*/public void getPlace4() throws Exception{String r1 = "武汉";String fileName2 = "D:\\Personal\\Desktop\\txt\\pca2.txt";String f1 = fileUtil.readFile(fileName2);String f2[] = f1.split("\r\n");String res3 = "";for (String s3: f2) {if (s3.contains(r1)) {System.out.println(s3.replaceAll(",",""));break;}}}/*** 获取省市区文件*/public void getPlace3() throws Exception{String fileName1 = "D:\\Personal\\Desktop\\txt\\pca.txt";String fileName2 = "D:\\Personal\\Desktop\\txt\\pca2.txt";String f1 = fileUtil.readFile(fileName1);String f2[] = f1.split("\r\n");String res3 = "";for (String s3: f2) {if (!s3.equals("")) {String s5[] = s3.split(",");if(s5.length == 6){res3+=s5[1]+","+s5[2]+","+s5[3]+"\r\n";}}}fileUtil.writeTxtFile(fileName2, res3);}/*** 通过place1地区文件提取*/public void getPlace2(){String res = "武汉海明智业电子商务有限公司";String fileName1 = "D:\\Personal\\Desktop\\txt\\place1.txt";String f1 = fileUtil.readFile(fileName1);String f2[] = f1.split("\r\n");for (String s3: f2) {if (!s3.equals("")) {if (res.contains(s3)) {System.out.println(s3);break;}}}}/*** 通过nlp地区提取*/public void getPlace1(){String res = "武汉海明智业电子商务有限公司";String[] testCase = new String[]{res};//地名(place)、品牌名(brand)、行业词(trade)//{'place': '昆明', 'brand': '享亚', 'trade': '教育信息咨询', 'suffix': '有限公司', 'symbol': ''}List<String> list = new ArrayList<>();Segment segment = HanLP.newSegment().enablePlaceRecognize(true);for (String sentence : testCase) {List<Term> termList = segment.seg(sentence);for (Term term : termList) {if(term.nature.toString().equals("ns")){list.add(term.word);}}}for (String str: list){System.out.println(str);}}

二、java智能提取品牌名

String res = "武汉海明智业电子商务有限公司";String[] testCase = new String[]{res};Segment segment = HanLP.newSegment().enablePlaceRecognize(true);String res2 = "";for (String sentence : testCase) {List<Term> termList = segment.seg(sentence);
//            System.out.println(termList);for (Term term : termList) {if(!term.nature.toString().equals("ns") ){if(!term.nature.toString().equals("n") && !term.word.toString().equals("分")){res2+=term.word;}}}}System.out.println(res2);

三、java智能提取行业名

 public static void main(String[] args) throws Exception {String sentence = "常州途畅互联网科技有限公司合肥分公司";Segment segment = HanLP.newSegment();List<Term> termList = segment.seg(sentence);String fileName1 = "D:\\Personal\\Desktop\\txt\\trade.txt";String f1 = fileUtil.readFile(fileName1);String f2[] = f1.split("\r\n");String res3 = "";for (Term term : termList) {for (String s3: f2) {String res = term.word;if (!s3.equals("")) {if (res.contains(s3)) {res3 += s3;}}}}System.out.println(res3);}public void get1(){String res = "昆明享亚教育信息咨询有限公司";String fileName1 = "D:\\Personal\\Desktop\\txt\\trade.txt";String f1 = fileUtil.readFile(fileName1);String f2[] = f1.split("\r\n");String res3 = "";for (String s3: f2) {if (!s3.equals("")) {if (res.contains(s3)) {res3+=s3;}}}System.out.println(res3);}
http://www.lryc.cn/news/135820.html

相关文章:

  • php 二维数组排序
  • postgresql 性能调优
  • 派森 #P128. csv存json格式
  • iPhone开启“轻点唤醒”功能但点击屏幕无反应怎么解决?
  • 论AI与大数据之间的关系
  • 6.ES基础概念及术语详细解读
  • 大语言模型微调实践——LoRA 微调细节
  • 国内ChatGPT对比与最佳方案
  • 绝美的古诗词AI作画,惊艳到我了!
  • 数据结构—排序
  • GraphScope,开源图数据分析引擎的领航者
  • 【Linux】邮件服务器搭建 postfix+dovecot+mysql (终极版 超详细 亲测多遍无问题)
  • GitLab与GitLab Runner安装(RPM与Docker方式),CI/CD初体验
  • vue3+element下拉多选框组件
  • Python科研绘图--Task02
  • [保研/考研机试] KY11 二叉树遍历 清华大学复试上机题 C++实现
  • 【官方中文文档】Mybatis-Spring #简介
  • 稳定扩散ControlNet v1.1 权威指南
  • 【golang】结构体及其方法的使用(struct)
  • 【数据结构】-- 排序算法习题总结
  • 第十章 CUDA流(stream)实战篇
  • 如何进行电脑文件夹分类与整理?
  • kafka-python 消费者消费不到消息
  • 穿起“新架构”的舞鞋,跳一支金融数字化转型的华尔兹
  • SpringBoot 常用注解
  • k8s deployment创建pod流程图
  • C++ 逗号运算符
  • jdbc集成phoneix hbase
  • 16.遍历二叉树,线索二叉树
  • 电商平台按关键字搜索商品淘宝京东拼多多api接口PHP示例