分类根据识别图片生成的识别结果获取关键字,生成对应的文件夹:
代码如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package com.baidu.ai.aip.auth; import java.io.File; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; @SuppressWarnings ( "rawtypes" ) public class _fileUtil { private Map map; public _fileUtil(){ this .map= new HashMap(); } public Map getMap() { return map; } @SuppressWarnings ( "unchecked" ) public _fileUtil addRegulation(String oldStr, String newStr){ this .map.put(oldStr, newStr); return this ; } public static void multiFloder(String path, String[] files, String suffixName){ String filename = "" ; for ( int i = 0 ; i<files.length;i++){ filename = (i+ 1 )+ "-" +files[i]; File f = new File(path+ "\" +filename+suffixName); f.mkdirs(); System.out.println( "创建文件夹成功!" ); } } public static void main(String[] args) { String suffixName= "(云端智能相册)" ; String path = "D:\eclipse\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\picbook\upload" ; String[] files = { "非自然" , "人" , "植物" , "动物" , "商品" }; _fileUtil.multiFloder(path, files ,suffixName); _fileUtil.multiFloder( null , args,suffixName); } } |