Settings for Ocr. Values fall back through three levels: document → SDK → built-in default. Writes target the document only when set on a document’s settings, otherwise the SDK globally when set on SdkSettings.
Tags: Vision, Advanced
from nutrient_sdk import OcrSettingsConstruction
OcrSettings is accessed through a Document instance for per-document overrides, or via SdkSettings for SDK-wide defaults.
# Per-document overridewith Document.open("input.pdf") as doc: settings = doc.settings.ocr_settings settings.some_field = new_value # mutate fields directly
# SDK-wide default (applies to all documents)SdkSettings.ocr_settings.some_field = new_valueSettings are configured by writing to fields on the returned object. The settings property itself cannot be reassigned — doc.settings.ocr_settings = other_settings is rejected.
Properties
default_languages
@propertydef default_languages(self) -> str
@default_languages.setterdef default_languages(self, value: str) -> NoneDefault OCR languages to use (comma-separated language codes).
Type: str
Default: "eng"
detect_language_favor_accuracy
@propertydef detect_language_favor_accuracy(self) -> bool
@detect_language_favor_accuracy.setterdef detect_language_favor_accuracy(self, value: bool) -> NoneIndicates whether the automatic language-detection pass favors recognition accuracy over speed. The text this pass recognizes is never returned to the caller — it only feeds the language identifier, which reads word shape and character n-grams and tolerates per-character noise. Favoring accuracy therefore runs extra recognition passes refining glyph detail that nothing downstream reads. Enable it for the small share of pages whose language is identified from marginal text, at roughly a quarter more detection time. This is independent of FavorAccuracy, which governs the OCR whose text is returned.
Type: bool
Default: false
detect_language_once_per_document
@propertydef detect_language_once_per_document(self) -> bool
@detect_language_once_per_document.setterdef detect_language_once_per_document(self, value: bool) -> NoneIndicates whether automatic language detection (the "auto" OCR language) runs once for the whole document instead of once per page. When enabled, the first page that needs a language runs the detection and every other page of the same document reuses that result, so a document pays the detection cost once rather than once per page. Disable it to detect every page independently — what a document whose pages are in different languages needs — at the cost of a full page recognition pass per page.
Type: bool
Default: true
detect_language_page_fraction
@propertydef detect_language_page_fraction(self) -> float
@detect_language_page_fraction.setterdef detect_language_page_fraction(self, value: float) -> NoneThe share of a page (0.0 to 1.0) the automatic language-detection pass reads text from — a centered band of the page, full width. Identifying a language needs a couple of paragraphs, while the pass otherwise recognizes the whole page, and recognition cost scales with the amount of text read. A band that yields too little text falls back to the whole page, so this trades a rare second read for a much cheaper common case. Orientation and script detection always read the whole page. Set to 0 to read text from the whole page.
Type: float
Default: 0.5
enable_orientation_detection
@propertydef enable_orientation_detection(self) -> bool
@enable_orientation_detection.setterdef enable_orientation_detection(self, value: bool) -> NoneIndicates whether the OCR engine detects and compensates page orientation (90°/180°/270°) during recognition. The recognized text layout carries the correction; the source image or page is not rotated.
Type: bool
Default: false
enable_preprocessing
@propertydef enable_preprocessing(self) -> bool
@enable_preprocessing.setterdef enable_preprocessing(self, value: bool) -> NoneIndicates whether to enable image preprocessing before OCR.
Type: bool
Default: true
enable_skew_detection
@propertydef enable_skew_detection(self) -> bool
@enable_skew_detection.setterdef enable_skew_detection(self, value: bool) -> NoneIndicates whether to enable automatic skew detection and correction.
Type: bool
Default: true
enable_table_detection
@propertydef enable_table_detection(self) -> bool
@enable_table_detection.setterdef enable_table_detection(self, value: bool) -> NoneIndicates whether to detect and extract tables from OCR output.
Type: bool
Default: true
favor_accuracy
@propertydef favor_accuracy(self) -> bool
@favor_accuracy.setterdef favor_accuracy(self, value: bool) -> NoneIndicates whether to favor accuracy over speed in OCR processing. When enabled, the recognizer runs additional passes (inverted-text detection and layout refinement) that improve results on difficult scans at the cost of processing time. Disable to favor speed, for example in high-volume batch OCR.
Type: bool
Default: true
max_languages
@propertydef max_languages(self) -> int
@max_languages.setterdef max_languages(self, value: int) -> NoneMaximum number of languages to report from offline language detection. The default, 1, reports only the dominant language (no language mixing). Raise it (e.g. 2) to detect multiple languages in one document, including two languages that share a script (such as English + French).
Type: int
Default: 1
max_scripts
@propertydef max_scripts(self) -> int
@max_scripts.setterdef max_scripts(self, value: int) -> NoneMaximum number of writing scripts to recognize on a page during offline language detection (and the “auto” OCR path). The default, 1, recognizes only the dominant script (no script mixing) — fastest, and the original behavior. Raise it (e.g. 2) to handle cross-script documents such as Cyrillic + Han, where the page is OCR’d with each detected script’s model.
Type: int
Default: 1
max_threads
@propertydef max_threads(self) -> int
@max_threads.setterdef max_threads(self, value: int) -> NoneThe maximum number of pages processed concurrently when a document-level OCR operation (such as making a document searchable) runs over multiple pages. Set to 0 to use one thread per available processor. Values below 1 (other than 0) are treated as 1.
Type: int
Default: 1
min_language_vote_fraction
@propertydef min_language_vote_fraction(self) -> float
@min_language_vote_fraction.setterdef min_language_vote_fraction(self, value: float) -> NoneConsensus control for multi-language detection (only applies when MaxLanguages is greater than 1). A secondary language that is not present in the whole-page reading is reported only if the regions that detect it make up at least this fraction (0.0 to 1.0) of all regions. Works together with MinLanguageVotes to keep the extra language from being inferred from a negligible share of a long document.
Type: float
Default: 0.2
min_language_votes
@propertydef min_language_votes(self) -> int
@min_language_votes.setterdef min_language_votes(self, value: int) -> NoneConsensus control for multi-language detection (only applies when MaxLanguages is greater than 1). A secondary language that is not present in the whole-page reading is reported only if it is detected in at least this many text regions. Raising it improves precision — it suppresses a spurious extra language inferred from a single noisy region — at a small cost to recall of a genuine minority language that appears in only one region.
Type: int
Default: 2
min_script_ratio
@propertydef min_script_ratio(self) -> float
@min_script_ratio.setterdef min_script_ratio(self, value: float) -> NoneMinimum share of a page (0.0 to 1.0) a secondary writing script must occupy before the page is also read with that script’s model (only applies when MaxScripts is greater than 1). Raising it improves precision: it stops a faint, spurious script — often lookalike letters a second script’s model misreads from the dominant script — from being read at all, which is a common source of a wrongly reported extra language. The dominant script is always read.
Type: float
Default: 0.2