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"
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.
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
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