xberg 1.0.0.pre.rc.19 → 1.0.0.pre.rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/xberg_rb/native/Cargo.lock +11 -11
- data/ext/xberg_rb/native/Cargo.toml +4 -4
- data/ext/xberg_rb/src/lib.rs +250 -17
- data/lib/xberg/native.rb +76 -1
- data/lib/xberg/version.rb +2 -2
- data/lib/xberg.rb +1 -1
- data/lib/xberg_rb.so +0 -0
- data/sig/types.rbs +22 -7
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f357179c1ad3a2d78fc33a5565eea6ad47070d2dc852c90f671f021e50f877e7
|
|
4
|
+
data.tar.gz: cde1eeb18c1d1448e1a5685f876cf318a4832ebcf711cfa4521d139dd9864678
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa06b3f66bb2e4d97c27b4b8bce0c1de267d835441848be857aef18da451964cf81fb6488ed419f49322232d30d565cd89f35a2cd8cea8d1d8da1605132ed8ba
|
|
7
|
+
data.tar.gz: 41f4ebdc94c4e5d7ae3f3c10968f66612d25cf119edfdb9acbb435efef4a32b488e8c02992a601e47f60bd8298858617aace8faf34519c5083ed94baaf74e2b0
|
|
@@ -8233,9 +8233,9 @@ dependencies = [
|
|
|
8233
8233
|
|
|
8234
8234
|
[[package]]
|
|
8235
8235
|
name = "xberg"
|
|
8236
|
-
version = "1.0.0-rc.
|
|
8236
|
+
version = "1.0.0-rc.20"
|
|
8237
8237
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
8238
|
-
checksum = "
|
|
8238
|
+
checksum = "b8cf06b497fa85f72e34dac11316ae36551db41a59e93743fbdef4f0690de92c"
|
|
8239
8239
|
dependencies = [
|
|
8240
8240
|
"ahash 0.8.12",
|
|
8241
8241
|
"async-trait",
|
|
@@ -8352,9 +8352,9 @@ dependencies = [
|
|
|
8352
8352
|
|
|
8353
8353
|
[[package]]
|
|
8354
8354
|
name = "xberg-gliner"
|
|
8355
|
-
version = "1.0.0-rc.
|
|
8355
|
+
version = "1.0.0-rc.20"
|
|
8356
8356
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
8357
|
-
checksum = "
|
|
8357
|
+
checksum = "dcd5a0a6088686c158f92618a2639a3107794c4018f4f9633d9a733182287257"
|
|
8358
8358
|
dependencies = [
|
|
8359
8359
|
"ndarray 0.17.2",
|
|
8360
8360
|
"ort",
|
|
@@ -8366,9 +8366,9 @@ dependencies = [
|
|
|
8366
8366
|
|
|
8367
8367
|
[[package]]
|
|
8368
8368
|
name = "xberg-libheif"
|
|
8369
|
-
version = "1.0.0-rc.
|
|
8369
|
+
version = "1.0.0-rc.20"
|
|
8370
8370
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
8371
|
-
checksum = "
|
|
8371
|
+
checksum = "cf76ec8a52f0f671435a8b0cc5f9ec687ff8741c94e04b82c85008f24c835b84"
|
|
8372
8372
|
dependencies = [
|
|
8373
8373
|
"cfg-if",
|
|
8374
8374
|
"enumn",
|
|
@@ -8379,9 +8379,9 @@ dependencies = [
|
|
|
8379
8379
|
|
|
8380
8380
|
[[package]]
|
|
8381
8381
|
name = "xberg-paddle-ocr"
|
|
8382
|
-
version = "1.0.0-rc.
|
|
8382
|
+
version = "1.0.0-rc.20"
|
|
8383
8383
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
8384
|
-
checksum = "
|
|
8384
|
+
checksum = "4ff214bb615d895a47e3642e7af5043a1741457fa18639428696f7808d9587f6"
|
|
8385
8385
|
dependencies = [
|
|
8386
8386
|
"geo-clipper",
|
|
8387
8387
|
"geo-types",
|
|
@@ -8396,7 +8396,7 @@ dependencies = [
|
|
|
8396
8396
|
|
|
8397
8397
|
[[package]]
|
|
8398
8398
|
name = "xberg-rb"
|
|
8399
|
-
version = "1.0.0-rc.
|
|
8399
|
+
version = "1.0.0-rc.20"
|
|
8400
8400
|
dependencies = [
|
|
8401
8401
|
"async-trait",
|
|
8402
8402
|
"crawlberg",
|
|
@@ -8410,9 +8410,9 @@ dependencies = [
|
|
|
8410
8410
|
|
|
8411
8411
|
[[package]]
|
|
8412
8412
|
name = "xberg-tesseract"
|
|
8413
|
-
version = "1.0.0-rc.
|
|
8413
|
+
version = "1.0.0-rc.20"
|
|
8414
8414
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
8415
|
-
checksum = "
|
|
8415
|
+
checksum = "509d7350ecd7a08a54be7579020ee890a98a8dee545d3e6dc33003b6677daf9a"
|
|
8416
8416
|
dependencies = [
|
|
8417
8417
|
"cc",
|
|
8418
8418
|
"cmake",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "xberg-rb"
|
|
3
|
-
version = "1.0.0-rc.
|
|
3
|
+
version = "1.0.0-rc.20"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
description = "High-performance document intelligence library"
|
|
@@ -62,10 +62,10 @@ serde = { version = "1", features = ["derive"] }
|
|
|
62
62
|
serde_json = "1"
|
|
63
63
|
tokio = { version = "1", features = ["rt-multi-thread"] }
|
|
64
64
|
[target.'cfg(not(any(target_os = "windows", all(target_os = "macos", target_arch = "x86_64"))))'.dependencies]
|
|
65
|
-
xberg = { version = "1.0.0-rc.
|
|
65
|
+
xberg = { version = "1.0.0-rc.20", features = ["full", "pdf", "ocr", "paddle-ocr", "paddle-ocr-types", "layout-detection", "layout-types", "embeddings", "embedding-presets", "reranker", "reranker-presets", "sparse-embeddings", "sparse-embedding-presets", "late-interaction", "late-interaction-presets", "chunking", "keywords-yake", "keywords-rake", "language-detection", "html", "tree-sitter", "office", "email", "archives", "stopwords", "auto-rotate", "auto-rotate-types", "tokio-runtime", "api", "api-types", "mcp", "liter-llm", "quality", "svg", "transcription", "transcription-types", "classification", "captioning", "ner-onnx", "ner-llm", "diff", "markdown-footnotes", "redaction", "enrichment", "heuristics", "presets", "structured", "url-ingestion"] }
|
|
66
66
|
|
|
67
67
|
[target.'cfg(target_os = "windows")'.dependencies]
|
|
68
|
-
xberg = { version = "1.0.0-rc.
|
|
68
|
+
xberg = { version = "1.0.0-rc.20", features = ["windows-target"] }
|
|
69
69
|
|
|
70
70
|
[target.'cfg(all(target_os = "macos", target_arch = "x86_64"))'.dependencies]
|
|
71
|
-
xberg = { version = "1.0.0-rc.
|
|
71
|
+
xberg = { version = "1.0.0-rc.20", features = ["macos-intel-target"] }
|
data/ext/xberg_rb/src/lib.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:597bd1ea631d4ac6d358d121dc5791450b5d9aaaabe53fda1e43bef2af72e4ac
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -558,6 +558,7 @@ pub struct ExtractionConfig {
|
|
|
558
558
|
enable_quality_processing: bool,
|
|
559
559
|
ocr: Option<OcrConfig>,
|
|
560
560
|
force_ocr: bool,
|
|
561
|
+
ocr_strategy: OcrStrategy,
|
|
561
562
|
force_ocr_pages: Option<Vec<u32>>,
|
|
562
563
|
disable_ocr: bool,
|
|
563
564
|
chunking: Option<ChunkingConfig>,
|
|
@@ -654,6 +655,10 @@ impl ExtractionConfig {
|
|
|
654
655
|
.get(ruby.to_symbol("force_ocr"))
|
|
655
656
|
.and_then(|v| bool::try_convert(v).ok())
|
|
656
657
|
.unwrap_or(false),
|
|
658
|
+
ocr_strategy: kwargs
|
|
659
|
+
.get(ruby.to_symbol("ocr_strategy"))
|
|
660
|
+
.and_then(|v| OcrStrategy::try_convert(v).ok())
|
|
661
|
+
.unwrap_or(OcrStrategy::Auto),
|
|
657
662
|
force_ocr_pages: kwargs
|
|
658
663
|
.get(ruby.to_symbol("force_ocr_pages"))
|
|
659
664
|
.and_then(|v| <Vec<u32>>::try_convert(v).ok()),
|
|
@@ -795,6 +800,10 @@ impl ExtractionConfig {
|
|
|
795
800
|
self.force_ocr
|
|
796
801
|
}
|
|
797
802
|
|
|
803
|
+
fn ocr_strategy(&self) -> OcrStrategy {
|
|
804
|
+
self.ocr_strategy.clone()
|
|
805
|
+
}
|
|
806
|
+
|
|
798
807
|
fn force_ocr_pages(&self) -> Option<Vec<u32>> {
|
|
799
808
|
self.force_ocr_pages.clone()
|
|
800
809
|
}
|
|
@@ -958,6 +967,8 @@ impl ExtractionConfig {
|
|
|
958
967
|
|
|
959
968
|
force_ocr: self.force_ocr,
|
|
960
969
|
|
|
970
|
+
ocr_strategy: self.ocr_strategy.clone().into(),
|
|
971
|
+
|
|
961
972
|
force_ocr_pages: self.force_ocr_pages.clone(),
|
|
962
973
|
|
|
963
974
|
disable_ocr: self.disable_ocr,
|
|
@@ -1038,6 +1049,8 @@ impl ExtractionConfig {
|
|
|
1038
1049
|
|
|
1039
1050
|
force_ocr: self.force_ocr,
|
|
1040
1051
|
|
|
1052
|
+
ocr_strategy: self.ocr_strategy.clone().into(),
|
|
1053
|
+
|
|
1041
1054
|
force_ocr_pages: self.force_ocr_pages.clone(),
|
|
1042
1055
|
|
|
1043
1056
|
disable_ocr: self.disable_ocr,
|
|
@@ -1115,6 +1128,7 @@ pub struct FileExtractionConfig {
|
|
|
1115
1128
|
enable_quality_processing: Option<bool>,
|
|
1116
1129
|
ocr: Option<OcrConfig>,
|
|
1117
1130
|
force_ocr: Option<bool>,
|
|
1131
|
+
ocr_strategy: Option<OcrStrategy>,
|
|
1118
1132
|
force_ocr_pages: Option<Vec<u32>>,
|
|
1119
1133
|
disable_ocr: Option<bool>,
|
|
1120
1134
|
chunking: Option<ChunkingConfig>,
|
|
@@ -1195,6 +1209,9 @@ impl FileExtractionConfig {
|
|
|
1195
1209
|
force_ocr: kwargs
|
|
1196
1210
|
.get(ruby.to_symbol("force_ocr"))
|
|
1197
1211
|
.and_then(|v| bool::try_convert(v).ok()),
|
|
1212
|
+
ocr_strategy: kwargs
|
|
1213
|
+
.get(ruby.to_symbol("ocr_strategy"))
|
|
1214
|
+
.and_then(|v| OcrStrategy::try_convert(v).ok()),
|
|
1198
1215
|
force_ocr_pages: kwargs
|
|
1199
1216
|
.get(ruby.to_symbol("force_ocr_pages"))
|
|
1200
1217
|
.and_then(|v| <Vec<u32>>::try_convert(v).ok()),
|
|
@@ -1294,6 +1311,10 @@ impl FileExtractionConfig {
|
|
|
1294
1311
|
self.force_ocr
|
|
1295
1312
|
}
|
|
1296
1313
|
|
|
1314
|
+
fn ocr_strategy(&self) -> Option<OcrStrategy> {
|
|
1315
|
+
self.ocr_strategy.clone()
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1297
1318
|
fn force_ocr_pages(&self) -> Option<Vec<u32>> {
|
|
1298
1319
|
self.force_ocr_pages.clone()
|
|
1299
1320
|
}
|
|
@@ -3786,7 +3807,6 @@ pub struct HierarchyConfig {
|
|
|
3786
3807
|
enabled: bool,
|
|
3787
3808
|
k_clusters: usize,
|
|
3788
3809
|
include_bbox: bool,
|
|
3789
|
-
ocr_coverage_threshold: Option<f32>,
|
|
3790
3810
|
}
|
|
3791
3811
|
|
|
3792
3812
|
unsafe impl IntoValueFromNative for HierarchyConfig {}
|
|
@@ -3842,9 +3862,6 @@ impl HierarchyConfig {
|
|
|
3842
3862
|
.get(ruby.to_symbol("include_bbox"))
|
|
3843
3863
|
.and_then(|v| bool::try_convert(v).ok())
|
|
3844
3864
|
.unwrap_or(true),
|
|
3845
|
-
ocr_coverage_threshold: kwargs
|
|
3846
|
-
.get(ruby.to_symbol("ocr_coverage_threshold"))
|
|
3847
|
-
.and_then(|v| f32::try_convert(v).ok()),
|
|
3848
3865
|
})
|
|
3849
3866
|
}
|
|
3850
3867
|
|
|
@@ -3859,10 +3876,6 @@ impl HierarchyConfig {
|
|
|
3859
3876
|
fn include_bbox(&self) -> bool {
|
|
3860
3877
|
self.include_bbox
|
|
3861
3878
|
}
|
|
3862
|
-
|
|
3863
|
-
fn ocr_coverage_threshold(&self) -> Option<f32> {
|
|
3864
|
-
self.ocr_coverage_threshold
|
|
3865
|
-
}
|
|
3866
3879
|
}
|
|
3867
3880
|
|
|
3868
3881
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -4894,7 +4907,7 @@ impl TranscriptionConfig {
|
|
|
4894
4907
|
verify_hash: kwargs
|
|
4895
4908
|
.get(ruby.to_symbol("verify_hash"))
|
|
4896
4909
|
.and_then(|v| bool::try_convert(v).ok())
|
|
4897
|
-
.unwrap_or(
|
|
4910
|
+
.unwrap_or(false),
|
|
4898
4911
|
})
|
|
4899
4912
|
}
|
|
4900
4913
|
|
|
@@ -15711,6 +15724,75 @@ impl CellChange {
|
|
|
15711
15724
|
}
|
|
15712
15725
|
}
|
|
15713
15726
|
|
|
15727
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
15728
|
+
#[magnus::wrap(class = "Xberg::PropertyChange")]
|
|
15729
|
+
pub struct PropertyChange {
|
|
15730
|
+
name: String,
|
|
15731
|
+
from: Option<String>,
|
|
15732
|
+
to: Option<String>,
|
|
15733
|
+
}
|
|
15734
|
+
|
|
15735
|
+
unsafe impl IntoValueFromNative for PropertyChange {}
|
|
15736
|
+
|
|
15737
|
+
impl magnus::TryConvert for PropertyChange {
|
|
15738
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
15739
|
+
if let Ok(r) = <&PropertyChange as magnus::TryConvert>::try_convert(val) {
|
|
15740
|
+
return Ok(r.clone());
|
|
15741
|
+
}
|
|
15742
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
15743
|
+
s
|
|
15744
|
+
} else {
|
|
15745
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
15746
|
+
magnus::Error::new(
|
|
15747
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
15748
|
+
format!("no implicit conversion into PropertyChange: {}", e),
|
|
15749
|
+
)
|
|
15750
|
+
})?
|
|
15751
|
+
};
|
|
15752
|
+
serde_json::from_str::<PropertyChange>(&json_str).map_err(|e| {
|
|
15753
|
+
magnus::Error::new(
|
|
15754
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
15755
|
+
format!("failed to deserialize PropertyChange: {}", e),
|
|
15756
|
+
)
|
|
15757
|
+
})
|
|
15758
|
+
}
|
|
15759
|
+
}
|
|
15760
|
+
|
|
15761
|
+
unsafe impl TryConvertOwned for PropertyChange {}
|
|
15762
|
+
|
|
15763
|
+
impl PropertyChange {
|
|
15764
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
15765
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
15766
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
15767
|
+
let (kwargs_opt,) = args.optional;
|
|
15768
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
15769
|
+
Ok(Self {
|
|
15770
|
+
name: kwargs
|
|
15771
|
+
.get(ruby.to_symbol("name"))
|
|
15772
|
+
.and_then(|v| String::try_convert(v).ok())
|
|
15773
|
+
.unwrap_or_default(),
|
|
15774
|
+
from: kwargs
|
|
15775
|
+
.get(ruby.to_symbol("from"))
|
|
15776
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
15777
|
+
to: kwargs
|
|
15778
|
+
.get(ruby.to_symbol("to"))
|
|
15779
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
15780
|
+
})
|
|
15781
|
+
}
|
|
15782
|
+
|
|
15783
|
+
fn name(&self) -> String {
|
|
15784
|
+
self.name.clone()
|
|
15785
|
+
}
|
|
15786
|
+
|
|
15787
|
+
fn from(&self) -> Option<String> {
|
|
15788
|
+
self.from.clone()
|
|
15789
|
+
}
|
|
15790
|
+
|
|
15791
|
+
fn to(&self) -> Option<String> {
|
|
15792
|
+
self.to.clone()
|
|
15793
|
+
}
|
|
15794
|
+
}
|
|
15795
|
+
|
|
15714
15796
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
15715
15797
|
#[magnus::wrap(class = "Xberg::DocumentRevision")]
|
|
15716
15798
|
pub struct DocumentRevision {
|
|
@@ -15822,6 +15904,7 @@ impl DocumentRevision {
|
|
|
15822
15904
|
pub struct RevisionDelta {
|
|
15823
15905
|
content: Vec<DiffLine>,
|
|
15824
15906
|
table_changes: Vec<CellChange>,
|
|
15907
|
+
property_changes: Vec<PropertyChange>,
|
|
15825
15908
|
}
|
|
15826
15909
|
|
|
15827
15910
|
unsafe impl IntoValueFromNative for RevisionDelta {}
|
|
@@ -15873,6 +15956,10 @@ impl RevisionDelta {
|
|
|
15873
15956
|
.get(ruby.to_symbol("table_changes"))
|
|
15874
15957
|
.and_then(|v| <Vec<CellChange>>::try_convert(v).ok())
|
|
15875
15958
|
.unwrap_or_default(),
|
|
15959
|
+
property_changes: kwargs
|
|
15960
|
+
.get(ruby.to_symbol("property_changes"))
|
|
15961
|
+
.and_then(|v| <Vec<PropertyChange>>::try_convert(v).ok())
|
|
15962
|
+
.unwrap_or_default(),
|
|
15876
15963
|
})
|
|
15877
15964
|
}
|
|
15878
15965
|
|
|
@@ -15883,6 +15970,10 @@ impl RevisionDelta {
|
|
|
15883
15970
|
fn table_changes(&self) -> Vec<CellChange> {
|
|
15884
15971
|
self.table_changes.clone()
|
|
15885
15972
|
}
|
|
15973
|
+
|
|
15974
|
+
fn property_changes(&self) -> Vec<PropertyChange> {
|
|
15975
|
+
self.property_changes.clone()
|
|
15976
|
+
}
|
|
15886
15977
|
}
|
|
15887
15978
|
|
|
15888
15979
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -20319,6 +20410,8 @@ pub struct PdfMetadata {
|
|
|
20319
20410
|
width: Option<i64>,
|
|
20320
20411
|
height: Option<i64>,
|
|
20321
20412
|
page_count: Option<u32>,
|
|
20413
|
+
scanned_confidence: Option<f32>,
|
|
20414
|
+
scanned_pages: Option<Vec<u32>>,
|
|
20322
20415
|
}
|
|
20323
20416
|
|
|
20324
20417
|
unsafe impl IntoValueFromNative for PdfMetadata {}
|
|
@@ -20380,6 +20473,12 @@ impl PdfMetadata {
|
|
|
20380
20473
|
page_count: kwargs
|
|
20381
20474
|
.get(ruby.to_symbol("page_count"))
|
|
20382
20475
|
.and_then(|v| u32::try_convert(v).ok()),
|
|
20476
|
+
scanned_confidence: kwargs
|
|
20477
|
+
.get(ruby.to_symbol("scanned_confidence"))
|
|
20478
|
+
.and_then(|v| f32::try_convert(v).ok()),
|
|
20479
|
+
scanned_pages: kwargs
|
|
20480
|
+
.get(ruby.to_symbol("scanned_pages"))
|
|
20481
|
+
.and_then(|v| <Vec<u32>>::try_convert(v).ok()),
|
|
20383
20482
|
})
|
|
20384
20483
|
}
|
|
20385
20484
|
|
|
@@ -20406,6 +20505,14 @@ impl PdfMetadata {
|
|
|
20406
20505
|
fn page_count(&self) -> Option<u32> {
|
|
20407
20506
|
self.page_count
|
|
20408
20507
|
}
|
|
20508
|
+
|
|
20509
|
+
fn scanned_confidence(&self) -> Option<f32> {
|
|
20510
|
+
self.scanned_confidence
|
|
20511
|
+
}
|
|
20512
|
+
|
|
20513
|
+
fn scanned_pages(&self) -> Option<Vec<u32>> {
|
|
20514
|
+
self.scanned_pages.clone()
|
|
20515
|
+
}
|
|
20409
20516
|
}
|
|
20410
20517
|
|
|
20411
20518
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -22126,6 +22233,65 @@ unsafe impl IntoValueFromNative for VlmFallbackPolicy {}
|
|
|
22126
22233
|
unsafe impl TryConvertOwned for VlmFallbackPolicy {}
|
|
22127
22234
|
impl VlmFallbackPolicy {}
|
|
22128
22235
|
|
|
22236
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
22237
|
+
#[serde(tag = "mode")]
|
|
22238
|
+
#[serde(rename_all = "snake_case")]
|
|
22239
|
+
pub enum OcrStrategy {
|
|
22240
|
+
Auto,
|
|
22241
|
+
ScannedPages { min_confidence: f64 },
|
|
22242
|
+
}
|
|
22243
|
+
|
|
22244
|
+
impl Default for OcrStrategy {
|
|
22245
|
+
fn default() -> Self {
|
|
22246
|
+
Self::Auto
|
|
22247
|
+
}
|
|
22248
|
+
}
|
|
22249
|
+
|
|
22250
|
+
impl magnus::IntoValue for OcrStrategy {
|
|
22251
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
22252
|
+
match serde_json::to_value(&self) {
|
|
22253
|
+
Ok(v) => json_to_ruby(handle, v),
|
|
22254
|
+
Err(_) => handle.qnil().into_value_with(handle),
|
|
22255
|
+
}
|
|
22256
|
+
}
|
|
22257
|
+
}
|
|
22258
|
+
|
|
22259
|
+
impl magnus::TryConvert for OcrStrategy {
|
|
22260
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
22261
|
+
// For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
22262
|
+
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
22263
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
22264
|
+
s
|
|
22265
|
+
} else {
|
|
22266
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
22267
|
+
magnus::Error::new(
|
|
22268
|
+
unsafe { Ruby::get_unchecked() }.exception_type_error(),
|
|
22269
|
+
format!("no implicit conversion into OcrStrategy: {}", e),
|
|
22270
|
+
)
|
|
22271
|
+
})?
|
|
22272
|
+
};
|
|
22273
|
+
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
22274
|
+
// For internally-tagged enums, a bare variant string is wrapped as {"<tag>": value}.
|
|
22275
|
+
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
22276
|
+
// If both fail, try as Custom variant (for untagged enum support)
|
|
22277
|
+
serde_json::from_str(&json_str)
|
|
22278
|
+
.or_else(|_| serde_json::from_value(serde_json::json!({ "mode": json_str })))
|
|
22279
|
+
.or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
|
|
22280
|
+
.or_else(|_| {
|
|
22281
|
+
// Try as a JSON string for Custom variant (untagged enums accept any remaining value)
|
|
22282
|
+
match serde_json::to_value(&json_str) {
|
|
22283
|
+
Ok(val) => serde_json::from_value(val),
|
|
22284
|
+
Err(e) => Err(e),
|
|
22285
|
+
}
|
|
22286
|
+
})
|
|
22287
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))
|
|
22288
|
+
}
|
|
22289
|
+
}
|
|
22290
|
+
|
|
22291
|
+
unsafe impl IntoValueFromNative for OcrStrategy {}
|
|
22292
|
+
unsafe impl TryConvertOwned for OcrStrategy {}
|
|
22293
|
+
impl OcrStrategy {}
|
|
22294
|
+
|
|
22129
22295
|
#[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
|
|
22130
22296
|
#[serde(rename_all = "snake_case")]
|
|
22131
22297
|
pub enum TableChunkingMode {
|
|
@@ -29080,6 +29246,7 @@ impl From<ExtractionConfig> for xberg::ExtractionConfig {
|
|
|
29080
29246
|
enable_quality_processing: val.enable_quality_processing,
|
|
29081
29247
|
ocr: val.ocr.map(Into::into),
|
|
29082
29248
|
force_ocr: val.force_ocr,
|
|
29249
|
+
ocr_strategy: val.ocr_strategy.into(),
|
|
29083
29250
|
force_ocr_pages: val.force_ocr_pages.map(|v| v.into_iter().collect()),
|
|
29084
29251
|
disable_ocr: val.disable_ocr,
|
|
29085
29252
|
chunking: val.chunking.map(Into::into),
|
|
@@ -29131,6 +29298,7 @@ impl From<xberg::ExtractionConfig> for ExtractionConfig {
|
|
|
29131
29298
|
enable_quality_processing: val.enable_quality_processing,
|
|
29132
29299
|
ocr: val.ocr.map(Into::into),
|
|
29133
29300
|
force_ocr: val.force_ocr,
|
|
29301
|
+
ocr_strategy: val.ocr_strategy.into(),
|
|
29134
29302
|
force_ocr_pages: val.force_ocr_pages.map(|v| v.into_iter().collect()),
|
|
29135
29303
|
disable_ocr: val.disable_ocr,
|
|
29136
29304
|
chunking: val.chunking.map(Into::into),
|
|
@@ -29181,6 +29349,7 @@ impl From<FileExtractionConfig> for xberg::FileExtractionConfig {
|
|
|
29181
29349
|
enable_quality_processing: val.enable_quality_processing,
|
|
29182
29350
|
ocr: val.ocr.map(Into::into),
|
|
29183
29351
|
force_ocr: val.force_ocr,
|
|
29352
|
+
ocr_strategy: val.ocr_strategy.map(Into::into),
|
|
29184
29353
|
force_ocr_pages: val.force_ocr_pages.map(|v| v.into_iter().collect()),
|
|
29185
29354
|
disable_ocr: val.disable_ocr,
|
|
29186
29355
|
chunking: val.chunking.map(Into::into),
|
|
@@ -29221,6 +29390,7 @@ impl From<xberg::FileExtractionConfig> for FileExtractionConfig {
|
|
|
29221
29390
|
enable_quality_processing: val.enable_quality_processing,
|
|
29222
29391
|
ocr: val.ocr.map(Into::into),
|
|
29223
29392
|
force_ocr: val.force_ocr,
|
|
29393
|
+
ocr_strategy: val.ocr_strategy.map(Into::into),
|
|
29224
29394
|
force_ocr_pages: val.force_ocr_pages.map(|v| v.into_iter().collect()),
|
|
29225
29395
|
disable_ocr: val.disable_ocr,
|
|
29226
29396
|
chunking: val.chunking.map(Into::into),
|
|
@@ -29935,7 +30105,6 @@ impl From<HierarchyConfig> for xberg::HierarchyConfig {
|
|
|
29935
30105
|
enabled: val.enabled,
|
|
29936
30106
|
k_clusters: val.k_clusters,
|
|
29937
30107
|
include_bbox: val.include_bbox,
|
|
29938
|
-
ocr_coverage_threshold: val.ocr_coverage_threshold,
|
|
29939
30108
|
..Default::default()
|
|
29940
30109
|
}
|
|
29941
30110
|
}
|
|
@@ -29948,7 +30117,6 @@ impl From<xberg::HierarchyConfig> for HierarchyConfig {
|
|
|
29948
30117
|
enabled: val.enabled,
|
|
29949
30118
|
k_clusters: val.k_clusters,
|
|
29950
30119
|
include_bbox: val.include_bbox,
|
|
29951
|
-
ocr_coverage_threshold: val.ocr_coverage_threshold,
|
|
29952
30120
|
}
|
|
29953
30121
|
}
|
|
29954
30122
|
}
|
|
@@ -33102,6 +33270,28 @@ impl From<xberg::CellChange> for CellChange {
|
|
|
33102
33270
|
}
|
|
33103
33271
|
}
|
|
33104
33272
|
|
|
33273
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
33274
|
+
impl From<PropertyChange> for xberg::PropertyChange {
|
|
33275
|
+
fn from(val: PropertyChange) -> Self {
|
|
33276
|
+
Self {
|
|
33277
|
+
name: val.name,
|
|
33278
|
+
from: val.from,
|
|
33279
|
+
to: val.to,
|
|
33280
|
+
}
|
|
33281
|
+
}
|
|
33282
|
+
}
|
|
33283
|
+
|
|
33284
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
33285
|
+
impl From<xberg::PropertyChange> for PropertyChange {
|
|
33286
|
+
fn from(val: xberg::PropertyChange) -> Self {
|
|
33287
|
+
Self {
|
|
33288
|
+
name: val.name.to_string(),
|
|
33289
|
+
from: val.from.map(|v| v.to_string()),
|
|
33290
|
+
to: val.to.map(|v| v.to_string()),
|
|
33291
|
+
}
|
|
33292
|
+
}
|
|
33293
|
+
}
|
|
33294
|
+
|
|
33105
33295
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
33106
33296
|
impl From<DocumentRevision> for xberg::DocumentRevision {
|
|
33107
33297
|
fn from(val: DocumentRevision) -> Self {
|
|
@@ -33137,6 +33327,7 @@ impl From<RevisionDelta> for xberg::RevisionDelta {
|
|
|
33137
33327
|
Self {
|
|
33138
33328
|
content: val.content.into_iter().map(Into::into).collect(),
|
|
33139
33329
|
table_changes: val.table_changes.into_iter().map(Into::into).collect(),
|
|
33330
|
+
property_changes: val.property_changes.into_iter().map(Into::into).collect(),
|
|
33140
33331
|
..Default::default()
|
|
33141
33332
|
}
|
|
33142
33333
|
}
|
|
@@ -33148,6 +33339,7 @@ impl From<xberg::RevisionDelta> for RevisionDelta {
|
|
|
33148
33339
|
Self {
|
|
33149
33340
|
content: val.content.into_iter().map(Into::into).collect(),
|
|
33150
33341
|
table_changes: val.table_changes.into_iter().map(Into::into).collect(),
|
|
33342
|
+
property_changes: val.property_changes.into_iter().map(Into::into).collect(),
|
|
33151
33343
|
}
|
|
33152
33344
|
}
|
|
33153
33345
|
}
|
|
@@ -33984,6 +34176,8 @@ impl From<PdfMetadata> for xberg::pdf::metadata::PdfMetadata {
|
|
|
33984
34176
|
width: val.width,
|
|
33985
34177
|
height: val.height,
|
|
33986
34178
|
page_count: val.page_count,
|
|
34179
|
+
scanned_confidence: val.scanned_confidence,
|
|
34180
|
+
scanned_pages: val.scanned_pages.map(|v| v.into_iter().collect()),
|
|
33987
34181
|
..Default::default()
|
|
33988
34182
|
}
|
|
33989
34183
|
}
|
|
@@ -33999,6 +34193,8 @@ impl From<xberg::pdf::metadata::PdfMetadata> for PdfMetadata {
|
|
|
33999
34193
|
width: val.width,
|
|
34000
34194
|
height: val.height,
|
|
34001
34195
|
page_count: val.page_count,
|
|
34196
|
+
scanned_confidence: val.scanned_confidence,
|
|
34197
|
+
scanned_pages: val.scanned_pages.map(|v| v.into_iter().collect()),
|
|
34002
34198
|
}
|
|
34003
34199
|
}
|
|
34004
34200
|
}
|
|
@@ -34613,6 +34809,28 @@ impl From<xberg::VlmFallbackPolicy> for VlmFallbackPolicy {
|
|
|
34613
34809
|
}
|
|
34614
34810
|
}
|
|
34615
34811
|
|
|
34812
|
+
impl From<OcrStrategy> for xberg::OcrStrategy {
|
|
34813
|
+
fn from(val: OcrStrategy) -> Self {
|
|
34814
|
+
match val {
|
|
34815
|
+
OcrStrategy::Auto => Self::Auto,
|
|
34816
|
+
OcrStrategy::ScannedPages { min_confidence } => Self::ScannedPages {
|
|
34817
|
+
min_confidence: min_confidence,
|
|
34818
|
+
},
|
|
34819
|
+
}
|
|
34820
|
+
}
|
|
34821
|
+
}
|
|
34822
|
+
|
|
34823
|
+
impl From<xberg::OcrStrategy> for OcrStrategy {
|
|
34824
|
+
fn from(val: xberg::OcrStrategy) -> Self {
|
|
34825
|
+
match val {
|
|
34826
|
+
xberg::OcrStrategy::Auto => Self::Auto,
|
|
34827
|
+
xberg::OcrStrategy::ScannedPages { min_confidence } => Self::ScannedPages {
|
|
34828
|
+
min_confidence: min_confidence,
|
|
34829
|
+
},
|
|
34830
|
+
}
|
|
34831
|
+
}
|
|
34832
|
+
}
|
|
34833
|
+
|
|
34616
34834
|
impl From<TableChunkingMode> for xberg::TableChunkingMode {
|
|
34617
34835
|
fn from(val: TableChunkingMode) -> Self {
|
|
34618
34836
|
match val {
|
|
@@ -36370,6 +36588,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
36370
36588
|
|
|
36371
36589
|
class.define_method("force_ocr", method!(ExtractionConfig::force_ocr, 0))?;
|
|
36372
36590
|
|
|
36591
|
+
class.define_method("ocr_strategy", method!(ExtractionConfig::ocr_strategy, 0))?;
|
|
36592
|
+
|
|
36373
36593
|
class.define_method("force_ocr_pages", method!(ExtractionConfig::force_ocr_pages, 0))?;
|
|
36374
36594
|
|
|
36375
36595
|
class.define_method("disable_ocr", method!(ExtractionConfig::disable_ocr, 0))?;
|
|
@@ -36487,6 +36707,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
36487
36707
|
|
|
36488
36708
|
class.define_method("force_ocr", method!(FileExtractionConfig::force_ocr, 0))?;
|
|
36489
36709
|
|
|
36710
|
+
class.define_method("ocr_strategy", method!(FileExtractionConfig::ocr_strategy, 0))?;
|
|
36711
|
+
|
|
36490
36712
|
class.define_method("force_ocr_pages", method!(FileExtractionConfig::force_ocr_pages, 0))?;
|
|
36491
36713
|
|
|
36492
36714
|
class.define_method("disable_ocr", method!(FileExtractionConfig::disable_ocr, 0))?;
|
|
@@ -37045,11 +37267,6 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
37045
37267
|
|
|
37046
37268
|
class.define_method("include_bbox", method!(HierarchyConfig::include_bbox, 0))?;
|
|
37047
37269
|
|
|
37048
|
-
class.define_method(
|
|
37049
|
-
"ocr_coverage_threshold",
|
|
37050
|
-
method!(HierarchyConfig::ocr_coverage_threshold, 0),
|
|
37051
|
-
)?;
|
|
37052
|
-
|
|
37053
37270
|
let class = module.define_class("PostProcessorConfig", ruby.class_object())?;
|
|
37054
37271
|
|
|
37055
37272
|
class.define_singleton_method("new", function!(PostProcessorConfig::new, -1))?;
|
|
@@ -39001,6 +39218,16 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
39001
39218
|
|
|
39002
39219
|
class.define_method("to", method!(CellChange::to, 0))?;
|
|
39003
39220
|
|
|
39221
|
+
let class = module.define_class("PropertyChange", ruby.class_object())?;
|
|
39222
|
+
|
|
39223
|
+
class.define_singleton_method("new", function!(PropertyChange::new, -1))?;
|
|
39224
|
+
|
|
39225
|
+
class.define_method("name", method!(PropertyChange::name, 0))?;
|
|
39226
|
+
|
|
39227
|
+
class.define_method("from", method!(PropertyChange::from, 0))?;
|
|
39228
|
+
|
|
39229
|
+
class.define_method("to", method!(PropertyChange::to, 0))?;
|
|
39230
|
+
|
|
39004
39231
|
let class = module.define_class("DocumentRevision", ruby.class_object())?;
|
|
39005
39232
|
|
|
39006
39233
|
class.define_singleton_method("new", function!(DocumentRevision::new, -1))?;
|
|
@@ -39025,6 +39252,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
39025
39252
|
|
|
39026
39253
|
class.define_method("table_changes", method!(RevisionDelta::table_changes, 0))?;
|
|
39027
39254
|
|
|
39255
|
+
class.define_method("property_changes", method!(RevisionDelta::property_changes, 0))?;
|
|
39256
|
+
|
|
39028
39257
|
let class = module.define_class("DocumentSummary", ruby.class_object())?;
|
|
39029
39258
|
|
|
39030
39259
|
class.define_singleton_method("new", function!(DocumentSummary::new, -1))?;
|
|
@@ -39706,6 +39935,10 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
39706
39935
|
|
|
39707
39936
|
class.define_method("page_count", method!(PdfMetadata::page_count, 0))?;
|
|
39708
39937
|
|
|
39938
|
+
class.define_method("scanned_confidence", method!(PdfMetadata::scanned_confidence, 0))?;
|
|
39939
|
+
|
|
39940
|
+
class.define_method("scanned_pages", method!(PdfMetadata::scanned_pages, 0))?;
|
|
39941
|
+
|
|
39709
39942
|
let class = module.define_class("ProxyConfig", ruby.class_object())?;
|
|
39710
39943
|
|
|
39711
39944
|
class.define_singleton_method("new", function!(ProxyConfig::new, -1))?;
|
data/lib/xberg/native.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:597bd1ea631d4ac6d358d121dc5791450b5d9aaaabe53fda1e43bef2af72e4ac
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
@@ -459,6 +459,81 @@ module Xberg
|
|
|
459
459
|
end
|
|
460
460
|
end
|
|
461
461
|
|
|
462
|
+
module Xberg
|
|
463
|
+
# Which pages of a PDF get OCR'd when neither `force_ocr` nor `force_ocr_pages` applies.
|
|
464
|
+
module OcrStrategy
|
|
465
|
+
extend T::Helpers
|
|
466
|
+
extend T::Sig
|
|
467
|
+
|
|
468
|
+
interface!
|
|
469
|
+
|
|
470
|
+
# Dispatch from a Hash to the appropriate variant constructor.
|
|
471
|
+
# @param hash [Hash] with discriminator field and variant-specific fields
|
|
472
|
+
# @return [variant_class] an instance of the appropriate variant
|
|
473
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.untyped) }
|
|
474
|
+
def self.from_hash(hash)
|
|
475
|
+
discriminator = hash[:mode] || hash["mode"]
|
|
476
|
+
case discriminator
|
|
477
|
+
when "auto"
|
|
478
|
+
OcrStrategyAuto.from_hash(hash)
|
|
479
|
+
when "scanned_pages"
|
|
480
|
+
OcrStrategyScannedPages.from_hash(hash)
|
|
481
|
+
else
|
|
482
|
+
raise "Unknown discriminator: #{discriminator}"
|
|
483
|
+
end
|
|
484
|
+
end
|
|
485
|
+
end
|
|
486
|
+
## OCR only when the native text layer fails a quality check (default).
|
|
487
|
+
##
|
|
488
|
+
## A scanner's invisible OCR sidecar passes that check, so scanned pages
|
|
489
|
+
## carrying one are extracted natively. Use [`OcrStrategy::ScannedPages`]
|
|
490
|
+
## to OCR them instead.
|
|
491
|
+
OcrStrategyAuto = Data.define do
|
|
492
|
+
include OcrStrategy
|
|
493
|
+
extend T::Sig
|
|
494
|
+
|
|
495
|
+
sig { returns(T::Boolean) }
|
|
496
|
+
def auto? = true
|
|
497
|
+
sig { returns(T::Boolean) }
|
|
498
|
+
def scanned_pages? = false
|
|
499
|
+
# @param hash [Hash] deserialized from the native extension
|
|
500
|
+
# @return [self]
|
|
501
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
502
|
+
def self.from_hash(hash)
|
|
503
|
+
new
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
## Additionally OCR every page that looks like a scan.
|
|
507
|
+
##
|
|
508
|
+
## Pages are graded on raster coverage, whether the text layer is invisible
|
|
509
|
+
## or absent, the image codec, and the producer. Pages at or above
|
|
510
|
+
## `min_confidence` are OCR'd; the rest keep native text and still go through
|
|
511
|
+
## the `Auto` quality check.
|
|
512
|
+
##
|
|
513
|
+
## Detects that a text layer came from a scanner, not whether it is accurate,
|
|
514
|
+
## so a page carrying a good sidecar is OCR'd too.
|
|
515
|
+
OcrStrategyScannedPages = Data.define(:min_confidence) do
|
|
516
|
+
include OcrStrategy
|
|
517
|
+
extend T::Sig
|
|
518
|
+
|
|
519
|
+
# Minimum scan confidence, in `[0.0, 1.0]`. Values outside the range are
|
|
520
|
+
# clamped. See [`DEFAULT_SCANNED_MIN_CONFIDENCE`] for how to pick one.
|
|
521
|
+
sig { returns(Float) }
|
|
522
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
523
|
+
def min_confidence = super
|
|
524
|
+
sig { returns(T::Boolean) }
|
|
525
|
+
def auto? = false
|
|
526
|
+
sig { returns(T::Boolean) }
|
|
527
|
+
def scanned_pages? = true
|
|
528
|
+
# @param hash [Hash] deserialized from the native extension
|
|
529
|
+
# @return [self]
|
|
530
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
531
|
+
def self.from_hash(hash)
|
|
532
|
+
new(min_confidence: hash[:min_confidence] || hash["min_confidence"])
|
|
533
|
+
end
|
|
534
|
+
end
|
|
535
|
+
end
|
|
536
|
+
|
|
462
537
|
module Xberg
|
|
463
538
|
# How chunk size is measured.
|
|
464
539
|
#
|
data/lib/xberg/version.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:597bd1ea631d4ac6d358d121dc5791450b5d9aaaabe53fda1e43bef2af72e4ac
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
6
6
|
|
|
7
7
|
module Xberg
|
|
8
8
|
## The version string for this package.
|
|
9
|
-
VERSION = "1.0.0.pre.rc.
|
|
9
|
+
VERSION = "1.0.0.pre.rc.20"
|
|
10
10
|
end
|
data/lib/xberg.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:597bd1ea631d4ac6d358d121dc5791450b5d9aaaabe53fda1e43bef2af72e4ac
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
data/lib/xberg_rb.so
CHANGED
|
Binary file
|
data/sig/types.rbs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:597bd1ea631d4ac6d358d121dc5791450b5d9aaaabe53fda1e43bef2af72e4ac
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
|
|
@@ -64,6 +64,7 @@ def initialize: (?prompt_template: String, labels: Array[String], multi_label: b
|
|
|
64
64
|
attr_accessor enable_quality_processing: bool?
|
|
65
65
|
attr_accessor ocr: OcrConfig?
|
|
66
66
|
attr_accessor force_ocr: bool?
|
|
67
|
+
attr_accessor ocr_strategy: OcrStrategy?
|
|
67
68
|
attr_accessor force_ocr_pages: Array[Integer]?
|
|
68
69
|
attr_accessor disable_ocr: bool?
|
|
69
70
|
attr_accessor chunking: ChunkingConfig?
|
|
@@ -103,7 +104,7 @@ def initialize: (?prompt_template: String, labels: Array[String], multi_label: b
|
|
|
103
104
|
attr_accessor captioning: CaptioningConfig?
|
|
104
105
|
attr_accessor qr_codes: bool?
|
|
105
106
|
|
|
106
|
-
def initialize: (?use_cache: bool, ?enable_quality_processing: bool, ?ocr: OcrConfig, ?force_ocr: bool, ?force_ocr_pages: Array[Integer], ?disable_ocr: bool, ?chunking: ChunkingConfig, ?content_filter: ContentFilterConfig, ?images: ImageExtractionConfig, ?pdf_options: PdfConfig, ?token_reduction: TokenReductionOptions, ?language_detection: LanguageDetectionConfig, ?pages: PageConfig, ?keywords: KeywordConfig, ?postprocessor: PostProcessorConfig, ?html_output: HtmlOutputConfig, ?extraction_timeout_secs: Integer, ?max_concurrent_extractions: Integer, ?result_format: ResultFormat, ?security_limits: SecurityLimits, ?max_embedded_file_bytes: Integer, ?output_format: OutputFormat, ?jupyter_cell_rendering: JupyterCellRendering, ?layout: LayoutDetectionConfig, ?transcription: TranscriptionConfig, ?use_layout_for_markdown: bool, ?include_document_structure: bool, ?acceleration: AccelerationConfig, ?cache_namespace: String, ?cache_ttl_secs: Integer, ?email: EmailConfig, ?url: UrlExtractionConfig, ?max_archive_depth: Integer, ?tree_sitter: TreeSitterConfig, ?structured_extraction: StructuredExtractionConfig, ?ner: NerConfig, ?redaction: RedactionConfig, ?summarization: SummarizationConfig, ?translation: TranslationConfig, ?page_classification: PageClassificationConfig, ?captioning: CaptioningConfig, ?qr_codes: bool) -> void
|
|
107
|
+
def initialize: (?use_cache: bool, ?enable_quality_processing: bool, ?ocr: OcrConfig, ?force_ocr: bool, ?ocr_strategy: OcrStrategy, ?force_ocr_pages: Array[Integer], ?disable_ocr: bool, ?chunking: ChunkingConfig, ?content_filter: ContentFilterConfig, ?images: ImageExtractionConfig, ?pdf_options: PdfConfig, ?token_reduction: TokenReductionOptions, ?language_detection: LanguageDetectionConfig, ?pages: PageConfig, ?keywords: KeywordConfig, ?postprocessor: PostProcessorConfig, ?html_output: HtmlOutputConfig, ?extraction_timeout_secs: Integer, ?max_concurrent_extractions: Integer, ?result_format: ResultFormat, ?security_limits: SecurityLimits, ?max_embedded_file_bytes: Integer, ?output_format: OutputFormat, ?jupyter_cell_rendering: JupyterCellRendering, ?layout: LayoutDetectionConfig, ?transcription: TranscriptionConfig, ?use_layout_for_markdown: bool, ?include_document_structure: bool, ?acceleration: AccelerationConfig, ?cache_namespace: String, ?cache_ttl_secs: Integer, ?email: EmailConfig, ?url: UrlExtractionConfig, ?max_archive_depth: Integer, ?tree_sitter: TreeSitterConfig, ?structured_extraction: StructuredExtractionConfig, ?ner: NerConfig, ?redaction: RedactionConfig, ?summarization: SummarizationConfig, ?translation: TranslationConfig, ?page_classification: PageClassificationConfig, ?captioning: CaptioningConfig, ?qr_codes: bool) -> void
|
|
107
108
|
def needs_image_data: () -> bool
|
|
108
109
|
def needs_image_processing: () -> bool
|
|
109
110
|
def self.default: () -> ExtractionConfig
|
|
@@ -113,6 +114,7 @@ def initialize: (?use_cache: bool, ?enable_quality_processing: bool, ?ocr: OcrCo
|
|
|
113
114
|
attr_accessor enable_quality_processing: bool?
|
|
114
115
|
attr_accessor ocr: OcrConfig?
|
|
115
116
|
attr_accessor force_ocr: bool?
|
|
117
|
+
attr_accessor ocr_strategy: OcrStrategy?
|
|
116
118
|
attr_accessor force_ocr_pages: Array[Integer]?
|
|
117
119
|
attr_accessor disable_ocr: bool?
|
|
118
120
|
attr_accessor chunking: ChunkingConfig?
|
|
@@ -142,7 +144,7 @@ def initialize: (?use_cache: bool, ?enable_quality_processing: bool, ?ocr: OcrCo
|
|
|
142
144
|
attr_accessor captioning: CaptioningConfig?
|
|
143
145
|
attr_accessor qr_codes: bool?
|
|
144
146
|
|
|
145
|
-
def initialize: (?enable_quality_processing: bool, ?ocr: OcrConfig, ?force_ocr: bool, ?force_ocr_pages: Array[Integer], ?disable_ocr: bool, ?chunking: ChunkingConfig, ?content_filter: ContentFilterConfig, ?images: ImageExtractionConfig, ?pdf_options: PdfConfig, ?token_reduction: TokenReductionOptions, ?language_detection: LanguageDetectionConfig, ?pages: PageConfig, ?keywords: KeywordConfig, ?postprocessor: PostProcessorConfig, ?html_output: HtmlOutputConfig, ?result_format: ResultFormat, ?output_format: OutputFormat, ?include_document_structure: bool, ?layout: LayoutDetectionConfig, ?transcription: TranscriptionConfig, ?timeout_secs: Integer, ?tree_sitter: TreeSitterConfig, ?structured_extraction: StructuredExtractionConfig, ?url: UrlExtractionConfig, ?ner: NerConfig, ?redaction: RedactionConfig, ?summarization: SummarizationConfig, ?translation: TranslationConfig, ?page_classification: PageClassificationConfig, ?captioning: CaptioningConfig, ?qr_codes: bool) -> void
|
|
147
|
+
def initialize: (?enable_quality_processing: bool, ?ocr: OcrConfig, ?force_ocr: bool, ?ocr_strategy: OcrStrategy, ?force_ocr_pages: Array[Integer], ?disable_ocr: bool, ?chunking: ChunkingConfig, ?content_filter: ContentFilterConfig, ?images: ImageExtractionConfig, ?pdf_options: PdfConfig, ?token_reduction: TokenReductionOptions, ?language_detection: LanguageDetectionConfig, ?pages: PageConfig, ?keywords: KeywordConfig, ?postprocessor: PostProcessorConfig, ?html_output: HtmlOutputConfig, ?result_format: ResultFormat, ?output_format: OutputFormat, ?include_document_structure: bool, ?layout: LayoutDetectionConfig, ?transcription: TranscriptionConfig, ?timeout_secs: Integer, ?tree_sitter: TreeSitterConfig, ?structured_extraction: StructuredExtractionConfig, ?url: UrlExtractionConfig, ?ner: NerConfig, ?redaction: RedactionConfig, ?summarization: SummarizationConfig, ?translation: TranslationConfig, ?page_classification: PageClassificationConfig, ?captioning: CaptioningConfig, ?qr_codes: bool) -> void
|
|
146
148
|
end
|
|
147
149
|
|
|
148
150
|
class SvgOptions
|
|
@@ -417,9 +419,8 @@ def initialize: (?extract_images: bool, ?extract_tables: bool, ?passwords: Array
|
|
|
417
419
|
attr_accessor enabled: bool?
|
|
418
420
|
attr_accessor k_clusters: Integer?
|
|
419
421
|
attr_accessor include_bbox: bool?
|
|
420
|
-
attr_accessor ocr_coverage_threshold: Float?
|
|
421
422
|
|
|
422
|
-
def initialize: (?enabled: bool, ?k_clusters: Integer, ?include_bbox: bool
|
|
423
|
+
def initialize: (?enabled: bool, ?k_clusters: Integer, ?include_bbox: bool) -> void
|
|
423
424
|
def self.default: () -> HierarchyConfig
|
|
424
425
|
end
|
|
425
426
|
|
|
@@ -1704,6 +1705,14 @@ def initialize: (findings: Array[RedactionFinding], total_redacted: Integer) ->
|
|
|
1704
1705
|
def initialize: (row: Integer, col: Integer, from: String, to: String) -> void
|
|
1705
1706
|
end
|
|
1706
1707
|
|
|
1708
|
+
class PropertyChange
|
|
1709
|
+
attr_reader name: String
|
|
1710
|
+
attr_reader from: String
|
|
1711
|
+
attr_reader to: String
|
|
1712
|
+
|
|
1713
|
+
def initialize: (name: String, ?from: String, ?to: String) -> void
|
|
1714
|
+
end
|
|
1715
|
+
|
|
1707
1716
|
class DocumentRevision
|
|
1708
1717
|
attr_reader revision_id: String
|
|
1709
1718
|
attr_reader author: String
|
|
@@ -1718,8 +1727,9 @@ def initialize: (findings: Array[RedactionFinding], total_redacted: Integer) ->
|
|
|
1718
1727
|
class RevisionDelta
|
|
1719
1728
|
attr_accessor content: Array[DiffLine]?
|
|
1720
1729
|
attr_accessor table_changes: Array[CellChange]?
|
|
1730
|
+
attr_accessor property_changes: Array[PropertyChange]?
|
|
1721
1731
|
|
|
1722
|
-
def initialize: (?content: Array[DiffLine], ?table_changes: Array[CellChange]) -> void
|
|
1732
|
+
def initialize: (?content: Array[DiffLine], ?table_changes: Array[CellChange], ?property_changes: Array[PropertyChange]) -> void
|
|
1723
1733
|
end
|
|
1724
1734
|
|
|
1725
1735
|
class DocumentSummary
|
|
@@ -2182,8 +2192,10 @@ def initialize: (page_width: Integer, page_height: Integer, detections: Array[La
|
|
|
2182
2192
|
attr_accessor width: Integer?
|
|
2183
2193
|
attr_accessor height: Integer?
|
|
2184
2194
|
attr_accessor page_count: Integer?
|
|
2195
|
+
attr_accessor scanned_confidence: Float?
|
|
2196
|
+
attr_accessor scanned_pages: Array[Integer]?
|
|
2185
2197
|
|
|
2186
|
-
|
|
2198
|
+
def initialize: (?pdf_version: String, ?producer: String, ?is_encrypted: bool, ?width: Integer, ?height: Integer, ?page_count: Integer, ?scanned_confidence: Float, ?scanned_pages: Array[Integer]) -> void
|
|
2187
2199
|
end
|
|
2188
2200
|
|
|
2189
2201
|
class ProxyConfig
|
|
@@ -2347,6 +2359,9 @@ def initialize: (?urls: Array[SitemapUrl]) -> void
|
|
|
2347
2359
|
class VlmFallbackPolicy
|
|
2348
2360
|
end
|
|
2349
2361
|
|
|
2362
|
+
class OcrStrategy
|
|
2363
|
+
end
|
|
2364
|
+
|
|
2350
2365
|
class TableChunkingMode
|
|
2351
2366
|
type value = :split | :repeat_header
|
|
2352
2367
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xberg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0.pre.rc.
|
|
4
|
+
version: 1.0.0.pre.rc.20
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Na'aman Hirschfeld <naaman@xberg.io>
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rb_sys
|