1个稳定版本

1.0.0 2021年12月14日

#1068 in 文本处理

MIT 许可协议

22KB
404 代码行

Veryfi Logo

License: MIT

Veryfi 是一个用于与 Veryfi OCR API 通信的 Rust 模块

安装

添加到您的 cargo.toml

veryfi = "1.0.0"

入门指南

获取客户端ID和用户密钥

如果您没有Veryfi的账户,请在此处注册: https://hub.veryfi.com/signup/api/

Rust API客户端库

Veryfi 库可以用于与Veryfi API通信。此处描述了所有可用功能 DOC

以下是使用 Veryfi 从文档中OCR和处理数据的示例脚本

处理文档。

use veryfi::client::create_client;
use serde_json::{from_str, Map, Value};

fn main() {
    let client_id = "your_client_id".to_string();
    let client_secret = "your_client_secret".to_string();
    let username = "your_username".to_string();
    let api_key = "your_api_key".to_string();
    
    let client = create_client(client_id, client_secret, username, api_key);
    let categories = vec!["Advertising & Marketing", "Automotive"];
    let file_path = "path_to_your_file";
    let delete_after_processing = true;
    let additional_parameters = Map::new();
    
    let response = client.process_document(file_path, categories, delete_after_processing, additional_parameters);
    print!("{}", response); // to print
    let json_response: Value = from_str(&*response).unwrap();
    // ...
}

更新文档

use veryfi::client::create_client;
use serde_json::{from_str, Map, Value};

fn main() {
    let client_id = "your_client_id".to_string();
    let client_secret = "your_client_secret".to_string();
    let username = "your_username".to_string();
    let api_key = "your_api_key".to_string();

    let client = create_client(client_id, client_secret, username, api_key);
    let document_id = "your_document_id".to_string();
    let mut parameters = Map::new();
    let notes = "your_notes";
    parameters.insert("notes".to_string(), Value::from(notes.clone()));

    let response = client.update_document(document_id, parameters);
    print!("{}", response); // to print
    let json_response: Value = from_str(&*response).unwrap();
    // ...
}

需要帮助?

如果您遇到任何问题或需要安装或使用库的帮助,请联系 [email protected]

如果您在此库中发现错误或希望添加新功能,请为此仓库打开一个问题或拉取请求!

要了解更多关于Veryfi的信息,请访问 https://www.veryfi.com/

教程

以下是Rust SDK的介绍。

依赖项

~3–18MB
~219K SLoC