跑纸活做网站,阳江最新通知今天,一些简单的编程代码,晋江论坛兔区网友留言区java分析公司名称#xff1a;AI智能工具助力提取地名、品牌名、行业名
一、java智能提取地名
/*** 通过“武汉”补全省市区* throws Exception*/public void getPlace4() throws Exception{String r1 武汉;String fileName2 D:\\Personal\\Desktop\\txt…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){res3s5[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: }ListString list new ArrayList();Segment segment HanLP.newSegment().enablePlaceRecognize(true);for (String sentence : testCase) {ListTerm 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) {ListTerm 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(分)){res2term.word;}}}}System.out.println(res2);三、java智能提取行业名 public static void main(String[] args) throws Exception {String sentence 常州途畅互联网科技有限公司合肥分公司;Segment segment HanLP.newSegment();ListTerm 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)) {res3s3;}}}System.out.println(res3);}