All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aiwiown.face.response.OCRTemplateV1Response Maven / Gradle / Ivy

There is a newer version: 3.0.9
Show newest version
package com.aiwiown.face.response;

import com.aiwiown.face.ApiResponse;
import com.aiwiown.face.domain.orc.OCRTemplateInfoV1;
import com.aiwiown.face.internal.mapping.ApiListField;
import com.aiwiown.face.internal.util.StringUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName : OCRTemplateResponse
 * @Description : 模板
 * @Author : dbin0123
 * @Date: 2020年4月13日10:16:44
 */
public class OCRTemplateV1Response extends ApiResponse {
    private static final long serialVersionUID = -1180201429123447119L;

    /**
     * 被检测出的文字信息,由一个或多个data对象组成。
     * 注:如果没有检测出文字则为空
     */
    @ApiListField("result")
    private List result;

    public List getResult() {
        return result;
    }

    public void setResult(List result) {
        this.result = result;
    }

    public Map mapInfo(){
        Map infoMapping = new HashMap<>();
        if(null == result || result.size() == 0){
            return infoMapping;
        }
        for (OCRTemplateInfoV1 ocrTemplateInfoV1 : result) {
            String key = ocrTemplateInfoV1.getKey();
            String values = infoMapping.get(key);
            List text = ocrTemplateInfoV1.getValue().getText();
            if(!StringUtils.isEmpty(values)){
                values = values+","+StringUtils.join(text,",");
            }
            values = StringUtils.join(text,",");
            infoMapping.put(key,values);
        }
        return infoMapping;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy