IronOCR를 GitHub Copilot과 함께 사용하는 방법
.NET 팀은 문서 캡처, 지급 계정, 청구 처리 또는 기록 관리에 대한 Visual Studio 솔루션을 갖춘 팀은 GitHub Copilot을 평가하기 위해 편집기를 변경할 필요가 없습니다. 기존 워크플로를 지원합니다.
Copilot은 Visual Studio, VS Code, JetBrains IDE 및 GitHub.com에서 실행됩니다. IronOCR는 .NET에서 로컬로 인식 처리를 수행합니다.
사진과 손글씨에 대한 IronOCR의 모델에 대한 자세한 내용은 사진 읽기 가이드와 손글씨 가이드를 참조하십시오.
빠른 시작현재 IDE에서 메서드가 반환해야 하는 사항과 모델이 기억해야 할 기본값을 명시합니다.
Add a ReadDeliveryNote method to Imports/DeliveryNotes.cs that uses IronOCR (the
IronOcr NuGet package, namespace IronOcr) to read a scanned delivery note and
return both its text and the barcode values found in the same pass. Barcode
reading is off by default, so switch it on before the read. Take the license key
from the IRONOCR_LICENSE_KEY environment variable, never inline. Then build and
fix any errors.
편집기가 시작되는 환경에서 IRONOCR_LICENSE_KEY을 설정하고, 다른 키 저장 위치에 대한 자세한 내용은 라이선스 키 가이드를 참조하십시오. 이를 사용하지 않으면 첫 번째 읽기가 라이선스 검사에서 중지되며, Copilot은 작성한 OCR 코드를 실행할 수 없습니다.
최소 워크플로우(5단계)
- C# OCR 라이브러리를 NuGet에서 다운로드
.github/copilot-instructions.md에 IronOCR 규칙을 확인하세요.- 단일 파일에는 인라인 채팅을 사용하고, 여러 파일이 관련된 경우 에이전트 모드를 사용하세요.
- 클라우드 에이전트가 혼자 작업할 때는 자세한 문제를 작성하세요.
- API 레퍼런스를 사용하여 풀 리퀘스트에 IronOCR 멤버를 확인하세요.
Copilot이 이미 Visual Studio에 있는 프로젝트에 어떻게 맞춰질까요?
한 파일의 IronOCR 변경을 위해 인라인 채팅을 사용합니다. 변경이 여러 파일에 걸쳐 있는 경우 프로젝트를 빌드하고 OCR 코드를 자체적으로 실행할 수 있는 에이전트 모드로 전환합니다. GitHub의 클라우드 에이전트는 할당된 문제를 받아 풀 요청을 반환합니다.
IronOCR 규칙을 Copilot에 설정하는 방법은 무엇입니까?
IronOCR 규칙을 .github/copilot-instructions.md로 커밋하면 Copilot Chat, 에이전트 모드 및 클라우드 에이전트가 읽습니다. 인라인 완성은 이를 무시합니다.
# Copilot instructions
## OCR
- Use IronOCR for all OCR work. The NuGet package is IronOcr on Windows and
IronOcr.Linux on Linux and Docker. The namespace is IronOcr. Do not add
another OCR engine or a cloud OCR service.
- Documentation: https://ironsoftware.com/ocr/csharp/llms.txt
Skill file: https://ironsoftware.com/ocr/csharp/skill.md
- Target the IronOcr version pinned in Directory.Packages.props. Do not upgrade
it as part of an unrelated change.
- Never inline a license key. Read it from configuration or the
IRONOCR_LICENSE_KEY environment variable.
- Always dispose OcrInput with a using block.
- Barcode reading is off by default. Set Configuration.ReadBarCodes only where needed.
- Apply only the image filters that fix a visible defect.
- Do not invent IronOCR API names. If a member is uncertain, say so and cite
the documentation rather than guessing.
## Testing
- Every OCR change must be run against pages with known values.
- Assert on extracted fields. Never assert on the full text of a page.
## Pull requests
- Say which IronOCR APIs the change introduces, and link the page for each.
- If the OCR tests fail, check the runner environment before changing code
that the issue did not ask you to touch.
한 폴더에 자체 OCR 언어 규칙을 부여하는 방법은 무엇입니까?
IronOCR 설정은 독일 공급업체 송장과 영어 창고 스캔처럼 종종 출처에 따라 다릅니다. 독일어 규칙을 .github/instructions/ocr-german.instructions.md에 넣습니다. Copilot은 작업 중인 파일이 독일어 파일의 최상단 경로 패턴과 일치할 때마다 해당 파일을 저장소 전반의 파일과 함께 적용합니다.
---
applyTo: "Imports/De/**"
---
- Invoices in this folder are German. Set Language = OcrLanguage.German and add
English with AddSecondaryLanguage(OcrLanguage.English) for supplier names.
- German comes from the IronOcr.Languages.German NuGet package. Language packs
keep their own version numbers, so never align this one with IronOcr.
- Amounts use German formatting, such as 1.234,56. Parse them with the de-DE culture.
독일어 샘플은 최신 독일어 팩인 2020.11.2와 영어를 보조 언어로 사용하여 그 줄에서 "Gesamtbetrag: 3.271,07 EUR"를 96.6의 신뢰도로 반환했습니다.
클라우드 에이전트가 작동할 수 있는 문제는 무엇입니까?
잘못된 송장 합계만 보고된 문제는 클라우드 에이전트가 잘못을 찾을 파일과 영향을 받은 스캔 및 정확한 합계를 찾도록 남겨둡니다.
Title: Totals misread on rotated scans from the warehouse scanner
**Files:** Imports/InvoiceReader.cs, Imports/ImportJob.cs
**IronOcr version:** as pinned in Directory.Packages.props
**Framework:** .NET 8
**Expected:** Every invoice in TestData/warehouse/ returns the total recorded in
TestData/warehouse/expected.csv, with line confidence of at least 80.
**Actual:** About a third of warehouse scans return totals with one wrong digit.
The pages are rotated a few degrees and have speckle. Invoices from the email
inbox read correctly. No exception is thrown.
**Constraints:** Keep the Total due parsing as it is. Do not change the public
signature of InvoiceReader.ReadTotal. No new packages.
**Acceptance:** Existing tests pass, plus a new test that reads every scan in
TestData/warehouse/ and matches expected.csv.
이메일로 전송된 송장이 올바르게 읽힌다는 메모는 조사 방향을 구문 분석이 아닌 스캔 품질로 지시합니다.
IronOCR 프로젝트에서 클라우드 에이전트의 테스트가 실패하는 이유는 무엇입니까?
기본적으로 클라우드 에이전트는 일시적인 Ubuntu Linux 러너에서 빌드 및 테스트를 수행합니다. IronOcr 패키지는 Windows 네이티브 런타임만 제공하므로 러너에는 IronOcr.Linux이 필요합니다. 기본 브랜치에 병합되면 .github/workflows/copilot-setup-steps.yml의 설정 워크플로, 하나의 작업이 있는 copilot-setup-steps이 그 차이를 해소합니다.
Write .github/workflows/copilot-setup-steps.yml for this repository.
The job must be named copilot-setup-steps exactly, or it is ignored. Trigger it
manually, and on push and pull request limited to that one file path.
Run it on ubuntu-latest with read access to repository contents. Check out the
repository, set up the .NET SDK for the version this project targets, install
the native dependencies IronOCR needs on Ubuntu, then restore packages.
For those dependencies read
https://ironsoftware.com/ocr/csharp/get-started/linux/ and use what it lists for
Ubuntu rather than a list from memory. Note in a comment that the list can
change between releases.
The runner is Linux, so OCR there needs the IronOcr.Linux package this
repository's instructions name. Show me the finished YAML, then any project
change the runner still needs to restore IronOcr.Linux.
- 라이선스 키: 클라우드 에이전트는 Actions, Codespaces 또는 Dependabot 비밀을 읽을 수 없으므로 키는 에이전트 비밀이 필요합니다. 설정, 비밀 및 변수, 그 다음 에이전트 아래에 키를 추가하고, 편집기가 읽는 것과 동일한 이름으로 추가하면 에이전트가 환경 변수로 수신합니다.
- 설정 단계 실패: 클라우드 에이전트를 중지하지 않습니다. 에이전트는 나머지 단계를 건너뛰며 어쨌든 작업을 시작합니다. 따라서 Actions 탭에서 워크플로를 한 번 실행하고 통과하는지 확인하십시오.
병합 전에 무엇을 확인해야 합니까?
콜리그의 것을 검토하듯 Copilot 풀 리퀘스트를 검토합니다.
/tests Add xUnit tests for this change: every scan in TestData/warehouse/ returns
the invoice number and total in its expected.csv, a page without a total returns
null rather than a guess, and reads below 80 confidence are flagged. Assert on
extracted fields, not on the full page text.
새로운 IronOCR 릴리스는 값을 변경하지 않고도 간격과 줄 바꿈을 변경할 수 있습니다. AI 코딩 보조 가이드가 이 리뷰를 반복 가능한 테스트로 바꿉니다.
잘못된 OCR 결과를 진단하는 방법은 무엇입니까?
잘못된 결과는 보통 세 가지 원인 중 하나가 있습니다. 페이지에 이미지 필터 또는 높은 DPI가 필요하고, 문서의 언어 팩이 추가되지 않았거나, 잘못된 지역을 대상으로 합니다. 빈 바코드 컬렉션은 Configuration.ReadBarCodes가 설정되지 않았다는 것을 의미할 수도 있습니다.
Delivery notes in TestData/notes/ return their text, but about a third
come back with an empty barcode collection, while the same notes decode fine on
the handheld scanner.
Explain the cause before changing anything, then fix it in ReadDeliveryNote only.
Do not change the text extraction. Report how many notes return a barcode before
and after. Measure the current count first and base the explanation on what you
measured, not on a guess.
측정-우선 지침 없이 실행에서, Copilot은 처음에 해상도를 탓하고, 희미한 회색으로 인쇄된 QR 코드를 바코드 누락의 원인으로 추적하였으며, 고정된 영역을 자르고 한 가지 회색 음영을 선택하여 복원하였습니다. 페이지 아래쪽에 희미하게 인쇄된 코드가 있는 두 번째 세트에서는 그 수정이 아무것도 읽지 못했습니다. 지침과 함께, Copilot은 먼저 측정하고, 대비, 이진화, 업스케일링 및 자르기를 제외하고, 샤프닝 필터를 적용한 후 두 번째 읽기를 추가했습니다. Copilot이 이전에 본 적 없는 페이지에서 항상 수정을 테스트하십시오.
인식이 로컬에서 작동하지만 러너나 컨테이너에서 실패하면 Copilot에 요약이 아닌 전체 예외 메시지를 제공하십시오.
실제 실행에서 프롬프트가 무엇을 생성했습니까?
이 가이드의 모든 프롬프트는 두 개의 채팅에서 연속적으로 보내졌으며, 중앙 패키지 관리가 있는 .NET 9 콘솔 프로젝트, 송장 리더 및 알려진 값이 있는 스캔과 함께 수신 앱에서 실행되었습니다. 아래의 각 결과는 채팅 외부에서 다시 측정되었습니다.
- 바코드가 있는 배달 노트는 수정 전 9분의 6에서 수정 후 9분의 9로 늘었으며, 동일한 수정이 두 번째 세트에서 희미한 코드 12개 중 8개를 읽었습니다.
/tests스위트는 14분의 14를 통과했습니다. 또한 ImportJob의 콘솔 출력을 요청 없이 변경했고, 스캔이 아닌 구성된 기록에서 신뢰도 임계값을 테스트했습니다.- 네 가지 프롬프트 후 Release 빌드는 아무런 수동 편집 없이 깨끗했습니다.
- 두 파트는 페이지와 다르게 실행되었습니다. 사람은 라이선스 키를 테스트 프롬프트에 붙여넣었지만 Copilot은 그것을 모든 파일에서 제외했습니다. 설정 워크플로, 클라우드 에이전트, 관련 문제 및 에이전트 비밀은 GitHub Actions나 GitHub 저장소가 필요하므로 그 어느 것도 실행되지 않았습니다.
이 숫자 뒤의 비서판, 모델, 타이밍 및 테스트 머신은 런 기록에 있는 다른 가이드와 함께 나열되어 있습니다.
문제 해결
- 풀 리퀘스트가 빌드되지만 첫 번째 읽기가 라이선스 예외를 발생시키는 경우 IronOCR에서 라이선스 키 적용
- Linux 러너에 네이티브 의존성이 누락된 경우 Linux에서 IronOCR
- 추출된 값이 스캔과 다를 경우 OCR 정확도 개선
- 빌드 출력에서 네이티브 파일이 누락된 경우 IronOCR 런타임 폴더
질문?
질문이 있으시면 support@ironsoftware.com으로 문의하세요.
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.