shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
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
43
44
45
46
package com.walker.openocr;
 
/**
 * 定义OCR服务类型,该参数会传入到:OpenOCR服务确认哪种模型数据。
 * @author 时克英
 * @date 2022-08-30
 */
public enum OcrType {
 
    TextGeneric{
        public String getIndex(){
            return TEXT_GENERIC;
        }
    },
    TextTable{
        public String getIndex(){
            return TEXT_TABLE;
        }
    },
    TextIdCard{
        public String getIndex(){
            return TEXT_ID_CARD;
        }
    };
 
    public String getIndex(){
        throw new AbstractMethodError();
    }
 
    public static OcrType getType(String type){
        if(type.equals(TEXT_GENERIC)){
            return TextGeneric;
        } else if(type.equals(TEXT_TABLE)){
            return TextTable;
        } else if(type.equals(TEXT_ID_CARD)){
            return TextIdCard;
        } else {
            throw new UnsupportedOperationException("暂不支持 OCR 类型:" + type);
        }
    }
 
    public static final String TEXT_GENERIC = "text";
    public static final String TEXT_TABLE = "table";
    public static final String TEXT_ID_CARD = "id_card";
 
}