Documind เป็นเครื่องมือประมวลผลเอกสารขั้นสูงที่ใช้ประโยชน์จาก AI เพื่อแยกข้อมูลที่มีโครงสร้างจาก PDF มันถูกสร้างขึ้นเพื่อจัดการการแปลง PDF แยกข้อมูลที่เกี่ยวข้องและผลลัพธ์รูปแบบตามที่ระบุโดย schemas ที่ปรับแต่งได้
repo นี้ถูกสร้างขึ้นที่ด้านบนของ Zerox - https://github.com/getomni-ai/zerox ใบอนุญาต MIT จาก Zerox รวมอยู่ในโฟลเดอร์หลักและยังถูกกล่าวถึงในไฟล์สิทธิ์การใช้งานรูท
การสาธิตของเวอร์ชันโฮสต์ Documind จะพร้อมใช้งานเร็ว ๆ นี้เพื่อให้คุณลอง! เวอร์ชันที่โฮสต์ให้ประสบการณ์ที่ไร้รอยต่อด้วย API ที่ได้รับการจัดการอย่างสมบูรณ์ดังนั้นคุณสามารถข้ามการตั้งค่าและเริ่มแยกข้อมูลได้ทันที
สำหรับการเข้าถึงบริการที่โฮสต์อย่างเต็มรูปแบบโปรดขอเข้าถึงและเราจะได้รับการตั้งค่า
ก่อนที่จะใช้ documind ตรวจสอบให้แน่ใจว่ามีการติดตั้งซอฟต์แวร์ต่อไปนี้:
documind ขึ้นอยู่กับ Ghostscript สำหรับการจัดการการดำเนินการ PDF บางอย่างติดตั้งทั้งสองบนระบบของคุณก่อนดำเนินการ:
# On macOS
brew install ghostscript graphicsmagick
# On Debian/Ubuntu
sudo apt-get update
sudo apt-get install -y ghostscript graphicsmagick
ตรวจสอบให้แน่ใจว่าติดตั้ง Node.js (V18+) และ NPM ในระบบของคุณ
คุณสามารถติดตั้ง documind ผ่าน NPM:
npm install documind
documind ต้องการไฟล์ .env เพื่อจัดเก็บข้อมูลที่ละเอียดอ่อนเช่นคีย์ OpenAI API ของคุณ
สร้างไฟล์ .env ในไดเรกทอรีโครงการของคุณและเพิ่มสิ่งต่อไปนี้:
OPENAI_API_KEY=your_openai_api_key ขั้นแรกให้นำเข้า documind และกำหนดสคีมาของคุณ Schema ร่างสิ่งที่ documind ข้อมูลควรค้นหาในแต่ละเอกสาร นี่คือการตั้งค่าอย่างรวดเร็วเพื่อเริ่มต้น
สคีมาเป็นอาร์เรย์ของวัตถุที่แต่ละวัตถุกำหนด:
"string" , "number" , "array" , "object" )ตัวอย่างสคีมาสำหรับใบแจ้งยอดธนาคาร:
const schema = [
{
name : "accountNumber" ,
type : "string" ,
description : "The account number of the bank statement."
} ,
{
name : "openingBalance" ,
type : "number" ,
description : "The opening balance of the account."
} ,
{
name : "transactions" ,
type : "array" ,
description : "List of transactions in the account." ,
children : [
{
name : "date" ,
type : "string" ,
description : "Transaction date."
} ,
{
name : "creditAmount" ,
type : "number" ,
description : "Credit Amount of the transaction."
} ,
{
name : "debitAmount" ,
type : "number" ,
description : "Debit Amount of the transaction."
} ,
{
name : "description" ,
type : "string" ,
description : "Transaction description."
}
]
} ,
{
name : "closingBalance" ,
type : "number" ,
description : "The closing balance of the account."
}
] ;documind ใช้ documind เพื่อประมวลผล PDF โดยผ่าน URL ไฟล์และสคีมา
import { extract } from 'documind' ;
const runExtraction = async ( ) => {
const result = await extract ( {
file : 'https://bank_statement.pdf' ,
schema
} ) ;
console . log ( "Extracted Data:" , result ) ;
} ;
runExtraction ( ) ;นี่คือตัวอย่างของสิ่งที่ผลลัพธ์สกัดอาจมีลักษณะ:
{
"success" : true ,
"pages" : 1 ,
"data" : {
"accountNumber" : " 100002345 " ,
"openingBalance" : 3200 ,
"transactions" : [
{
"date" : " 2021-05-12 " ,
"creditAmount" : null ,
"debitAmount" : 100 ,
"description" : " transfer to Tom "
},
{
"date" : " 2021-05-12 " ,
"creditAmount" : 50 ,
"debitAmount" : null ,
"description" : " For lunch the other day "
},
{
"date" : " 2021-05-13 " ,
"creditAmount" : 20 ,
"debitAmount" : null ,
"description" : " Refund for voucher "
},
{
"date" : " 2021-05-13 " ,
"creditAmount" : null ,
"debitAmount" : 750 ,
"description" : " May's rent "
}
],
"closingBalance" : 2420
},
"fileName" : " bank_statement.pdf "
}
Documind มาพร้อมกับเทมเพลตในตัวสำหรับการแยกข้อมูลจากประเภทเอกสารยอดนิยมเช่นใบแจ้งหนี้ใบแจ้งหนี้ธนาคารและอื่น ๆ เทมเพลตเหล่านี้ทำให้การเริ่มต้นใช้งานง่ายขึ้นโดยไม่ต้องกำหนดสคีมาของคุณเอง
รายการเทมเพลตที่มีอยู่
คุณสามารถแสดงรายการเทมเพลตที่มีอยู่ทั้งหมดโดยใช้ฟังก์ชัน templates.list
import { templates } from 'documind' ;
const templates = templates . list ( ) ;
console . log ( templates ) ; // Logs all available template namesใช้เทมเพลต
หากต้องการใช้เทมเพลตเพียงส่งผ่านชื่อไปยังฟังก์ชั่น extract พร้อมกับไฟล์ที่คุณต้องการดึงข้อมูลจาก นี่คือตัวอย่าง:
import { extract } from 'documind' ;
const runExtraction = async ( ) => {
const result = await extract ( {
file : 'https://bank_statement.pdf' ,
template : 'bank_statement'
} ) ;
console . log ( "Extracted Data:" , result ) ;
} ;
runExtraction ( ) ;อ่านเอกสารเทมเพลตสำหรับรายละเอียดเพิ่มเติมเกี่ยวกับเทมเพลตและวิธีการมีส่วนร่วมของคุณ
ยินดีต้อนรับ! โปรดส่งคำขอดึงพร้อมการปรับปรุงหรือคุณสมบัติใด ๆ
โครงการนี้ได้รับใบอนุญาตภายใต้ใบอนุญาต AGPL V3.0