Documind 는 AI를 활용하여 PDF에서 구조화 된 데이터를 추출하는 고급 문서 처리 도구입니다. 사용자 정의 가능한 스키마로 지정된 PDF 변환, 관련 정보 추출 및 형식 결과를 처리하도록 구축되었습니다.
이 저장소는 Zerox -https://github.com/getomni-ai/zerox 위에 구축되었습니다. Zerox의 MIT 라이센스는 핵심 폴더에 포함되어 있으며 루트 라이센스 파일에도 언급되어 있습니다.
Documind 호스팅 버전의 데모는 곧 시험해 볼 수 있습니다! 호스팅 된 버전은 완전히 관리되는 API를 사용하여 완벽한 경험을 제공하므로 설정을 건너 뛰고 즉시 데이터 추출을 시작할 수 있습니다.
호스팅 된 서비스에 대한 전체 액세스를 위해 액세스를 요청하시면 설정할 수 있습니다.
documind 사용하기 전에 다음 소프트웨어 종속성이 설치되어 있는지 확인하십시오.
documind 특정 PDF 작업을 처리하기 위해 GhostScript에 의존합니다.진행하기 전에 시스템에 두 가지를 설치하십시오.
# On macOS
brew install ghostscript graphicsmagick
# On Debian/Ubuntu
sudo apt-get update
sudo apt-get install -y ghostscript graphicsmagick
Node.js (v18+)와 NPM이 시스템에 설치되어 있는지 확인하십시오.
NPM을 통해 documind 설치할 수 있습니다.
npm install documind
documind OpenAI API 키와 같은 민감한 정보를 저장하려면 .env 파일이 필요합니다.
프로젝트 디렉토리에서 .env 파일을 만들고 다음을 추가하십시오.
OPENAI_API_KEY=your_openai_api_key 먼저, documind 가져 와서 스키마를 정의하십시오. 스키마는 각 문서에서 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 사용하여 파일 URL 및 스키마를 전달하여 PDF를 처리하십시오.
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 라이센스에 따라 라이센스가 부여됩니다.