xberg 1.2.9 → 1.3.2
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 +209 -177
- data/ext/xberg_rb/native/Cargo.toml +8 -8
- data/ext/xberg_rb/src/lib.rs +1446 -151
- data/lib/xberg/version.rb +2 -2
- data/sig/types.rbs +57 -13
- metadata +2 -2
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:e004b1d953b206d06d83d0462afc0689784b447478a1e0085a43e79980b1fd22
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
clippy::useless_conversion,
|
|
19
19
|
clippy::clone_on_copy
|
|
20
20
|
)]
|
|
21
|
+
#![allow(deprecated)]
|
|
21
22
|
|
|
22
23
|
use async_trait::async_trait;
|
|
23
24
|
use magnus::{Error, IntoValueFromNative, Ruby, function, method, prelude::*, try_convert::TryConvertOwned};
|
|
@@ -1134,6 +1135,8 @@ pub struct BrowserConfig {
|
|
|
1134
1135
|
endpoint: Option<String>,
|
|
1135
1136
|
#[serde(default = "default_timeout")]
|
|
1136
1137
|
timeout: u64,
|
|
1138
|
+
overall_timeout: u64,
|
|
1139
|
+
shutdown_timeout: u64,
|
|
1137
1140
|
wait: BrowserWait,
|
|
1138
1141
|
wait_selector: Option<String>,
|
|
1139
1142
|
extra_wait: Option<u64>,
|
|
@@ -1230,6 +1233,24 @@ impl BrowserConfig {
|
|
|
1230
1233
|
})?,
|
|
1231
1234
|
None => 30000,
|
|
1232
1235
|
},
|
|
1236
|
+
overall_timeout: match kwargs.get(ruby.to_symbol("overall_timeout")) {
|
|
1237
|
+
Some(v) => u64::try_convert(v).map_err(|e| {
|
|
1238
|
+
magnus::Error::new(
|
|
1239
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1240
|
+
format!("invalid value for `overall_timeout`: {}", e),
|
|
1241
|
+
)
|
|
1242
|
+
})?,
|
|
1243
|
+
None => 60000,
|
|
1244
|
+
},
|
|
1245
|
+
shutdown_timeout: match kwargs.get(ruby.to_symbol("shutdown_timeout")) {
|
|
1246
|
+
Some(v) => u64::try_convert(v).map_err(|e| {
|
|
1247
|
+
magnus::Error::new(
|
|
1248
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1249
|
+
format!("invalid value for `shutdown_timeout`: {}", e),
|
|
1250
|
+
)
|
|
1251
|
+
})?,
|
|
1252
|
+
None => 5000,
|
|
1253
|
+
},
|
|
1233
1254
|
wait: match kwargs.get(ruby.to_symbol("wait")) {
|
|
1234
1255
|
Some(v) => BrowserWait::try_convert(v).map_err(|e| {
|
|
1235
1256
|
magnus::Error::new(
|
|
@@ -1330,6 +1351,14 @@ impl BrowserConfig {
|
|
|
1330
1351
|
self.timeout.clone()
|
|
1331
1352
|
}
|
|
1332
1353
|
|
|
1354
|
+
fn overall_timeout(&self) -> u64 {
|
|
1355
|
+
self.overall_timeout.clone()
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
fn shutdown_timeout(&self) -> u64 {
|
|
1359
|
+
self.shutdown_timeout.clone()
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1333
1362
|
fn wait(&self) -> BrowserWait {
|
|
1334
1363
|
self.wait.clone()
|
|
1335
1364
|
}
|
|
@@ -1487,6 +1516,7 @@ pub struct CaptioningConfig {
|
|
|
1487
1516
|
llm: LlmConfig,
|
|
1488
1517
|
prompt: Option<String>,
|
|
1489
1518
|
min_image_area: u32,
|
|
1519
|
+
alt_text: CaptionAltTextMode,
|
|
1490
1520
|
}
|
|
1491
1521
|
|
|
1492
1522
|
unsafe impl IntoValueFromNative for CaptioningConfig {}
|
|
@@ -1531,6 +1561,7 @@ impl Default for CaptioningConfig {
|
|
|
1531
1561
|
llm: LlmConfig::default(),
|
|
1532
1562
|
prompt: None,
|
|
1533
1563
|
min_image_area: 1000,
|
|
1564
|
+
alt_text: CaptionAltTextMode::Preserve,
|
|
1534
1565
|
}
|
|
1535
1566
|
}
|
|
1536
1567
|
}
|
|
@@ -1574,6 +1605,15 @@ impl CaptioningConfig {
|
|
|
1574
1605
|
})?,
|
|
1575
1606
|
None => 1000,
|
|
1576
1607
|
},
|
|
1608
|
+
alt_text: match kwargs.get(ruby.to_symbol("alt_text")) {
|
|
1609
|
+
Some(v) => CaptionAltTextMode::try_convert(v).map_err(|e| {
|
|
1610
|
+
magnus::Error::new(
|
|
1611
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1612
|
+
format!("invalid value for `alt_text`: {}", e),
|
|
1613
|
+
)
|
|
1614
|
+
})?,
|
|
1615
|
+
None => CaptionAltTextMode::Preserve,
|
|
1616
|
+
},
|
|
1577
1617
|
})
|
|
1578
1618
|
}
|
|
1579
1619
|
|
|
@@ -1588,6 +1628,10 @@ impl CaptioningConfig {
|
|
|
1588
1628
|
fn min_image_area(&self) -> u32 {
|
|
1589
1629
|
self.min_image_area
|
|
1590
1630
|
}
|
|
1631
|
+
|
|
1632
|
+
fn alt_text(&self) -> CaptionAltTextMode {
|
|
1633
|
+
self.alt_text.clone()
|
|
1634
|
+
}
|
|
1591
1635
|
}
|
|
1592
1636
|
|
|
1593
1637
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -1696,9 +1740,9 @@ pub struct Chunk {
|
|
|
1696
1740
|
content: String,
|
|
1697
1741
|
chunk_type: ChunkType,
|
|
1698
1742
|
embedding: Option<Vec<f32>>,
|
|
1699
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
1743
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
1700
1744
|
sparse_embedding: Option<SparseEmbedding>,
|
|
1701
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
1745
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
1702
1746
|
late_interaction: Option<MultiVectorEmbedding>,
|
|
1703
1747
|
metadata: ChunkMetadata,
|
|
1704
1748
|
}
|
|
@@ -1754,12 +1798,7 @@ impl Chunk {
|
|
|
1754
1798
|
format!("invalid value for `chunk_type`: {}", e),
|
|
1755
1799
|
)
|
|
1756
1800
|
})?,
|
|
1757
|
-
None =>
|
|
1758
|
-
return Err(magnus::Error::new(
|
|
1759
|
-
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
1760
|
-
"missing required field: chunk_type",
|
|
1761
|
-
));
|
|
1762
|
-
}
|
|
1801
|
+
None => ChunkType::Unknown,
|
|
1763
1802
|
},
|
|
1764
1803
|
embedding: match kwargs.get(ruby.to_symbol("embedding")).filter(|v| !v.is_nil()) {
|
|
1765
1804
|
Some(v) => Some(<Vec<f32>>::try_convert(v).map_err(|e| {
|
|
@@ -1770,7 +1809,7 @@ impl Chunk {
|
|
|
1770
1809
|
})?),
|
|
1771
1810
|
None => None,
|
|
1772
1811
|
},
|
|
1773
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
1812
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
1774
1813
|
sparse_embedding: match kwargs.get(ruby.to_symbol("sparse_embedding")).filter(|v| !v.is_nil()) {
|
|
1775
1814
|
Some(v) => Some(SparseEmbedding::try_convert(v).map_err(|e| {
|
|
1776
1815
|
magnus::Error::new(
|
|
@@ -1780,7 +1819,7 @@ impl Chunk {
|
|
|
1780
1819
|
})?),
|
|
1781
1820
|
None => None,
|
|
1782
1821
|
},
|
|
1783
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
1822
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
1784
1823
|
late_interaction: match kwargs.get(ruby.to_symbol("late_interaction")).filter(|v| !v.is_nil()) {
|
|
1785
1824
|
Some(v) => Some(MultiVectorEmbedding::try_convert(v).map_err(|e| {
|
|
1786
1825
|
magnus::Error::new(
|
|
@@ -1819,12 +1858,12 @@ impl Chunk {
|
|
|
1819
1858
|
self.embedding.clone()
|
|
1820
1859
|
}
|
|
1821
1860
|
|
|
1822
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
1861
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
1823
1862
|
fn sparse_embedding(&self) -> Option<SparseEmbedding> {
|
|
1824
1863
|
self.sparse_embedding.clone()
|
|
1825
1864
|
}
|
|
1826
1865
|
|
|
1827
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
1866
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
1828
1867
|
fn late_interaction(&self) -> Option<MultiVectorEmbedding> {
|
|
1829
1868
|
self.late_interaction.clone()
|
|
1830
1869
|
}
|
|
@@ -3582,6 +3621,7 @@ pub struct ContentConfig {
|
|
|
3582
3621
|
wrap: bool,
|
|
3583
3622
|
wrap_width: usize,
|
|
3584
3623
|
include_document_structure: bool,
|
|
3624
|
+
extract_metadata: bool,
|
|
3585
3625
|
}
|
|
3586
3626
|
|
|
3587
3627
|
unsafe impl IntoValueFromNative for ContentConfig {}
|
|
@@ -3741,6 +3781,15 @@ impl ContentConfig {
|
|
|
3741
3781
|
})?,
|
|
3742
3782
|
None => true,
|
|
3743
3783
|
},
|
|
3784
|
+
extract_metadata: match kwargs.get(ruby.to_symbol("extract_metadata")) {
|
|
3785
|
+
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
3786
|
+
magnus::Error::new(
|
|
3787
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
3788
|
+
format!("invalid value for `extract_metadata`: {}", e),
|
|
3789
|
+
)
|
|
3790
|
+
})?,
|
|
3791
|
+
None => true,
|
|
3792
|
+
},
|
|
3744
3793
|
})
|
|
3745
3794
|
}
|
|
3746
3795
|
|
|
@@ -3791,6 +3840,10 @@ impl ContentConfig {
|
|
|
3791
3840
|
fn include_document_structure(&self) -> bool {
|
|
3792
3841
|
self.include_document_structure
|
|
3793
3842
|
}
|
|
3843
|
+
|
|
3844
|
+
fn extract_metadata(&self) -> bool {
|
|
3845
|
+
self.extract_metadata
|
|
3846
|
+
}
|
|
3794
3847
|
}
|
|
3795
3848
|
|
|
3796
3849
|
#[derive(Clone, Debug, serde::Serialize)]
|
|
@@ -4041,6 +4094,7 @@ pub struct ConversionOptions {
|
|
|
4041
4094
|
max_depth: Option<usize>,
|
|
4042
4095
|
exclude_selectors: Vec<String>,
|
|
4043
4096
|
tier_strategy: TierStrategy,
|
|
4097
|
+
base_url: Option<String>,
|
|
4044
4098
|
}
|
|
4045
4099
|
|
|
4046
4100
|
unsafe impl IntoValueFromNative for ConversionOptions {}
|
|
@@ -4471,6 +4525,15 @@ impl ConversionOptions {
|
|
|
4471
4525
|
})?,
|
|
4472
4526
|
None => TierStrategy::Auto,
|
|
4473
4527
|
},
|
|
4528
|
+
base_url: match kwargs.get(ruby.to_symbol("base_url")).filter(|v| !v.is_nil()) {
|
|
4529
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
4530
|
+
magnus::Error::new(
|
|
4531
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
4532
|
+
format!("invalid value for `base_url`: {}", e),
|
|
4533
|
+
)
|
|
4534
|
+
})?),
|
|
4535
|
+
None => None,
|
|
4536
|
+
},
|
|
4474
4537
|
})
|
|
4475
4538
|
}
|
|
4476
4539
|
|
|
@@ -4645,6 +4708,10 @@ impl ConversionOptions {
|
|
|
4645
4708
|
fn tier_strategy(&self) -> TierStrategy {
|
|
4646
4709
|
self.tier_strategy.clone()
|
|
4647
4710
|
}
|
|
4711
|
+
|
|
4712
|
+
fn base_url(&self) -> Option<String> {
|
|
4713
|
+
self.base_url.clone()
|
|
4714
|
+
}
|
|
4648
4715
|
}
|
|
4649
4716
|
|
|
4650
4717
|
#[cfg(feature = "office")]
|
|
@@ -4933,6 +5000,10 @@ pub struct CrawlConfig {
|
|
|
4933
5000
|
allow_subdomains: bool,
|
|
4934
5001
|
include_paths: Vec<String>,
|
|
4935
5002
|
exclude_paths: Vec<String>,
|
|
5003
|
+
path_patterns_match_query: bool,
|
|
5004
|
+
dedup_include_query: bool,
|
|
5005
|
+
strip_tracking_params: bool,
|
|
5006
|
+
tracking_params: Vec<String>,
|
|
4936
5007
|
custom_headers: HashMap<String, String>,
|
|
4937
5008
|
#[serde(default = "default_timeout")]
|
|
4938
5009
|
request_timeout: u64,
|
|
@@ -4940,6 +5011,9 @@ pub struct CrawlConfig {
|
|
|
4940
5011
|
max_redirects: usize,
|
|
4941
5012
|
retry_count: usize,
|
|
4942
5013
|
retry_codes: Vec<u16>,
|
|
5014
|
+
retry_initial_delay_ms: u64,
|
|
5015
|
+
retry_max_delay_ms: u64,
|
|
5016
|
+
rate_limit_jitter_ratio: f64,
|
|
4943
5017
|
cookies_enabled: bool,
|
|
4944
5018
|
auth: Option<AuthConfig>,
|
|
4945
5019
|
max_body_size: Option<usize>,
|
|
@@ -5144,6 +5218,47 @@ impl CrawlConfig {
|
|
|
5144
5218
|
})?,
|
|
5145
5219
|
None => Default::default(),
|
|
5146
5220
|
},
|
|
5221
|
+
path_patterns_match_query: match kwargs.get(ruby.to_symbol("path_patterns_match_query")) {
|
|
5222
|
+
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
5223
|
+
magnus::Error::new(
|
|
5224
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
5225
|
+
format!("invalid value for `path_patterns_match_query`: {}", e),
|
|
5226
|
+
)
|
|
5227
|
+
})?,
|
|
5228
|
+
None => false,
|
|
5229
|
+
},
|
|
5230
|
+
dedup_include_query: match kwargs.get(ruby.to_symbol("dedup_include_query")) {
|
|
5231
|
+
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
5232
|
+
magnus::Error::new(
|
|
5233
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
5234
|
+
format!("invalid value for `dedup_include_query`: {}", e),
|
|
5235
|
+
)
|
|
5236
|
+
})?,
|
|
5237
|
+
None => false,
|
|
5238
|
+
},
|
|
5239
|
+
strip_tracking_params: match kwargs.get(ruby.to_symbol("strip_tracking_params")) {
|
|
5240
|
+
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
5241
|
+
magnus::Error::new(
|
|
5242
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
5243
|
+
format!("invalid value for `strip_tracking_params`: {}", e),
|
|
5244
|
+
)
|
|
5245
|
+
})?,
|
|
5246
|
+
None => false,
|
|
5247
|
+
},
|
|
5248
|
+
tracking_params: match kwargs.get(ruby.to_symbol("tracking_params")) {
|
|
5249
|
+
Some(v) => <Vec<String>>::try_convert(v).map_err(|e| {
|
|
5250
|
+
magnus::Error::new(
|
|
5251
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
5252
|
+
format!("invalid value for `tracking_params`: {}", e),
|
|
5253
|
+
)
|
|
5254
|
+
})?,
|
|
5255
|
+
None => vec![
|
|
5256
|
+
"utm_*".to_string(),
|
|
5257
|
+
"fbclid".to_string(),
|
|
5258
|
+
"gclid".to_string(),
|
|
5259
|
+
"ref".to_string(),
|
|
5260
|
+
],
|
|
5261
|
+
},
|
|
5147
5262
|
custom_headers: match kwargs.get(ruby.to_symbol("custom_headers")) {
|
|
5148
5263
|
Some(v) => <HashMap<String, String>>::try_convert(v).map_err(|e| {
|
|
5149
5264
|
magnus::Error::new(
|
|
@@ -5198,6 +5313,33 @@ impl CrawlConfig {
|
|
|
5198
5313
|
})?,
|
|
5199
5314
|
None => Default::default(),
|
|
5200
5315
|
},
|
|
5316
|
+
retry_initial_delay_ms: match kwargs.get(ruby.to_symbol("retry_initial_delay_ms")) {
|
|
5317
|
+
Some(v) => u64::try_convert(v).map_err(|e| {
|
|
5318
|
+
magnus::Error::new(
|
|
5319
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
5320
|
+
format!("invalid value for `retry_initial_delay_ms`: {}", e),
|
|
5321
|
+
)
|
|
5322
|
+
})?,
|
|
5323
|
+
None => 100,
|
|
5324
|
+
},
|
|
5325
|
+
retry_max_delay_ms: match kwargs.get(ruby.to_symbol("retry_max_delay_ms")) {
|
|
5326
|
+
Some(v) => u64::try_convert(v).map_err(|e| {
|
|
5327
|
+
magnus::Error::new(
|
|
5328
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
5329
|
+
format!("invalid value for `retry_max_delay_ms`: {}", e),
|
|
5330
|
+
)
|
|
5331
|
+
})?,
|
|
5332
|
+
None => 60000,
|
|
5333
|
+
},
|
|
5334
|
+
rate_limit_jitter_ratio: match kwargs.get(ruby.to_symbol("rate_limit_jitter_ratio")) {
|
|
5335
|
+
Some(v) => f64::try_convert(v).map_err(|e| {
|
|
5336
|
+
magnus::Error::new(
|
|
5337
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
5338
|
+
format!("invalid value for `rate_limit_jitter_ratio`: {}", e),
|
|
5339
|
+
)
|
|
5340
|
+
})?,
|
|
5341
|
+
None => 0.0,
|
|
5342
|
+
},
|
|
5201
5343
|
cookies_enabled: match kwargs.get(ruby.to_symbol("cookies_enabled")) {
|
|
5202
5344
|
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
5203
5345
|
magnus::Error::new(
|
|
@@ -5504,6 +5646,22 @@ impl CrawlConfig {
|
|
|
5504
5646
|
self.exclude_paths.clone()
|
|
5505
5647
|
}
|
|
5506
5648
|
|
|
5649
|
+
fn path_patterns_match_query(&self) -> bool {
|
|
5650
|
+
self.path_patterns_match_query
|
|
5651
|
+
}
|
|
5652
|
+
|
|
5653
|
+
fn dedup_include_query(&self) -> bool {
|
|
5654
|
+
self.dedup_include_query
|
|
5655
|
+
}
|
|
5656
|
+
|
|
5657
|
+
fn strip_tracking_params(&self) -> bool {
|
|
5658
|
+
self.strip_tracking_params
|
|
5659
|
+
}
|
|
5660
|
+
|
|
5661
|
+
fn tracking_params(&self) -> Vec<String> {
|
|
5662
|
+
self.tracking_params.clone()
|
|
5663
|
+
}
|
|
5664
|
+
|
|
5507
5665
|
fn custom_headers(&self) -> HashMap<String, String> {
|
|
5508
5666
|
self.custom_headers.clone()
|
|
5509
5667
|
}
|
|
@@ -5528,6 +5686,18 @@ impl CrawlConfig {
|
|
|
5528
5686
|
self.retry_codes.clone()
|
|
5529
5687
|
}
|
|
5530
5688
|
|
|
5689
|
+
fn retry_initial_delay_ms(&self) -> u64 {
|
|
5690
|
+
self.retry_initial_delay_ms
|
|
5691
|
+
}
|
|
5692
|
+
|
|
5693
|
+
fn retry_max_delay_ms(&self) -> u64 {
|
|
5694
|
+
self.retry_max_delay_ms
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
fn rate_limit_jitter_ratio(&self) -> f64 {
|
|
5698
|
+
self.rate_limit_jitter_ratio
|
|
5699
|
+
}
|
|
5700
|
+
|
|
5531
5701
|
fn cookies_enabled(&self) -> bool {
|
|
5532
5702
|
self.cookies_enabled
|
|
5533
5703
|
}
|
|
@@ -7645,12 +7815,7 @@ impl DocumentNode {
|
|
|
7645
7815
|
format!("invalid value for `content_layer`: {}", e),
|
|
7646
7816
|
)
|
|
7647
7817
|
})?,
|
|
7648
|
-
None =>
|
|
7649
|
-
return Err(magnus::Error::new(
|
|
7650
|
-
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
7651
|
-
"missing required field: content_layer",
|
|
7652
|
-
));
|
|
7653
|
-
}
|
|
7818
|
+
None => ContentLayer::Body,
|
|
7654
7819
|
},
|
|
7655
7820
|
page: match kwargs.get(ruby.to_symbol("page")).filter(|v| !v.is_nil()) {
|
|
7656
7821
|
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
@@ -10523,6 +10688,135 @@ impl ExcelWorkbook {
|
|
|
10523
10688
|
}
|
|
10524
10689
|
}
|
|
10525
10690
|
|
|
10691
|
+
#[derive(Clone, Debug, serde::Serialize)]
|
|
10692
|
+
#[serde(default)]
|
|
10693
|
+
#[magnus::wrap(class = "Xberg::ExternalRedactionFinding")]
|
|
10694
|
+
pub struct ExternalRedactionFinding {
|
|
10695
|
+
label: String,
|
|
10696
|
+
text: Option<String>,
|
|
10697
|
+
start: Option<u32>,
|
|
10698
|
+
end: Option<u32>,
|
|
10699
|
+
score: Option<f32>,
|
|
10700
|
+
}
|
|
10701
|
+
|
|
10702
|
+
unsafe impl IntoValueFromNative for ExternalRedactionFinding {}
|
|
10703
|
+
|
|
10704
|
+
impl magnus::TryConvert for ExternalRedactionFinding {
|
|
10705
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
10706
|
+
if let Ok(r) = <&ExternalRedactionFinding as magnus::TryConvert>::try_convert(val) {
|
|
10707
|
+
return Ok(r.clone());
|
|
10708
|
+
}
|
|
10709
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
10710
|
+
s
|
|
10711
|
+
} else {
|
|
10712
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
10713
|
+
magnus::Error::new(
|
|
10714
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10715
|
+
format!("no implicit conversion into ExternalRedactionFinding: {}", e),
|
|
10716
|
+
)
|
|
10717
|
+
})?
|
|
10718
|
+
};
|
|
10719
|
+
serde_json::from_str::<ExternalRedactionFinding>(&json_str).map_err(|e| {
|
|
10720
|
+
magnus::Error::new(
|
|
10721
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10722
|
+
format!("failed to deserialize ExternalRedactionFinding: {}", e),
|
|
10723
|
+
)
|
|
10724
|
+
})
|
|
10725
|
+
}
|
|
10726
|
+
}
|
|
10727
|
+
|
|
10728
|
+
unsafe impl TryConvertOwned for ExternalRedactionFinding {}
|
|
10729
|
+
impl<'de> serde::Deserialize<'de> for ExternalRedactionFinding {
|
|
10730
|
+
fn deserialize<D>(deserializer: D) -> ::core::result::Result<Self, D::Error>
|
|
10731
|
+
where
|
|
10732
|
+
D: serde::Deserializer<'de>,
|
|
10733
|
+
{
|
|
10734
|
+
<xberg::ExternalRedactionFinding as serde::Deserialize>::deserialize(deserializer).map(Into::into)
|
|
10735
|
+
}
|
|
10736
|
+
}
|
|
10737
|
+
|
|
10738
|
+
impl Default for ExternalRedactionFinding {
|
|
10739
|
+
fn default() -> Self {
|
|
10740
|
+
xberg::ExternalRedactionFinding::default().into()
|
|
10741
|
+
}
|
|
10742
|
+
}
|
|
10743
|
+
|
|
10744
|
+
impl ExternalRedactionFinding {
|
|
10745
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
10746
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
10747
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
10748
|
+
let (kwargs_opt,) = args.optional;
|
|
10749
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
10750
|
+
Ok(Self {
|
|
10751
|
+
label: match kwargs.get(ruby.to_symbol("label")) {
|
|
10752
|
+
Some(v) => String::try_convert(v).map_err(|e| {
|
|
10753
|
+
magnus::Error::new(
|
|
10754
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10755
|
+
format!("invalid value for `label`: {}", e),
|
|
10756
|
+
)
|
|
10757
|
+
})?,
|
|
10758
|
+
None => Default::default(),
|
|
10759
|
+
},
|
|
10760
|
+
text: match kwargs.get(ruby.to_symbol("text")).filter(|v| !v.is_nil()) {
|
|
10761
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
10762
|
+
magnus::Error::new(
|
|
10763
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10764
|
+
format!("invalid value for `text`: {}", e),
|
|
10765
|
+
)
|
|
10766
|
+
})?),
|
|
10767
|
+
None => None,
|
|
10768
|
+
},
|
|
10769
|
+
start: match kwargs.get(ruby.to_symbol("start")).filter(|v| !v.is_nil()) {
|
|
10770
|
+
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
10771
|
+
magnus::Error::new(
|
|
10772
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10773
|
+
format!("invalid value for `start`: {}", e),
|
|
10774
|
+
)
|
|
10775
|
+
})?),
|
|
10776
|
+
None => None,
|
|
10777
|
+
},
|
|
10778
|
+
end: match kwargs.get(ruby.to_symbol("end")).filter(|v| !v.is_nil()) {
|
|
10779
|
+
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
10780
|
+
magnus::Error::new(
|
|
10781
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10782
|
+
format!("invalid value for `end`: {}", e),
|
|
10783
|
+
)
|
|
10784
|
+
})?),
|
|
10785
|
+
None => None,
|
|
10786
|
+
},
|
|
10787
|
+
score: match kwargs.get(ruby.to_symbol("score")).filter(|v| !v.is_nil()) {
|
|
10788
|
+
Some(v) => Some(f32::try_convert(v).map_err(|e| {
|
|
10789
|
+
magnus::Error::new(
|
|
10790
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10791
|
+
format!("invalid value for `score`: {}", e),
|
|
10792
|
+
)
|
|
10793
|
+
})?),
|
|
10794
|
+
None => None,
|
|
10795
|
+
},
|
|
10796
|
+
})
|
|
10797
|
+
}
|
|
10798
|
+
|
|
10799
|
+
fn label(&self) -> String {
|
|
10800
|
+
self.label.clone()
|
|
10801
|
+
}
|
|
10802
|
+
|
|
10803
|
+
fn text(&self) -> Option<String> {
|
|
10804
|
+
self.text.clone()
|
|
10805
|
+
}
|
|
10806
|
+
|
|
10807
|
+
fn start(&self) -> Option<u32> {
|
|
10808
|
+
self.start
|
|
10809
|
+
}
|
|
10810
|
+
|
|
10811
|
+
fn end(&self) -> Option<u32> {
|
|
10812
|
+
self.end
|
|
10813
|
+
}
|
|
10814
|
+
|
|
10815
|
+
fn score(&self) -> Option<f32> {
|
|
10816
|
+
self.score
|
|
10817
|
+
}
|
|
10818
|
+
}
|
|
10819
|
+
|
|
10526
10820
|
#[derive(Clone, Debug, serde::Serialize)]
|
|
10527
10821
|
#[serde(default)]
|
|
10528
10822
|
#[magnus::wrap(class = "Xberg::ExtractInput")]
|
|
@@ -17266,6 +17560,7 @@ pub struct ImagePreprocessingConfig {
|
|
|
17266
17560
|
contrast_enhance: bool,
|
|
17267
17561
|
binarization_method: String,
|
|
17268
17562
|
invert_colors: bool,
|
|
17563
|
+
normalize_shaded_rows: bool,
|
|
17269
17564
|
}
|
|
17270
17565
|
|
|
17271
17566
|
unsafe impl IntoValueFromNative for ImagePreprocessingConfig {}
|
|
@@ -17380,6 +17675,15 @@ impl ImagePreprocessingConfig {
|
|
|
17380
17675
|
})?,
|
|
17381
17676
|
None => false,
|
|
17382
17677
|
},
|
|
17678
|
+
normalize_shaded_rows: match kwargs.get(ruby.to_symbol("normalize_shaded_rows")) {
|
|
17679
|
+
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
17680
|
+
magnus::Error::new(
|
|
17681
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
17682
|
+
format!("invalid value for `normalize_shaded_rows`: {}", e),
|
|
17683
|
+
)
|
|
17684
|
+
})?,
|
|
17685
|
+
None => false,
|
|
17686
|
+
},
|
|
17383
17687
|
})
|
|
17384
17688
|
}
|
|
17385
17689
|
|
|
@@ -17410,6 +17714,10 @@ impl ImagePreprocessingConfig {
|
|
|
17410
17714
|
fn invert_colors(&self) -> bool {
|
|
17411
17715
|
self.invert_colors
|
|
17412
17716
|
}
|
|
17717
|
+
|
|
17718
|
+
fn normalize_shaded_rows(&self) -> bool {
|
|
17719
|
+
self.normalize_shaded_rows
|
|
17720
|
+
}
|
|
17413
17721
|
}
|
|
17414
17722
|
|
|
17415
17723
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -18601,7 +18909,7 @@ impl LateInteractionConfig {
|
|
|
18601
18909
|
}
|
|
18602
18910
|
}
|
|
18603
18911
|
|
|
18604
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18912
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18605
18913
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
18606
18914
|
#[magnus::wrap(class = "Xberg::LateInteractionMatch")]
|
|
18607
18915
|
pub struct LateInteractionMatch {
|
|
@@ -18609,10 +18917,10 @@ pub struct LateInteractionMatch {
|
|
|
18609
18917
|
score: f32,
|
|
18610
18918
|
}
|
|
18611
18919
|
|
|
18612
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18920
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18613
18921
|
unsafe impl IntoValueFromNative for LateInteractionMatch {}
|
|
18614
18922
|
|
|
18615
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18923
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18616
18924
|
impl magnus::TryConvert for LateInteractionMatch {
|
|
18617
18925
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
18618
18926
|
if let Ok(r) = <&LateInteractionMatch as magnus::TryConvert>::try_convert(val) {
|
|
@@ -18637,10 +18945,10 @@ impl magnus::TryConvert for LateInteractionMatch {
|
|
|
18637
18945
|
}
|
|
18638
18946
|
}
|
|
18639
18947
|
|
|
18640
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18948
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18641
18949
|
unsafe impl TryConvertOwned for LateInteractionMatch {}
|
|
18642
18950
|
|
|
18643
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18951
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18644
18952
|
impl LateInteractionMatch {
|
|
18645
18953
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
18646
18954
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -18678,7 +18986,7 @@ impl LateInteractionMatch {
|
|
|
18678
18986
|
}
|
|
18679
18987
|
}
|
|
18680
18988
|
|
|
18681
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18989
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18682
18990
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
18683
18991
|
#[magnus::wrap(class = "Xberg::LateInteractionPreset")]
|
|
18684
18992
|
pub struct LateInteractionPreset {
|
|
@@ -18692,10 +19000,10 @@ pub struct LateInteractionPreset {
|
|
|
18692
19000
|
description: String,
|
|
18693
19001
|
}
|
|
18694
19002
|
|
|
18695
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19003
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18696
19004
|
unsafe impl IntoValueFromNative for LateInteractionPreset {}
|
|
18697
19005
|
|
|
18698
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19006
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18699
19007
|
impl magnus::TryConvert for LateInteractionPreset {
|
|
18700
19008
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
18701
19009
|
if let Ok(r) = <&LateInteractionPreset as magnus::TryConvert>::try_convert(val) {
|
|
@@ -18720,10 +19028,10 @@ impl magnus::TryConvert for LateInteractionPreset {
|
|
|
18720
19028
|
}
|
|
18721
19029
|
}
|
|
18722
19030
|
|
|
18723
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19031
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18724
19032
|
unsafe impl TryConvertOwned for LateInteractionPreset {}
|
|
18725
19033
|
|
|
18726
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19034
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18727
19035
|
impl LateInteractionPreset {
|
|
18728
19036
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
18729
19037
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -21165,7 +21473,6 @@ impl Metadata {
|
|
|
21165
21473
|
}
|
|
21166
21474
|
}
|
|
21167
21475
|
|
|
21168
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21169
21476
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
21170
21477
|
#[magnus::wrap(class = "Xberg::ModelPaths")]
|
|
21171
21478
|
pub struct ModelPaths {
|
|
@@ -21175,10 +21482,8 @@ pub struct ModelPaths {
|
|
|
21175
21482
|
dict_file: String,
|
|
21176
21483
|
}
|
|
21177
21484
|
|
|
21178
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21179
21485
|
unsafe impl IntoValueFromNative for ModelPaths {}
|
|
21180
21486
|
|
|
21181
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21182
21487
|
impl magnus::TryConvert for ModelPaths {
|
|
21183
21488
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
21184
21489
|
if let Ok(r) = <&ModelPaths as magnus::TryConvert>::try_convert(val) {
|
|
@@ -21203,10 +21508,8 @@ impl magnus::TryConvert for ModelPaths {
|
|
|
21203
21508
|
}
|
|
21204
21509
|
}
|
|
21205
21510
|
|
|
21206
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21207
21511
|
unsafe impl TryConvertOwned for ModelPaths {}
|
|
21208
21512
|
|
|
21209
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21210
21513
|
impl ModelPaths {
|
|
21211
21514
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
21212
21515
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -21270,7 +21573,7 @@ impl ModelPaths {
|
|
|
21270
21573
|
}
|
|
21271
21574
|
}
|
|
21272
21575
|
|
|
21273
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21576
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21274
21577
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
21275
21578
|
#[magnus::wrap(class = "Xberg::MultiVectorEmbedding")]
|
|
21276
21579
|
pub struct MultiVectorEmbedding {
|
|
@@ -21279,10 +21582,10 @@ pub struct MultiVectorEmbedding {
|
|
|
21279
21582
|
data: Vec<f32>,
|
|
21280
21583
|
}
|
|
21281
21584
|
|
|
21282
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21585
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21283
21586
|
unsafe impl IntoValueFromNative for MultiVectorEmbedding {}
|
|
21284
21587
|
|
|
21285
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21588
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21286
21589
|
impl magnus::TryConvert for MultiVectorEmbedding {
|
|
21287
21590
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
21288
21591
|
if let Ok(r) = <&MultiVectorEmbedding as magnus::TryConvert>::try_convert(val) {
|
|
@@ -21307,10 +21610,10 @@ impl magnus::TryConvert for MultiVectorEmbedding {
|
|
|
21307
21610
|
}
|
|
21308
21611
|
}
|
|
21309
21612
|
|
|
21310
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21613
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21311
21614
|
unsafe impl TryConvertOwned for MultiVectorEmbedding {}
|
|
21312
21615
|
|
|
21313
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21616
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21314
21617
|
impl MultiVectorEmbedding {
|
|
21315
21618
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
21316
21619
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -21920,6 +22223,7 @@ pub struct OcrConfig {
|
|
|
21920
22223
|
tesseract_config: Option<TesseractConfig>,
|
|
21921
22224
|
output_format: Option<OutputFormat>,
|
|
21922
22225
|
paddle_ocr_config: Option<String>,
|
|
22226
|
+
paddle_ocr_settings: Option<PaddleOcrConfig>,
|
|
21923
22227
|
backend_options: Option<String>,
|
|
21924
22228
|
element_config: Option<OcrElementConfig>,
|
|
21925
22229
|
quality_thresholds: Option<OcrQualityThresholds>,
|
|
@@ -21932,6 +22236,7 @@ pub struct OcrConfig {
|
|
|
21932
22236
|
security_limits: Option<SecurityLimits>,
|
|
21933
22237
|
tessdata_bytes: Option<HashMap<String, Vec<u8>>>,
|
|
21934
22238
|
tessdata_path: Option<String>,
|
|
22239
|
+
numeric_repair: bool,
|
|
21935
22240
|
}
|
|
21936
22241
|
|
|
21937
22242
|
unsafe impl IntoValueFromNative for OcrConfig {}
|
|
@@ -22037,6 +22342,18 @@ impl OcrConfig {
|
|
|
22037
22342
|
})?),
|
|
22038
22343
|
None => None,
|
|
22039
22344
|
},
|
|
22345
|
+
paddle_ocr_settings: match kwargs
|
|
22346
|
+
.get(ruby.to_symbol("paddle_ocr_settings"))
|
|
22347
|
+
.filter(|v| !v.is_nil())
|
|
22348
|
+
{
|
|
22349
|
+
Some(v) => Some(PaddleOcrConfig::try_convert(v).map_err(|e| {
|
|
22350
|
+
magnus::Error::new(
|
|
22351
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
22352
|
+
format!("invalid value for `paddle_ocr_settings`: {}", e),
|
|
22353
|
+
)
|
|
22354
|
+
})?),
|
|
22355
|
+
None => None,
|
|
22356
|
+
},
|
|
22040
22357
|
backend_options: match kwargs.get(ruby.to_symbol("backend_options")).filter(|v| !v.is_nil()) {
|
|
22041
22358
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
22042
22359
|
magnus::Error::new(
|
|
@@ -22145,6 +22462,15 @@ impl OcrConfig {
|
|
|
22145
22462
|
})?),
|
|
22146
22463
|
None => None,
|
|
22147
22464
|
},
|
|
22465
|
+
numeric_repair: match kwargs.get(ruby.to_symbol("numeric_repair")) {
|
|
22466
|
+
Some(v) => bool::try_convert(v).map_err(|e| {
|
|
22467
|
+
magnus::Error::new(
|
|
22468
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
22469
|
+
format!("invalid value for `numeric_repair`: {}", e),
|
|
22470
|
+
)
|
|
22471
|
+
})?,
|
|
22472
|
+
None => false,
|
|
22473
|
+
},
|
|
22148
22474
|
})
|
|
22149
22475
|
}
|
|
22150
22476
|
|
|
@@ -22172,6 +22498,10 @@ impl OcrConfig {
|
|
|
22172
22498
|
self.paddle_ocr_config.clone()
|
|
22173
22499
|
}
|
|
22174
22500
|
|
|
22501
|
+
fn paddle_ocr_settings(&self) -> Option<PaddleOcrConfig> {
|
|
22502
|
+
self.paddle_ocr_settings.clone()
|
|
22503
|
+
}
|
|
22504
|
+
|
|
22175
22505
|
fn backend_options(&self) -> Option<String> {
|
|
22176
22506
|
self.backend_options.clone()
|
|
22177
22507
|
}
|
|
@@ -22219,6 +22549,10 @@ impl OcrConfig {
|
|
|
22219
22549
|
fn tessdata_path(&self) -> Option<String> {
|
|
22220
22550
|
self.tessdata_path.clone()
|
|
22221
22551
|
}
|
|
22552
|
+
|
|
22553
|
+
fn numeric_repair(&self) -> bool {
|
|
22554
|
+
self.numeric_repair
|
|
22555
|
+
}
|
|
22222
22556
|
}
|
|
22223
22557
|
|
|
22224
22558
|
#[derive(Clone, Debug, serde::Serialize)]
|
|
@@ -22878,6 +23212,7 @@ pub struct OcrPipelineStage {
|
|
|
22878
23212
|
language: Option<Vec<String>>,
|
|
22879
23213
|
tesseract_config: Option<TesseractConfig>,
|
|
22880
23214
|
paddle_ocr_config: Option<String>,
|
|
23215
|
+
paddle_ocr_settings: Option<PaddleOcrConfig>,
|
|
22881
23216
|
vlm_config: Option<LlmConfig>,
|
|
22882
23217
|
backend_options: Option<String>,
|
|
22883
23218
|
}
|
|
@@ -22926,6 +23261,7 @@ impl Default for OcrPipelineStage {
|
|
|
22926
23261
|
language: None,
|
|
22927
23262
|
tesseract_config: None,
|
|
22928
23263
|
paddle_ocr_config: None,
|
|
23264
|
+
paddle_ocr_settings: None,
|
|
22929
23265
|
vlm_config: None,
|
|
22930
23266
|
backend_options: None,
|
|
22931
23267
|
}
|
|
@@ -22984,6 +23320,18 @@ impl OcrPipelineStage {
|
|
|
22984
23320
|
})?),
|
|
22985
23321
|
None => None,
|
|
22986
23322
|
},
|
|
23323
|
+
paddle_ocr_settings: match kwargs
|
|
23324
|
+
.get(ruby.to_symbol("paddle_ocr_settings"))
|
|
23325
|
+
.filter(|v| !v.is_nil())
|
|
23326
|
+
{
|
|
23327
|
+
Some(v) => Some(PaddleOcrConfig::try_convert(v).map_err(|e| {
|
|
23328
|
+
magnus::Error::new(
|
|
23329
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
23330
|
+
format!("invalid value for `paddle_ocr_settings`: {}", e),
|
|
23331
|
+
)
|
|
23332
|
+
})?),
|
|
23333
|
+
None => None,
|
|
23334
|
+
},
|
|
22987
23335
|
vlm_config: match kwargs.get(ruby.to_symbol("vlm_config")).filter(|v| !v.is_nil()) {
|
|
22988
23336
|
Some(v) => Some(LlmConfig::try_convert(v).map_err(|e| {
|
|
22989
23337
|
magnus::Error::new(
|
|
@@ -23025,6 +23373,10 @@ impl OcrPipelineStage {
|
|
|
23025
23373
|
self.paddle_ocr_config.clone()
|
|
23026
23374
|
}
|
|
23027
23375
|
|
|
23376
|
+
fn paddle_ocr_settings(&self) -> Option<PaddleOcrConfig> {
|
|
23377
|
+
self.paddle_ocr_settings.clone()
|
|
23378
|
+
}
|
|
23379
|
+
|
|
23028
23380
|
fn vlm_config(&self) -> Option<LlmConfig> {
|
|
23029
23381
|
self.vlm_config.clone()
|
|
23030
23382
|
}
|
|
@@ -23908,7 +24260,6 @@ impl OrientationResult {
|
|
|
23908
24260
|
}
|
|
23909
24261
|
}
|
|
23910
24262
|
|
|
23911
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
23912
24263
|
#[derive(Clone, Debug, serde::Serialize)]
|
|
23913
24264
|
#[serde(default)]
|
|
23914
24265
|
#[magnus::wrap(class = "Xberg::PaddleOcrConfig")]
|
|
@@ -23929,10 +24280,8 @@ pub struct PaddleOcrConfig {
|
|
|
23929
24280
|
inference_backend: Option<PaddleInferenceBackend>,
|
|
23930
24281
|
}
|
|
23931
24282
|
|
|
23932
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
23933
24283
|
unsafe impl IntoValueFromNative for PaddleOcrConfig {}
|
|
23934
24284
|
|
|
23935
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
23936
24285
|
impl magnus::TryConvert for PaddleOcrConfig {
|
|
23937
24286
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
23938
24287
|
if let Ok(r) = <&PaddleOcrConfig as magnus::TryConvert>::try_convert(val) {
|
|
@@ -23957,9 +24306,7 @@ impl magnus::TryConvert for PaddleOcrConfig {
|
|
|
23957
24306
|
}
|
|
23958
24307
|
}
|
|
23959
24308
|
|
|
23960
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
23961
24309
|
unsafe impl TryConvertOwned for PaddleOcrConfig {}
|
|
23962
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
23963
24310
|
impl<'de> serde::Deserialize<'de> for PaddleOcrConfig {
|
|
23964
24311
|
fn deserialize<D>(deserializer: D) -> ::core::result::Result<Self, D::Error>
|
|
23965
24312
|
where
|
|
@@ -23969,14 +24316,12 @@ impl<'de> serde::Deserialize<'de> for PaddleOcrConfig {
|
|
|
23969
24316
|
}
|
|
23970
24317
|
}
|
|
23971
24318
|
|
|
23972
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
23973
24319
|
impl Default for PaddleOcrConfig {
|
|
23974
24320
|
fn default() -> Self {
|
|
23975
24321
|
xberg::PaddleOcrConfig::default().into()
|
|
23976
24322
|
}
|
|
23977
24323
|
}
|
|
23978
24324
|
|
|
23979
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
23980
24325
|
impl PaddleOcrConfig {
|
|
23981
24326
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
23982
24327
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -29494,6 +29839,10 @@ pub struct RedactionConfig {
|
|
|
29494
29839
|
preserve_offsets: bool,
|
|
29495
29840
|
custom_terms: Vec<RedactionTerm>,
|
|
29496
29841
|
custom_patterns: Vec<RedactionPattern>,
|
|
29842
|
+
findings: Vec<ExternalRedactionFinding>,
|
|
29843
|
+
min_score: Option<f32>,
|
|
29844
|
+
findings_path: Option<String>,
|
|
29845
|
+
findings_offset_encoding: RedactionOffsetEncoding,
|
|
29497
29846
|
}
|
|
29498
29847
|
|
|
29499
29848
|
unsafe impl IntoValueFromNative for RedactionConfig {}
|
|
@@ -29599,6 +29948,42 @@ impl RedactionConfig {
|
|
|
29599
29948
|
})?,
|
|
29600
29949
|
None => Default::default(),
|
|
29601
29950
|
},
|
|
29951
|
+
findings: match kwargs.get(ruby.to_symbol("findings")) {
|
|
29952
|
+
Some(v) => <Vec<ExternalRedactionFinding>>::try_convert(v).map_err(|e| {
|
|
29953
|
+
magnus::Error::new(
|
|
29954
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29955
|
+
format!("invalid value for `findings`: {}", e),
|
|
29956
|
+
)
|
|
29957
|
+
})?,
|
|
29958
|
+
None => Default::default(),
|
|
29959
|
+
},
|
|
29960
|
+
min_score: match kwargs.get(ruby.to_symbol("min_score")).filter(|v| !v.is_nil()) {
|
|
29961
|
+
Some(v) => Some(f32::try_convert(v).map_err(|e| {
|
|
29962
|
+
magnus::Error::new(
|
|
29963
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29964
|
+
format!("invalid value for `min_score`: {}", e),
|
|
29965
|
+
)
|
|
29966
|
+
})?),
|
|
29967
|
+
None => None,
|
|
29968
|
+
},
|
|
29969
|
+
findings_path: match kwargs.get(ruby.to_symbol("findings_path")).filter(|v| !v.is_nil()) {
|
|
29970
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
29971
|
+
magnus::Error::new(
|
|
29972
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29973
|
+
format!("invalid value for `findings_path`: {}", e),
|
|
29974
|
+
)
|
|
29975
|
+
})?),
|
|
29976
|
+
None => None,
|
|
29977
|
+
},
|
|
29978
|
+
findings_offset_encoding: match kwargs.get(ruby.to_symbol("findings_offset_encoding")) {
|
|
29979
|
+
Some(v) => RedactionOffsetEncoding::try_convert(v).map_err(|e| {
|
|
29980
|
+
magnus::Error::new(
|
|
29981
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29982
|
+
format!("invalid value for `findings_offset_encoding`: {}", e),
|
|
29983
|
+
)
|
|
29984
|
+
})?,
|
|
29985
|
+
None => RedactionOffsetEncoding::UnicodeCodePoints,
|
|
29986
|
+
},
|
|
29602
29987
|
})
|
|
29603
29988
|
}
|
|
29604
29989
|
|
|
@@ -29626,6 +30011,22 @@ impl RedactionConfig {
|
|
|
29626
30011
|
self.custom_patterns.clone()
|
|
29627
30012
|
}
|
|
29628
30013
|
|
|
30014
|
+
fn findings(&self) -> Vec<ExternalRedactionFinding> {
|
|
30015
|
+
self.findings.clone()
|
|
30016
|
+
}
|
|
30017
|
+
|
|
30018
|
+
fn min_score(&self) -> Option<f32> {
|
|
30019
|
+
self.min_score
|
|
30020
|
+
}
|
|
30021
|
+
|
|
30022
|
+
fn findings_path(&self) -> Option<String> {
|
|
30023
|
+
self.findings_path.clone()
|
|
30024
|
+
}
|
|
30025
|
+
|
|
30026
|
+
fn findings_offset_encoding(&self) -> RedactionOffsetEncoding {
|
|
30027
|
+
self.findings_offset_encoding.clone()
|
|
30028
|
+
}
|
|
30029
|
+
|
|
29629
30030
|
fn validate(&self) -> Result<(), Error> {
|
|
29630
30031
|
#[allow(clippy::needless_update)]
|
|
29631
30032
|
let core_self = xberg::RedactionConfig {
|
|
@@ -29641,6 +30042,14 @@ impl RedactionConfig {
|
|
|
29641
30042
|
|
|
29642
30043
|
custom_patterns: self.custom_patterns.clone().into_iter().map(Into::into).collect(),
|
|
29643
30044
|
|
|
30045
|
+
findings: self.findings.clone().into_iter().map(Into::into).collect(),
|
|
30046
|
+
|
|
30047
|
+
min_score: self.min_score,
|
|
30048
|
+
|
|
30049
|
+
findings_path: self.findings_path.clone().map(Into::into),
|
|
30050
|
+
|
|
30051
|
+
findings_offset_encoding: self.findings_offset_encoding.clone().into(),
|
|
30052
|
+
|
|
29644
30053
|
..Default::default()
|
|
29645
30054
|
};
|
|
29646
30055
|
let result = core_self.validate().map_err(|e| {
|
|
@@ -30126,7 +30535,10 @@ impl Registry {
|
|
|
30126
30535
|
}
|
|
30127
30536
|
}
|
|
30128
30537
|
|
|
30129
|
-
#[cfg(any(
|
|
30538
|
+
#[cfg(any(
|
|
30539
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30540
|
+
not(feature = "reranker-presets")
|
|
30541
|
+
))]
|
|
30130
30542
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
30131
30543
|
#[magnus::wrap(class = "Xberg::RerankedDocument")]
|
|
30132
30544
|
pub struct RerankedDocument {
|
|
@@ -30135,10 +30547,16 @@ pub struct RerankedDocument {
|
|
|
30135
30547
|
document: String,
|
|
30136
30548
|
}
|
|
30137
30549
|
|
|
30138
|
-
#[cfg(any(
|
|
30550
|
+
#[cfg(any(
|
|
30551
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30552
|
+
not(feature = "reranker-presets")
|
|
30553
|
+
))]
|
|
30139
30554
|
unsafe impl IntoValueFromNative for RerankedDocument {}
|
|
30140
30555
|
|
|
30141
|
-
#[cfg(any(
|
|
30556
|
+
#[cfg(any(
|
|
30557
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30558
|
+
not(feature = "reranker-presets")
|
|
30559
|
+
))]
|
|
30142
30560
|
impl magnus::TryConvert for RerankedDocument {
|
|
30143
30561
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
30144
30562
|
if let Ok(r) = <&RerankedDocument as magnus::TryConvert>::try_convert(val) {
|
|
@@ -30163,10 +30581,16 @@ impl magnus::TryConvert for RerankedDocument {
|
|
|
30163
30581
|
}
|
|
30164
30582
|
}
|
|
30165
30583
|
|
|
30166
|
-
#[cfg(any(
|
|
30584
|
+
#[cfg(any(
|
|
30585
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30586
|
+
not(feature = "reranker-presets")
|
|
30587
|
+
))]
|
|
30167
30588
|
unsafe impl TryConvertOwned for RerankedDocument {}
|
|
30168
30589
|
|
|
30169
|
-
#[cfg(any(
|
|
30590
|
+
#[cfg(any(
|
|
30591
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30592
|
+
not(feature = "reranker-presets")
|
|
30593
|
+
))]
|
|
30170
30594
|
impl RerankedDocument {
|
|
30171
30595
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
30172
30596
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -31224,7 +31648,7 @@ impl SitemapUrl {
|
|
|
31224
31648
|
}
|
|
31225
31649
|
}
|
|
31226
31650
|
|
|
31227
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31651
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31228
31652
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
31229
31653
|
#[magnus::wrap(class = "Xberg::SparseEmbedding")]
|
|
31230
31654
|
pub struct SparseEmbedding {
|
|
@@ -31232,10 +31656,10 @@ pub struct SparseEmbedding {
|
|
|
31232
31656
|
values: Vec<f32>,
|
|
31233
31657
|
}
|
|
31234
31658
|
|
|
31235
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31659
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31236
31660
|
unsafe impl IntoValueFromNative for SparseEmbedding {}
|
|
31237
31661
|
|
|
31238
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31662
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31239
31663
|
impl magnus::TryConvert for SparseEmbedding {
|
|
31240
31664
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
31241
31665
|
if let Ok(r) = <&SparseEmbedding as magnus::TryConvert>::try_convert(val) {
|
|
@@ -31260,10 +31684,10 @@ impl magnus::TryConvert for SparseEmbedding {
|
|
|
31260
31684
|
}
|
|
31261
31685
|
}
|
|
31262
31686
|
|
|
31263
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31687
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31264
31688
|
unsafe impl TryConvertOwned for SparseEmbedding {}
|
|
31265
31689
|
|
|
31266
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31690
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31267
31691
|
impl SparseEmbedding {
|
|
31268
31692
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
31269
31693
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -31461,7 +31885,7 @@ impl SparseEmbeddingConfig {
|
|
|
31461
31885
|
}
|
|
31462
31886
|
}
|
|
31463
31887
|
|
|
31464
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31888
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31465
31889
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
31466
31890
|
#[magnus::wrap(class = "Xberg::SparseEmbeddingPreset")]
|
|
31467
31891
|
pub struct SparseEmbeddingPreset {
|
|
@@ -31473,10 +31897,10 @@ pub struct SparseEmbeddingPreset {
|
|
|
31473
31897
|
description: String,
|
|
31474
31898
|
}
|
|
31475
31899
|
|
|
31476
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31900
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31477
31901
|
unsafe impl IntoValueFromNative for SparseEmbeddingPreset {}
|
|
31478
31902
|
|
|
31479
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31903
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31480
31904
|
impl magnus::TryConvert for SparseEmbeddingPreset {
|
|
31481
31905
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
31482
31906
|
if let Ok(r) = <&SparseEmbeddingPreset as magnus::TryConvert>::try_convert(val) {
|
|
@@ -31501,10 +31925,10 @@ impl magnus::TryConvert for SparseEmbeddingPreset {
|
|
|
31501
31925
|
}
|
|
31502
31926
|
}
|
|
31503
31927
|
|
|
31504
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31928
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31505
31929
|
unsafe impl TryConvertOwned for SparseEmbeddingPreset {}
|
|
31506
31930
|
|
|
31507
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31931
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31508
31932
|
impl SparseEmbeddingPreset {
|
|
31509
31933
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
31510
31934
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -32956,7 +33380,7 @@ pub struct TesseractConfig {
|
|
|
32956
33380
|
tessedit_char_blacklist: String,
|
|
32957
33381
|
tessedit_use_primary_params_model: bool,
|
|
32958
33382
|
textord_space_size_is_variable: bool,
|
|
32959
|
-
thresholding_method:
|
|
33383
|
+
thresholding_method: i32,
|
|
32960
33384
|
}
|
|
32961
33385
|
|
|
32962
33386
|
unsafe impl IntoValueFromNative for TesseractConfig {}
|
|
@@ -33189,13 +33613,13 @@ impl TesseractConfig {
|
|
|
33189
33613
|
None => true,
|
|
33190
33614
|
},
|
|
33191
33615
|
thresholding_method: match kwargs.get(ruby.to_symbol("thresholding_method")) {
|
|
33192
|
-
Some(v) =>
|
|
33616
|
+
Some(v) => i32::try_convert(v).map_err(|e| {
|
|
33193
33617
|
magnus::Error::new(
|
|
33194
33618
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
33195
33619
|
format!("invalid value for `thresholding_method`: {}", e),
|
|
33196
33620
|
)
|
|
33197
33621
|
})?,
|
|
33198
|
-
None =>
|
|
33622
|
+
None => 0,
|
|
33199
33623
|
},
|
|
33200
33624
|
})
|
|
33201
33625
|
}
|
|
@@ -33280,7 +33704,7 @@ impl TesseractConfig {
|
|
|
33280
33704
|
self.textord_space_size_is_variable
|
|
33281
33705
|
}
|
|
33282
33706
|
|
|
33283
|
-
fn thresholding_method(&self) ->
|
|
33707
|
+
fn thresholding_method(&self) -> i32 {
|
|
33284
33708
|
self.thresholding_method
|
|
33285
33709
|
}
|
|
33286
33710
|
}
|
|
@@ -36426,6 +36850,59 @@ impl magnus::TryConvert for CandleTrocrVariant {
|
|
|
36426
36850
|
unsafe impl IntoValueFromNative for CandleTrocrVariant {}
|
|
36427
36851
|
unsafe impl TryConvertOwned for CandleTrocrVariant {}
|
|
36428
36852
|
|
|
36853
|
+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
36854
|
+
#[serde(rename_all = "snake_case")]
|
|
36855
|
+
pub enum CaptionAltTextMode {
|
|
36856
|
+
Preserve,
|
|
36857
|
+
Combine,
|
|
36858
|
+
Replace,
|
|
36859
|
+
}
|
|
36860
|
+
|
|
36861
|
+
impl Default for CaptionAltTextMode {
|
|
36862
|
+
fn default() -> Self {
|
|
36863
|
+
Self::Preserve
|
|
36864
|
+
}
|
|
36865
|
+
}
|
|
36866
|
+
|
|
36867
|
+
impl magnus::IntoValue for CaptionAltTextMode {
|
|
36868
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
36869
|
+
let sym = match self {
|
|
36870
|
+
CaptionAltTextMode::Preserve => "preserve",
|
|
36871
|
+
CaptionAltTextMode::Combine => "combine",
|
|
36872
|
+
CaptionAltTextMode::Replace => "replace",
|
|
36873
|
+
};
|
|
36874
|
+
handle.to_symbol(sym).into_value_with(handle)
|
|
36875
|
+
}
|
|
36876
|
+
}
|
|
36877
|
+
|
|
36878
|
+
impl magnus::TryConvert for CaptionAltTextMode {
|
|
36879
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
36880
|
+
// IntoValue emits Symbols, including when this enum is a Hash key.
|
|
36881
|
+
// Accept that exact representation as well as String inputs; do not
|
|
36882
|
+
// coerce arbitrary objects through to_s.
|
|
36883
|
+
let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
|
|
36884
|
+
symbol.name()?.into_owned()
|
|
36885
|
+
} else {
|
|
36886
|
+
magnus::TryConvert::try_convert(val)?
|
|
36887
|
+
};
|
|
36888
|
+
// Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
|
|
36889
|
+
// emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
|
|
36890
|
+
// existing consumer code written in any of those styles keep working.
|
|
36891
|
+
match s.as_str() {
|
|
36892
|
+
"preserve" | "Preserve" => Ok(CaptionAltTextMode::Preserve),
|
|
36893
|
+
"combine" | "Combine" => Ok(CaptionAltTextMode::Combine),
|
|
36894
|
+
"replace" | "Replace" => Ok(CaptionAltTextMode::Replace),
|
|
36895
|
+
other => Err(magnus::Error::new(
|
|
36896
|
+
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
36897
|
+
format!("invalid CaptionAltTextMode value: {other}"),
|
|
36898
|
+
)),
|
|
36899
|
+
}
|
|
36900
|
+
}
|
|
36901
|
+
}
|
|
36902
|
+
|
|
36903
|
+
unsafe impl IntoValueFromNative for CaptionAltTextMode {}
|
|
36904
|
+
unsafe impl TryConvertOwned for CaptionAltTextMode {}
|
|
36905
|
+
|
|
36429
36906
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
36430
36907
|
#[serde(tag = "type")]
|
|
36431
36908
|
#[serde(rename_all = "snake_case")]
|
|
@@ -40917,6 +41394,59 @@ impl magnus::TryConvert for ProcessingStage {
|
|
|
40917
41394
|
unsafe impl IntoValueFromNative for ProcessingStage {}
|
|
40918
41395
|
unsafe impl TryConvertOwned for ProcessingStage {}
|
|
40919
41396
|
|
|
41397
|
+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
41398
|
+
#[serde(rename_all = "snake_case")]
|
|
41399
|
+
pub enum RedactionOffsetEncoding {
|
|
41400
|
+
Utf8Bytes,
|
|
41401
|
+
UnicodeCodePoints,
|
|
41402
|
+
Utf16CodeUnits,
|
|
41403
|
+
}
|
|
41404
|
+
|
|
41405
|
+
impl Default for RedactionOffsetEncoding {
|
|
41406
|
+
fn default() -> Self {
|
|
41407
|
+
Self::UnicodeCodePoints
|
|
41408
|
+
}
|
|
41409
|
+
}
|
|
41410
|
+
|
|
41411
|
+
impl magnus::IntoValue for RedactionOffsetEncoding {
|
|
41412
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
41413
|
+
let sym = match self {
|
|
41414
|
+
RedactionOffsetEncoding::Utf8Bytes => "utf8_bytes",
|
|
41415
|
+
RedactionOffsetEncoding::UnicodeCodePoints => "unicode_code_points",
|
|
41416
|
+
RedactionOffsetEncoding::Utf16CodeUnits => "utf16_code_units",
|
|
41417
|
+
};
|
|
41418
|
+
handle.to_symbol(sym).into_value_with(handle)
|
|
41419
|
+
}
|
|
41420
|
+
}
|
|
41421
|
+
|
|
41422
|
+
impl magnus::TryConvert for RedactionOffsetEncoding {
|
|
41423
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
41424
|
+
// IntoValue emits Symbols, including when this enum is a Hash key.
|
|
41425
|
+
// Accept that exact representation as well as String inputs; do not
|
|
41426
|
+
// coerce arbitrary objects through to_s.
|
|
41427
|
+
let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
|
|
41428
|
+
symbol.name()?.into_owned()
|
|
41429
|
+
} else {
|
|
41430
|
+
magnus::TryConvert::try_convert(val)?
|
|
41431
|
+
};
|
|
41432
|
+
// Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
|
|
41433
|
+
// emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
|
|
41434
|
+
// existing consumer code written in any of those styles keep working.
|
|
41435
|
+
match s.as_str() {
|
|
41436
|
+
"utf8_bytes" | "Utf8Bytes" => Ok(RedactionOffsetEncoding::Utf8Bytes),
|
|
41437
|
+
"unicode_code_points" | "UnicodeCodePoints" => Ok(RedactionOffsetEncoding::UnicodeCodePoints),
|
|
41438
|
+
"utf16_code_units" | "Utf16CodeUnits" => Ok(RedactionOffsetEncoding::Utf16CodeUnits),
|
|
41439
|
+
other => Err(magnus::Error::new(
|
|
41440
|
+
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
41441
|
+
format!("invalid RedactionOffsetEncoding value: {other}"),
|
|
41442
|
+
)),
|
|
41443
|
+
}
|
|
41444
|
+
}
|
|
41445
|
+
}
|
|
41446
|
+
|
|
41447
|
+
unsafe impl IntoValueFromNative for RedactionOffsetEncoding {}
|
|
41448
|
+
unsafe impl TryConvertOwned for RedactionOffsetEncoding {}
|
|
41449
|
+
|
|
40920
41450
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
40921
41451
|
#[serde(rename_all = "snake_case")]
|
|
40922
41452
|
pub enum RedactionStrategy {
|
|
@@ -42514,6 +43044,130 @@ fn extract_batch_async(args: &[magnus::Value]) -> Result<ExtractionResult, Error
|
|
|
42514
43044
|
Ok(result.into())
|
|
42515
43045
|
}
|
|
42516
43046
|
|
|
43047
|
+
#[cfg(feature = "redaction")]
|
|
43048
|
+
fn extract_with_external_redaction(args: &[magnus::Value]) -> Result<ExtractionResult, Error> {
|
|
43049
|
+
let args = magnus::scan_args::scan_args::<
|
|
43050
|
+
(magnus::Value, magnus::Value, String),
|
|
43051
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43052
|
+
(),
|
|
43053
|
+
(),
|
|
43054
|
+
(),
|
|
43055
|
+
(),
|
|
43056
|
+
>(args)?;
|
|
43057
|
+
let (input, config, findings_json) = args.required;
|
|
43058
|
+
|
|
43059
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43060
|
+
|
|
43061
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43062
|
+
if v.is_nil() {
|
|
43063
|
+
None
|
|
43064
|
+
} else {
|
|
43065
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43066
|
+
}
|
|
43067
|
+
});
|
|
43068
|
+
|
|
43069
|
+
let input_core: xberg::ExtractInput = {
|
|
43070
|
+
let binding_val: ExtractInput = ExtractInput::try_convert(input).map_err(|e| {
|
|
43071
|
+
magnus::Error::new(
|
|
43072
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43073
|
+
e.to_string(),
|
|
43074
|
+
)
|
|
43075
|
+
})?;
|
|
43076
|
+
binding_val.into()
|
|
43077
|
+
};
|
|
43078
|
+
let config_core: xberg::ExtractionConfig = {
|
|
43079
|
+
let binding_val: ExtractionConfig = ExtractionConfig::try_convert(config).map_err(|e| {
|
|
43080
|
+
magnus::Error::new(
|
|
43081
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43082
|
+
e.to_string(),
|
|
43083
|
+
)
|
|
43084
|
+
})?;
|
|
43085
|
+
binding_val.into()
|
|
43086
|
+
};
|
|
43087
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43088
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43089
|
+
.enable_all()
|
|
43090
|
+
.build()
|
|
43091
|
+
.map_err(|e| e.to_string())?;
|
|
43092
|
+
rt.block_on(async {
|
|
43093
|
+
xberg::extract_with_external_redaction(
|
|
43094
|
+
input_core,
|
|
43095
|
+
&config_core,
|
|
43096
|
+
&findings_json,
|
|
43097
|
+
offset_encoding.as_deref(),
|
|
43098
|
+
max_findings,
|
|
43099
|
+
)
|
|
43100
|
+
.await
|
|
43101
|
+
})
|
|
43102
|
+
.map_err(|e| e.to_string())
|
|
43103
|
+
});
|
|
43104
|
+
let result = async_result
|
|
43105
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43106
|
+
Ok(result.into())
|
|
43107
|
+
}
|
|
43108
|
+
|
|
43109
|
+
#[cfg(feature = "redaction")]
|
|
43110
|
+
fn extract_with_external_redaction_async(args: &[magnus::Value]) -> Result<ExtractionResult, Error> {
|
|
43111
|
+
let args = magnus::scan_args::scan_args::<
|
|
43112
|
+
(magnus::Value, magnus::Value, String),
|
|
43113
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43114
|
+
(),
|
|
43115
|
+
(),
|
|
43116
|
+
(),
|
|
43117
|
+
(),
|
|
43118
|
+
>(args)?;
|
|
43119
|
+
let (input, config, findings_json) = args.required;
|
|
43120
|
+
|
|
43121
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43122
|
+
|
|
43123
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43124
|
+
if v.is_nil() {
|
|
43125
|
+
None
|
|
43126
|
+
} else {
|
|
43127
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43128
|
+
}
|
|
43129
|
+
});
|
|
43130
|
+
|
|
43131
|
+
let input_core: xberg::ExtractInput = {
|
|
43132
|
+
let binding_val: ExtractInput = ExtractInput::try_convert(input).map_err(|e| {
|
|
43133
|
+
magnus::Error::new(
|
|
43134
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43135
|
+
e.to_string(),
|
|
43136
|
+
)
|
|
43137
|
+
})?;
|
|
43138
|
+
binding_val.into()
|
|
43139
|
+
};
|
|
43140
|
+
let config_core: xberg::ExtractionConfig = {
|
|
43141
|
+
let binding_val: ExtractionConfig = ExtractionConfig::try_convert(config).map_err(|e| {
|
|
43142
|
+
magnus::Error::new(
|
|
43143
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43144
|
+
e.to_string(),
|
|
43145
|
+
)
|
|
43146
|
+
})?;
|
|
43147
|
+
binding_val.into()
|
|
43148
|
+
};
|
|
43149
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43150
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43151
|
+
.enable_all()
|
|
43152
|
+
.build()
|
|
43153
|
+
.map_err(|e| e.to_string())?;
|
|
43154
|
+
rt.block_on(async {
|
|
43155
|
+
xberg::extract_with_external_redaction(
|
|
43156
|
+
input_core,
|
|
43157
|
+
&config_core,
|
|
43158
|
+
&findings_json,
|
|
43159
|
+
offset_encoding.as_deref(),
|
|
43160
|
+
max_findings,
|
|
43161
|
+
)
|
|
43162
|
+
.await
|
|
43163
|
+
})
|
|
43164
|
+
.map_err(|e| e.to_string())
|
|
43165
|
+
});
|
|
43166
|
+
let result = async_result
|
|
43167
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43168
|
+
Ok(result.into())
|
|
43169
|
+
}
|
|
43170
|
+
|
|
42517
43171
|
#[cfg(feature = "markdown-footnotes")]
|
|
42518
43172
|
fn find_unmarked_claims(markdown: String) -> Vec<String> {
|
|
42519
43173
|
xberg::find_unmarked_claims(&markdown)
|
|
@@ -42549,6 +43203,31 @@ fn list_ocr_backend_capabilities() -> Result<Vec<OcrBackendCapabilities>, Error>
|
|
|
42549
43203
|
Ok(result.into_iter().map(Into::into).collect())
|
|
42550
43204
|
}
|
|
42551
43205
|
|
|
43206
|
+
fn list_ocr_backend_capabilities_for(args: &[magnus::Value]) -> Result<Vec<OcrBackendCapabilities>, Error> {
|
|
43207
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
43208
|
+
let (config,) = args.optional;
|
|
43209
|
+
|
|
43210
|
+
let config_core: xberg::OcrConfig = match config {
|
|
43211
|
+
Some(_v) if !_v.is_nil() => {
|
|
43212
|
+
let binding_val: OcrConfig = OcrConfig::try_convert(_v).map_err(|e| {
|
|
43213
|
+
magnus::Error::new(
|
|
43214
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43215
|
+
e.to_string(),
|
|
43216
|
+
)
|
|
43217
|
+
})?;
|
|
43218
|
+
binding_val.into()
|
|
43219
|
+
}
|
|
43220
|
+
_ => Default::default(),
|
|
43221
|
+
};
|
|
43222
|
+
let result = xberg::list_ocr_backend_capabilities_for(&config_core).map_err(|e| {
|
|
43223
|
+
magnus::Error::new(
|
|
43224
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43225
|
+
e.to_string(),
|
|
43226
|
+
)
|
|
43227
|
+
})?;
|
|
43228
|
+
Ok(result.into_iter().map(Into::into).collect())
|
|
43229
|
+
}
|
|
43230
|
+
|
|
42552
43231
|
fn list_ocr_backends() -> Result<Vec<String>, Error> {
|
|
42553
43232
|
let result = xberg::list_ocr_backends().map_err(|e| {
|
|
42554
43233
|
magnus::Error::new(
|
|
@@ -42734,6 +43413,165 @@ fn ocr_backend_supports_language(backend: String, language: String) -> Result<bo
|
|
|
42734
43413
|
Ok(result)
|
|
42735
43414
|
}
|
|
42736
43415
|
|
|
43416
|
+
fn ocr_backend_supports_language_for(args: &[magnus::Value]) -> Result<bool, Error> {
|
|
43417
|
+
let args = magnus::scan_args::scan_args::<(String, String), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
43418
|
+
let (backend, language) = args.required;
|
|
43419
|
+
|
|
43420
|
+
let (config,) = args.optional;
|
|
43421
|
+
|
|
43422
|
+
let config_core: xberg::OcrConfig = match config {
|
|
43423
|
+
Some(_v) if !_v.is_nil() => {
|
|
43424
|
+
let binding_val: OcrConfig = OcrConfig::try_convert(_v).map_err(|e| {
|
|
43425
|
+
magnus::Error::new(
|
|
43426
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43427
|
+
e.to_string(),
|
|
43428
|
+
)
|
|
43429
|
+
})?;
|
|
43430
|
+
binding_val.into()
|
|
43431
|
+
}
|
|
43432
|
+
_ => Default::default(),
|
|
43433
|
+
};
|
|
43434
|
+
let result = xberg::ocr_backend_supports_language_for(&backend, &language, &config_core).map_err(|e| {
|
|
43435
|
+
magnus::Error::new(
|
|
43436
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43437
|
+
e.to_string(),
|
|
43438
|
+
)
|
|
43439
|
+
})?;
|
|
43440
|
+
Ok(result)
|
|
43441
|
+
}
|
|
43442
|
+
|
|
43443
|
+
#[cfg(feature = "pdf")]
|
|
43444
|
+
fn pdf_page_count(args: &[magnus::Value]) -> Result<usize, Error> {
|
|
43445
|
+
let args = magnus::scan_args::scan_args::<(Vec<u8>,), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
43446
|
+
let (pdf_bytes,) = args.required;
|
|
43447
|
+
|
|
43448
|
+
let (password,) = args.optional;
|
|
43449
|
+
|
|
43450
|
+
let password: Option<String> = password.and_then(|v| {
|
|
43451
|
+
if v.is_nil() {
|
|
43452
|
+
None
|
|
43453
|
+
} else {
|
|
43454
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43455
|
+
}
|
|
43456
|
+
});
|
|
43457
|
+
|
|
43458
|
+
let result = xberg::pdf_page_count(&pdf_bytes, password.as_deref()).map_err(|e| {
|
|
43459
|
+
magnus::Error::new(
|
|
43460
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43461
|
+
e.to_string(),
|
|
43462
|
+
)
|
|
43463
|
+
})?;
|
|
43464
|
+
Ok(result)
|
|
43465
|
+
}
|
|
43466
|
+
|
|
43467
|
+
#[cfg(feature = "redaction")]
|
|
43468
|
+
fn redact_external(args: &[magnus::Value]) -> Result<ExtractedDocument, Error> {
|
|
43469
|
+
let args = magnus::scan_args::scan_args::<
|
|
43470
|
+
(magnus::Value, magnus::Value, String),
|
|
43471
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43472
|
+
(),
|
|
43473
|
+
(),
|
|
43474
|
+
(),
|
|
43475
|
+
(),
|
|
43476
|
+
>(args)?;
|
|
43477
|
+
let (document, config, findings_json) = args.required;
|
|
43478
|
+
|
|
43479
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43480
|
+
|
|
43481
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43482
|
+
if v.is_nil() {
|
|
43483
|
+
None
|
|
43484
|
+
} else {
|
|
43485
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43486
|
+
}
|
|
43487
|
+
});
|
|
43488
|
+
|
|
43489
|
+
let document: xberg::ExtractedDocument = {
|
|
43490
|
+
let binding_val: ExtractedDocument = ExtractedDocument::try_convert(document)
|
|
43491
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43492
|
+
binding_val.into()
|
|
43493
|
+
};
|
|
43494
|
+
let config: xberg::RedactionConfig = {
|
|
43495
|
+
let binding_val: RedactionConfig = RedactionConfig::try_convert(config)
|
|
43496
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43497
|
+
binding_val.into()
|
|
43498
|
+
};
|
|
43499
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43500
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43501
|
+
.enable_all()
|
|
43502
|
+
.build()
|
|
43503
|
+
.map_err(|e| e.to_string())?;
|
|
43504
|
+
rt.block_on(async {
|
|
43505
|
+
xberg::redact_external(
|
|
43506
|
+
document.into(),
|
|
43507
|
+
config.into(),
|
|
43508
|
+
&findings_json,
|
|
43509
|
+
offset_encoding.as_deref(),
|
|
43510
|
+
max_findings,
|
|
43511
|
+
)
|
|
43512
|
+
.await
|
|
43513
|
+
})
|
|
43514
|
+
.map_err(|e| e.to_string())
|
|
43515
|
+
});
|
|
43516
|
+
let result = async_result
|
|
43517
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43518
|
+
Ok(result.into())
|
|
43519
|
+
}
|
|
43520
|
+
|
|
43521
|
+
#[cfg(feature = "redaction")]
|
|
43522
|
+
fn redact_external_async(args: &[magnus::Value]) -> Result<ExtractedDocument, Error> {
|
|
43523
|
+
let args = magnus::scan_args::scan_args::<
|
|
43524
|
+
(magnus::Value, magnus::Value, String),
|
|
43525
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43526
|
+
(),
|
|
43527
|
+
(),
|
|
43528
|
+
(),
|
|
43529
|
+
(),
|
|
43530
|
+
>(args)?;
|
|
43531
|
+
let (document, config, findings_json) = args.required;
|
|
43532
|
+
|
|
43533
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43534
|
+
|
|
43535
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43536
|
+
if v.is_nil() {
|
|
43537
|
+
None
|
|
43538
|
+
} else {
|
|
43539
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43540
|
+
}
|
|
43541
|
+
});
|
|
43542
|
+
|
|
43543
|
+
let document: xberg::ExtractedDocument = {
|
|
43544
|
+
let binding_val: ExtractedDocument = ExtractedDocument::try_convert(document)
|
|
43545
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43546
|
+
binding_val.into()
|
|
43547
|
+
};
|
|
43548
|
+
let config: xberg::RedactionConfig = {
|
|
43549
|
+
let binding_val: RedactionConfig = RedactionConfig::try_convert(config)
|
|
43550
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43551
|
+
binding_val.into()
|
|
43552
|
+
};
|
|
43553
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43554
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43555
|
+
.enable_all()
|
|
43556
|
+
.build()
|
|
43557
|
+
.map_err(|e| e.to_string())?;
|
|
43558
|
+
rt.block_on(async {
|
|
43559
|
+
xberg::redact_external(
|
|
43560
|
+
document.into(),
|
|
43561
|
+
config.into(),
|
|
43562
|
+
&findings_json,
|
|
43563
|
+
offset_encoding.as_deref(),
|
|
43564
|
+
max_findings,
|
|
43565
|
+
)
|
|
43566
|
+
.await
|
|
43567
|
+
})
|
|
43568
|
+
.map_err(|e| e.to_string())
|
|
43569
|
+
});
|
|
43570
|
+
let result = async_result
|
|
43571
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43572
|
+
Ok(result.into())
|
|
43573
|
+
}
|
|
43574
|
+
|
|
42737
43575
|
#[cfg(feature = "markdown-footnotes")]
|
|
42738
43576
|
fn verify_excerpt(excerpt: String, source_text: String) -> bool {
|
|
42739
43577
|
xberg::verify_excerpt(&excerpt, &source_text)
|
|
@@ -42842,6 +43680,8 @@ pub struct RbOcrBackendBridge {
|
|
|
42842
43680
|
cached_name: String,
|
|
42843
43681
|
has_process_image_file: bool,
|
|
42844
43682
|
has_supported_languages: bool,
|
|
43683
|
+
has_supported_languages_for: bool,
|
|
43684
|
+
has_supports_language_for: bool,
|
|
42845
43685
|
has_supports_table_detection: bool,
|
|
42846
43686
|
has_supports_document_processing: bool,
|
|
42847
43687
|
has_emits_structured_markdown: bool,
|
|
@@ -42894,6 +43734,8 @@ impl RbOcrBackendBridge {
|
|
|
42894
43734
|
runtime_dispatcher,
|
|
42895
43735
|
has_process_image_file: rb_obj.respond_to("process_image_file", false).unwrap_or(false),
|
|
42896
43736
|
has_supported_languages: rb_obj.respond_to("supported_languages", false).unwrap_or(false),
|
|
43737
|
+
has_supported_languages_for: rb_obj.respond_to("supported_languages_for", false).unwrap_or(false),
|
|
43738
|
+
has_supports_language_for: rb_obj.respond_to("supports_language_for", false).unwrap_or(false),
|
|
42897
43739
|
has_supports_table_detection: rb_obj.respond_to("supports_table_detection", false).unwrap_or(false),
|
|
42898
43740
|
has_supports_document_processing: rb_obj
|
|
42899
43741
|
.respond_to("supports_document_processing", false)
|
|
@@ -43220,6 +44062,88 @@ impl xberg::OcrBackend for RbOcrBackendBridge {
|
|
|
43220
44062
|
}
|
|
43221
44063
|
}
|
|
43222
44064
|
|
|
44065
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44066
|
+
if !(self.has_supported_languages_for) {
|
|
44067
|
+
return RbOcrBackendBridgeDefaultSupportedLanguagesFor(self).supported_languages_for(config);
|
|
44068
|
+
}
|
|
44069
|
+
let config = config.clone();
|
|
44070
|
+
let callback = move |ruby: &magnus::Ruby, value: magnus::Value| -> Vec<String> {
|
|
44071
|
+
let val: magnus::Value = match value.funcall::<_, _, magnus::Value>(
|
|
44072
|
+
"supported_languages_for",
|
|
44073
|
+
({
|
|
44074
|
+
use magnus::IntoValue;
|
|
44075
|
+
OcrConfig::from(config.clone()).into_value_with(&ruby)
|
|
44076
|
+
},),
|
|
44077
|
+
) {
|
|
44078
|
+
Ok(v) => v,
|
|
44079
|
+
Err(e) => {
|
|
44080
|
+
// This method's Rust signature is infallible, so a Ruby exception cannot
|
|
44081
|
+
// propagate. Log before substituting the default — a silent default is
|
|
44082
|
+
// indistinguishable from a real result to the caller.
|
|
44083
|
+
tracing::warn!(wrapper = "RbOcrBackendBridge", method = "supported_languages_for", error = %e, "host callback raised; returning default");
|
|
44084
|
+
return Default::default();
|
|
44085
|
+
}
|
|
44086
|
+
};
|
|
44087
|
+
<Vec<String> as magnus::TryConvert>::try_convert(val).unwrap_or_else(|e| {
|
|
44088
|
+
tracing::warn!(wrapper = "RbOcrBackendBridge", method = "supported_languages_for", error = %e, "host returned an unconvertible value; returning default");
|
|
44089
|
+
Default::default()
|
|
44090
|
+
})
|
|
44091
|
+
};
|
|
44092
|
+
match magnus::Ruby::get() {
|
|
44093
|
+
Ok(ruby) => callback(&ruby, self.inner.get_inner_with(&ruby)),
|
|
44094
|
+
Err(_) => match self.runtime_dispatcher.dispatch(callback) {
|
|
44095
|
+
Ok(result) => result,
|
|
44096
|
+
Err(error) => {
|
|
44097
|
+
tracing::warn!(wrapper = "RbOcrBackendBridge", method = "supported_languages_for", %error, "Ruby runtime dispatcher failed; returning default");
|
|
44098
|
+
Default::default()
|
|
44099
|
+
}
|
|
44100
|
+
},
|
|
44101
|
+
}
|
|
44102
|
+
}
|
|
44103
|
+
|
|
44104
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44105
|
+
if !(self.has_supports_language_for) {
|
|
44106
|
+
return RbOcrBackendBridgeDefaultSupportsLanguageFor(self).supports_language_for(config, language);
|
|
44107
|
+
}
|
|
44108
|
+
let config = config.clone();
|
|
44109
|
+
let language = language.to_string();
|
|
44110
|
+
let callback = move |ruby: &magnus::Ruby, value: magnus::Value| -> bool {
|
|
44111
|
+
let val: magnus::Value = match value.funcall::<_, _, magnus::Value>(
|
|
44112
|
+
"supports_language_for",
|
|
44113
|
+
(
|
|
44114
|
+
{
|
|
44115
|
+
use magnus::IntoValue;
|
|
44116
|
+
OcrConfig::from(config.clone()).into_value_with(&ruby)
|
|
44117
|
+
},
|
|
44118
|
+
ruby.str_new(AsRef::<str>::as_ref(&language)).as_value(),
|
|
44119
|
+
),
|
|
44120
|
+
) {
|
|
44121
|
+
Ok(v) => v,
|
|
44122
|
+
Err(e) => {
|
|
44123
|
+
// This method's Rust signature is infallible, so a Ruby exception cannot
|
|
44124
|
+
// propagate. Log before substituting the default — a silent default is
|
|
44125
|
+
// indistinguishable from a real result to the caller.
|
|
44126
|
+
tracing::warn!(wrapper = "RbOcrBackendBridge", method = "supports_language_for", error = %e, "host callback raised; returning default");
|
|
44127
|
+
return Default::default();
|
|
44128
|
+
}
|
|
44129
|
+
};
|
|
44130
|
+
<bool as magnus::TryConvert>::try_convert(val).unwrap_or_else(|e| {
|
|
44131
|
+
tracing::warn!(wrapper = "RbOcrBackendBridge", method = "supports_language_for", error = %e, "host returned an unconvertible value; returning default");
|
|
44132
|
+
Default::default()
|
|
44133
|
+
})
|
|
44134
|
+
};
|
|
44135
|
+
match magnus::Ruby::get() {
|
|
44136
|
+
Ok(ruby) => callback(&ruby, self.inner.get_inner_with(&ruby)),
|
|
44137
|
+
Err(_) => match self.runtime_dispatcher.dispatch(callback) {
|
|
44138
|
+
Ok(result) => result,
|
|
44139
|
+
Err(error) => {
|
|
44140
|
+
tracing::warn!(wrapper = "RbOcrBackendBridge", method = "supports_language_for", %error, "Ruby runtime dispatcher failed; returning default");
|
|
44141
|
+
Default::default()
|
|
44142
|
+
}
|
|
44143
|
+
},
|
|
44144
|
+
}
|
|
44145
|
+
}
|
|
44146
|
+
|
|
43223
44147
|
fn supports_table_detection(&self) -> bool {
|
|
43224
44148
|
if !(self.has_supports_table_detection) {
|
|
43225
44149
|
return RbOcrBackendBridgeDefaultSupportsTableDetection(self).supports_table_detection();
|
|
@@ -43502,6 +44426,12 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultProcessImageFile<'_> {
|
|
|
43502
44426
|
fn supported_languages(&self) -> Vec<String> {
|
|
43503
44427
|
xberg::OcrBackend::supported_languages(self.0)
|
|
43504
44428
|
}
|
|
44429
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44430
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
44431
|
+
}
|
|
44432
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44433
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
44434
|
+
}
|
|
43505
44435
|
fn supports_table_detection(&self) -> bool {
|
|
43506
44436
|
xberg::OcrBackend::supports_table_detection(self.0)
|
|
43507
44437
|
}
|
|
@@ -43570,6 +44500,160 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultSupportedLanguages<'_> {
|
|
|
43570
44500
|
fn backend_type(&self) -> xberg::OcrBackendType {
|
|
43571
44501
|
xberg::OcrBackend::backend_type(self.0)
|
|
43572
44502
|
}
|
|
44503
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44504
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
44505
|
+
}
|
|
44506
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44507
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
44508
|
+
}
|
|
44509
|
+
fn supports_table_detection(&self) -> bool {
|
|
44510
|
+
xberg::OcrBackend::supports_table_detection(self.0)
|
|
44511
|
+
}
|
|
44512
|
+
fn supports_document_processing(&self) -> bool {
|
|
44513
|
+
xberg::OcrBackend::supports_document_processing(self.0)
|
|
44514
|
+
}
|
|
44515
|
+
fn emits_structured_markdown(&self) -> bool {
|
|
44516
|
+
xberg::OcrBackend::emits_structured_markdown(self.0)
|
|
44517
|
+
}
|
|
44518
|
+
fn confidence_semantics(&self) -> xberg::ConfidenceSemantics {
|
|
44519
|
+
xberg::OcrBackend::confidence_semantics(self.0)
|
|
44520
|
+
}
|
|
44521
|
+
fn page_orientation_handling(&self) -> xberg::PageOrientationHandling {
|
|
44522
|
+
xberg::OcrBackend::page_orientation_handling(self.0)
|
|
44523
|
+
}
|
|
44524
|
+
async fn process_document(
|
|
44525
|
+
&self,
|
|
44526
|
+
_path: &std::path::Path,
|
|
44527
|
+
_config: &xberg::OcrConfig,
|
|
44528
|
+
) -> std::result::Result<xberg::ExtractedDocument, xberg::XbergError> {
|
|
44529
|
+
xberg::OcrBackend::process_document(self.0, _path, _config).await
|
|
44530
|
+
}
|
|
44531
|
+
}
|
|
44532
|
+
|
|
44533
|
+
/// Runs `supported_languages_for`'s Rust default body for [`RbOcrBackendBridge`] while routing
|
|
44534
|
+
/// every other trait method back through the bridge, so the default body's `self.*`
|
|
44535
|
+
/// calls still reach host overrides.
|
|
44536
|
+
#[derive(Debug)]
|
|
44537
|
+
struct RbOcrBackendBridgeDefaultSupportedLanguagesFor<'a>(&'a RbOcrBackendBridge);
|
|
44538
|
+
impl xberg::plugins::Plugin for RbOcrBackendBridgeDefaultSupportedLanguagesFor<'_> {
|
|
44539
|
+
fn name(&self) -> &str {
|
|
44540
|
+
xberg::plugins::Plugin::name(self.0)
|
|
44541
|
+
}
|
|
44542
|
+
|
|
44543
|
+
fn version(&self) -> String {
|
|
44544
|
+
xberg::plugins::Plugin::version(self.0)
|
|
44545
|
+
}
|
|
44546
|
+
|
|
44547
|
+
fn initialize(&self) -> std::result::Result<(), xberg::XbergError> {
|
|
44548
|
+
xberg::plugins::Plugin::initialize(self.0)
|
|
44549
|
+
}
|
|
44550
|
+
|
|
44551
|
+
fn shutdown(&self) -> std::result::Result<(), xberg::XbergError> {
|
|
44552
|
+
xberg::plugins::Plugin::shutdown(self.0)
|
|
44553
|
+
}
|
|
44554
|
+
}
|
|
44555
|
+
#[async_trait::async_trait]
|
|
44556
|
+
impl xberg::OcrBackend for RbOcrBackendBridgeDefaultSupportedLanguagesFor<'_> {
|
|
44557
|
+
async fn process_image(
|
|
44558
|
+
&self,
|
|
44559
|
+
image_bytes: &[u8],
|
|
44560
|
+
config: &xberg::OcrConfig,
|
|
44561
|
+
) -> std::result::Result<xberg::ExtractedDocument, xberg::XbergError> {
|
|
44562
|
+
xberg::OcrBackend::process_image(self.0, image_bytes, config).await
|
|
44563
|
+
}
|
|
44564
|
+
async fn process_image_file(
|
|
44565
|
+
&self,
|
|
44566
|
+
path: &std::path::Path,
|
|
44567
|
+
config: &xberg::OcrConfig,
|
|
44568
|
+
) -> std::result::Result<xberg::ExtractedDocument, xberg::XbergError> {
|
|
44569
|
+
xberg::OcrBackend::process_image_file(self.0, path, config).await
|
|
44570
|
+
}
|
|
44571
|
+
fn supports_language(&self, lang: &str) -> bool {
|
|
44572
|
+
xberg::OcrBackend::supports_language(self.0, lang)
|
|
44573
|
+
}
|
|
44574
|
+
fn backend_type(&self) -> xberg::OcrBackendType {
|
|
44575
|
+
xberg::OcrBackend::backend_type(self.0)
|
|
44576
|
+
}
|
|
44577
|
+
fn supported_languages(&self) -> Vec<String> {
|
|
44578
|
+
xberg::OcrBackend::supported_languages(self.0)
|
|
44579
|
+
}
|
|
44580
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44581
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
44582
|
+
}
|
|
44583
|
+
fn supports_table_detection(&self) -> bool {
|
|
44584
|
+
xberg::OcrBackend::supports_table_detection(self.0)
|
|
44585
|
+
}
|
|
44586
|
+
fn supports_document_processing(&self) -> bool {
|
|
44587
|
+
xberg::OcrBackend::supports_document_processing(self.0)
|
|
44588
|
+
}
|
|
44589
|
+
fn emits_structured_markdown(&self) -> bool {
|
|
44590
|
+
xberg::OcrBackend::emits_structured_markdown(self.0)
|
|
44591
|
+
}
|
|
44592
|
+
fn confidence_semantics(&self) -> xberg::ConfidenceSemantics {
|
|
44593
|
+
xberg::OcrBackend::confidence_semantics(self.0)
|
|
44594
|
+
}
|
|
44595
|
+
fn page_orientation_handling(&self) -> xberg::PageOrientationHandling {
|
|
44596
|
+
xberg::OcrBackend::page_orientation_handling(self.0)
|
|
44597
|
+
}
|
|
44598
|
+
async fn process_document(
|
|
44599
|
+
&self,
|
|
44600
|
+
_path: &std::path::Path,
|
|
44601
|
+
_config: &xberg::OcrConfig,
|
|
44602
|
+
) -> std::result::Result<xberg::ExtractedDocument, xberg::XbergError> {
|
|
44603
|
+
xberg::OcrBackend::process_document(self.0, _path, _config).await
|
|
44604
|
+
}
|
|
44605
|
+
}
|
|
44606
|
+
|
|
44607
|
+
/// Runs `supports_language_for`'s Rust default body for [`RbOcrBackendBridge`] while routing
|
|
44608
|
+
/// every other trait method back through the bridge, so the default body's `self.*`
|
|
44609
|
+
/// calls still reach host overrides.
|
|
44610
|
+
#[derive(Debug)]
|
|
44611
|
+
struct RbOcrBackendBridgeDefaultSupportsLanguageFor<'a>(&'a RbOcrBackendBridge);
|
|
44612
|
+
impl xberg::plugins::Plugin for RbOcrBackendBridgeDefaultSupportsLanguageFor<'_> {
|
|
44613
|
+
fn name(&self) -> &str {
|
|
44614
|
+
xberg::plugins::Plugin::name(self.0)
|
|
44615
|
+
}
|
|
44616
|
+
|
|
44617
|
+
fn version(&self) -> String {
|
|
44618
|
+
xberg::plugins::Plugin::version(self.0)
|
|
44619
|
+
}
|
|
44620
|
+
|
|
44621
|
+
fn initialize(&self) -> std::result::Result<(), xberg::XbergError> {
|
|
44622
|
+
xberg::plugins::Plugin::initialize(self.0)
|
|
44623
|
+
}
|
|
44624
|
+
|
|
44625
|
+
fn shutdown(&self) -> std::result::Result<(), xberg::XbergError> {
|
|
44626
|
+
xberg::plugins::Plugin::shutdown(self.0)
|
|
44627
|
+
}
|
|
44628
|
+
}
|
|
44629
|
+
#[async_trait::async_trait]
|
|
44630
|
+
impl xberg::OcrBackend for RbOcrBackendBridgeDefaultSupportsLanguageFor<'_> {
|
|
44631
|
+
async fn process_image(
|
|
44632
|
+
&self,
|
|
44633
|
+
image_bytes: &[u8],
|
|
44634
|
+
config: &xberg::OcrConfig,
|
|
44635
|
+
) -> std::result::Result<xberg::ExtractedDocument, xberg::XbergError> {
|
|
44636
|
+
xberg::OcrBackend::process_image(self.0, image_bytes, config).await
|
|
44637
|
+
}
|
|
44638
|
+
async fn process_image_file(
|
|
44639
|
+
&self,
|
|
44640
|
+
path: &std::path::Path,
|
|
44641
|
+
config: &xberg::OcrConfig,
|
|
44642
|
+
) -> std::result::Result<xberg::ExtractedDocument, xberg::XbergError> {
|
|
44643
|
+
xberg::OcrBackend::process_image_file(self.0, path, config).await
|
|
44644
|
+
}
|
|
44645
|
+
fn supports_language(&self, lang: &str) -> bool {
|
|
44646
|
+
xberg::OcrBackend::supports_language(self.0, lang)
|
|
44647
|
+
}
|
|
44648
|
+
fn backend_type(&self) -> xberg::OcrBackendType {
|
|
44649
|
+
xberg::OcrBackend::backend_type(self.0)
|
|
44650
|
+
}
|
|
44651
|
+
fn supported_languages(&self) -> Vec<String> {
|
|
44652
|
+
xberg::OcrBackend::supported_languages(self.0)
|
|
44653
|
+
}
|
|
44654
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44655
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
44656
|
+
}
|
|
43573
44657
|
fn supports_table_detection(&self) -> bool {
|
|
43574
44658
|
xberg::OcrBackend::supports_table_detection(self.0)
|
|
43575
44659
|
}
|
|
@@ -43641,6 +44725,12 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultSupportsTableDetection<'_> {
|
|
|
43641
44725
|
fn supported_languages(&self) -> Vec<String> {
|
|
43642
44726
|
xberg::OcrBackend::supported_languages(self.0)
|
|
43643
44727
|
}
|
|
44728
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44729
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
44730
|
+
}
|
|
44731
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44732
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
44733
|
+
}
|
|
43644
44734
|
fn supports_document_processing(&self) -> bool {
|
|
43645
44735
|
xberg::OcrBackend::supports_document_processing(self.0)
|
|
43646
44736
|
}
|
|
@@ -43709,6 +44799,12 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultSupportsDocumentProcessing<'
|
|
|
43709
44799
|
fn supported_languages(&self) -> Vec<String> {
|
|
43710
44800
|
xberg::OcrBackend::supported_languages(self.0)
|
|
43711
44801
|
}
|
|
44802
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44803
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
44804
|
+
}
|
|
44805
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44806
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
44807
|
+
}
|
|
43712
44808
|
fn supports_table_detection(&self) -> bool {
|
|
43713
44809
|
xberg::OcrBackend::supports_table_detection(self.0)
|
|
43714
44810
|
}
|
|
@@ -43777,6 +44873,12 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultEmitsStructuredMarkdown<'_>
|
|
|
43777
44873
|
fn supported_languages(&self) -> Vec<String> {
|
|
43778
44874
|
xberg::OcrBackend::supported_languages(self.0)
|
|
43779
44875
|
}
|
|
44876
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44877
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
44878
|
+
}
|
|
44879
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44880
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
44881
|
+
}
|
|
43780
44882
|
fn supports_table_detection(&self) -> bool {
|
|
43781
44883
|
xberg::OcrBackend::supports_table_detection(self.0)
|
|
43782
44884
|
}
|
|
@@ -43845,6 +44947,12 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultConfidenceSemantics<'_> {
|
|
|
43845
44947
|
fn supported_languages(&self) -> Vec<String> {
|
|
43846
44948
|
xberg::OcrBackend::supported_languages(self.0)
|
|
43847
44949
|
}
|
|
44950
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
44951
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
44952
|
+
}
|
|
44953
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
44954
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
44955
|
+
}
|
|
43848
44956
|
fn supports_table_detection(&self) -> bool {
|
|
43849
44957
|
xberg::OcrBackend::supports_table_detection(self.0)
|
|
43850
44958
|
}
|
|
@@ -43913,6 +45021,12 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultPageOrientationHandling<'_>
|
|
|
43913
45021
|
fn supported_languages(&self) -> Vec<String> {
|
|
43914
45022
|
xberg::OcrBackend::supported_languages(self.0)
|
|
43915
45023
|
}
|
|
45024
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
45025
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
45026
|
+
}
|
|
45027
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
45028
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
45029
|
+
}
|
|
43916
45030
|
fn supports_table_detection(&self) -> bool {
|
|
43917
45031
|
xberg::OcrBackend::supports_table_detection(self.0)
|
|
43918
45032
|
}
|
|
@@ -43981,6 +45095,12 @@ impl xberg::OcrBackend for RbOcrBackendBridgeDefaultProcessDocument<'_> {
|
|
|
43981
45095
|
fn supported_languages(&self) -> Vec<String> {
|
|
43982
45096
|
xberg::OcrBackend::supported_languages(self.0)
|
|
43983
45097
|
}
|
|
45098
|
+
fn supported_languages_for(&self, config: &xberg::OcrConfig) -> Vec<String> {
|
|
45099
|
+
xberg::OcrBackend::supported_languages_for(self.0, config)
|
|
45100
|
+
}
|
|
45101
|
+
fn supports_language_for(&self, config: &xberg::OcrConfig, language: &str) -> bool {
|
|
45102
|
+
xberg::OcrBackend::supports_language_for(self.0, config, language)
|
|
45103
|
+
}
|
|
43984
45104
|
fn supports_table_detection(&self) -> bool {
|
|
43985
45105
|
xberg::OcrBackend::supports_table_detection(self.0)
|
|
43986
45106
|
}
|
|
@@ -47128,6 +48248,8 @@ impl From<BrowserConfig> for crawlberg::BrowserConfig {
|
|
|
47128
48248
|
backend: val.backend.into(),
|
|
47129
48249
|
endpoint: val.endpoint,
|
|
47130
48250
|
timeout: std::time::Duration::from_millis(val.timeout),
|
|
48251
|
+
overall_timeout: std::time::Duration::from_millis(val.overall_timeout),
|
|
48252
|
+
shutdown_timeout: std::time::Duration::from_millis(val.shutdown_timeout),
|
|
47131
48253
|
wait: val.wait.into(),
|
|
47132
48254
|
wait_selector: val.wait_selector,
|
|
47133
48255
|
extra_wait: val.extra_wait.map(std::time::Duration::from_millis),
|
|
@@ -47150,6 +48272,8 @@ impl From<crawlberg::BrowserConfig> for BrowserConfig {
|
|
|
47150
48272
|
backend: val.backend.into(),
|
|
47151
48273
|
endpoint: val.endpoint.map(|v| v.to_string()),
|
|
47152
48274
|
timeout: val.timeout.as_millis() as u64,
|
|
48275
|
+
overall_timeout: val.overall_timeout.as_millis() as u64,
|
|
48276
|
+
shutdown_timeout: val.shutdown_timeout.as_millis() as u64,
|
|
47153
48277
|
wait: val.wait.into(),
|
|
47154
48278
|
wait_selector: val.wait_selector.map(|v| v.to_string()),
|
|
47155
48279
|
extra_wait: val.extra_wait.map(|d| d.as_millis() as u64),
|
|
@@ -47182,6 +48306,7 @@ impl From<CaptioningConfig> for xberg::CaptioningConfig {
|
|
|
47182
48306
|
llm: val.llm.into(),
|
|
47183
48307
|
prompt: val.prompt,
|
|
47184
48308
|
min_image_area: val.min_image_area,
|
|
48309
|
+
alt_text: val.alt_text.into(),
|
|
47185
48310
|
}
|
|
47186
48311
|
}
|
|
47187
48312
|
}
|
|
@@ -47193,6 +48318,7 @@ impl From<xberg::CaptioningConfig> for CaptioningConfig {
|
|
|
47193
48318
|
llm: val.llm.into(),
|
|
47194
48319
|
prompt: val.prompt.map(|v| v.to_string()),
|
|
47195
48320
|
min_image_area: val.min_image_area,
|
|
48321
|
+
alt_text: val.alt_text.into(),
|
|
47196
48322
|
}
|
|
47197
48323
|
}
|
|
47198
48324
|
}
|
|
@@ -47226,9 +48352,9 @@ impl From<Chunk> for xberg::Chunk {
|
|
|
47226
48352
|
content: val.content,
|
|
47227
48353
|
chunk_type: val.chunk_type.into(),
|
|
47228
48354
|
embedding: val.embedding.map(|v| v.into_iter().collect()),
|
|
47229
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
48355
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
47230
48356
|
sparse_embedding: val.sparse_embedding.map(Into::into),
|
|
47231
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
48357
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
47232
48358
|
late_interaction: val.late_interaction.map(Into::into),
|
|
47233
48359
|
metadata: val.metadata.into(),
|
|
47234
48360
|
}
|
|
@@ -47242,9 +48368,9 @@ impl From<xberg::Chunk> for Chunk {
|
|
|
47242
48368
|
content: val.content.to_string(),
|
|
47243
48369
|
chunk_type: val.chunk_type.into(),
|
|
47244
48370
|
embedding: val.embedding.map(|v| v.into_iter().collect()),
|
|
47245
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
48371
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
47246
48372
|
sparse_embedding: val.sparse_embedding.map(Into::into),
|
|
47247
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
48373
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
47248
48374
|
late_interaction: val.late_interaction.map(Into::into),
|
|
47249
48375
|
metadata: val.metadata.into(),
|
|
47250
48376
|
}
|
|
@@ -47611,6 +48737,7 @@ impl From<ContentConfig> for crawlberg::ContentConfig {
|
|
|
47611
48737
|
wrap: val.wrap,
|
|
47612
48738
|
wrap_width: val.wrap_width,
|
|
47613
48739
|
include_document_structure: val.include_document_structure,
|
|
48740
|
+
extract_metadata: val.extract_metadata,
|
|
47614
48741
|
..Default::default()
|
|
47615
48742
|
}
|
|
47616
48743
|
}
|
|
@@ -47631,6 +48758,7 @@ impl From<crawlberg::ContentConfig> for ContentConfig {
|
|
|
47631
48758
|
wrap: val.wrap,
|
|
47632
48759
|
wrap_width: val.wrap_width,
|
|
47633
48760
|
include_document_structure: val.include_document_structure,
|
|
48761
|
+
extract_metadata: val.extract_metadata,
|
|
47634
48762
|
}
|
|
47635
48763
|
}
|
|
47636
48764
|
}
|
|
@@ -47728,12 +48856,13 @@ impl From<ConversionOptions> for html_to_markdown_rs::ConversionOptions {
|
|
|
47728
48856
|
max_depth: val.max_depth,
|
|
47729
48857
|
exclude_selectors: val.exclude_selectors.into_iter().collect(),
|
|
47730
48858
|
tier_strategy: val.tier_strategy.into(),
|
|
48859
|
+
base_url: val.base_url,
|
|
47731
48860
|
..Default::default()
|
|
47732
48861
|
}
|
|
47733
48862
|
}
|
|
47734
48863
|
}
|
|
47735
48864
|
|
|
47736
|
-
#[allow(clippy::useless_conversion)]
|
|
48865
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
47737
48866
|
impl From<html_to_markdown_rs::ConversionOptions> for ConversionOptions {
|
|
47738
48867
|
fn from(val: html_to_markdown_rs::ConversionOptions) -> Self {
|
|
47739
48868
|
Self {
|
|
@@ -47780,6 +48909,7 @@ impl From<html_to_markdown_rs::ConversionOptions> for ConversionOptions {
|
|
|
47780
48909
|
max_depth: val.max_depth,
|
|
47781
48910
|
exclude_selectors: val.exclude_selectors.into_iter().collect(),
|
|
47782
48911
|
tier_strategy: val.tier_strategy.into(),
|
|
48912
|
+
base_url: val.base_url.map(|v| v.to_string()),
|
|
47783
48913
|
}
|
|
47784
48914
|
}
|
|
47785
48915
|
}
|
|
@@ -47853,6 +48983,10 @@ impl From<CrawlConfig> for crawlberg::CrawlConfig {
|
|
|
47853
48983
|
allow_subdomains: val.allow_subdomains,
|
|
47854
48984
|
include_paths: val.include_paths.into_iter().collect(),
|
|
47855
48985
|
exclude_paths: val.exclude_paths.into_iter().collect(),
|
|
48986
|
+
path_patterns_match_query: val.path_patterns_match_query,
|
|
48987
|
+
dedup_include_query: val.dedup_include_query,
|
|
48988
|
+
strip_tracking_params: val.strip_tracking_params,
|
|
48989
|
+
tracking_params: val.tracking_params.into_iter().collect(),
|
|
47856
48990
|
custom_headers: val
|
|
47857
48991
|
.custom_headers
|
|
47858
48992
|
.into_iter()
|
|
@@ -47863,6 +48997,9 @@ impl From<CrawlConfig> for crawlberg::CrawlConfig {
|
|
|
47863
48997
|
max_redirects: val.max_redirects,
|
|
47864
48998
|
retry_count: val.retry_count,
|
|
47865
48999
|
retry_codes: val.retry_codes.into_iter().collect(),
|
|
49000
|
+
retry_initial_delay_ms: val.retry_initial_delay_ms,
|
|
49001
|
+
retry_max_delay_ms: val.retry_max_delay_ms,
|
|
49002
|
+
rate_limit_jitter_ratio: val.rate_limit_jitter_ratio,
|
|
47866
49003
|
cookies_enabled: val.cookies_enabled,
|
|
47867
49004
|
auth: val.auth.map(Into::into),
|
|
47868
49005
|
max_body_size: val.max_body_size,
|
|
@@ -47913,6 +49050,10 @@ impl From<crawlberg::CrawlConfig> for CrawlConfig {
|
|
|
47913
49050
|
allow_subdomains: val.allow_subdomains,
|
|
47914
49051
|
include_paths: val.include_paths.into_iter().collect(),
|
|
47915
49052
|
exclude_paths: val.exclude_paths.into_iter().collect(),
|
|
49053
|
+
path_patterns_match_query: val.path_patterns_match_query,
|
|
49054
|
+
dedup_include_query: val.dedup_include_query,
|
|
49055
|
+
strip_tracking_params: val.strip_tracking_params,
|
|
49056
|
+
tracking_params: val.tracking_params.into_iter().collect(),
|
|
47916
49057
|
custom_headers: val
|
|
47917
49058
|
.custom_headers
|
|
47918
49059
|
.into_iter()
|
|
@@ -47923,6 +49064,9 @@ impl From<crawlberg::CrawlConfig> for CrawlConfig {
|
|
|
47923
49064
|
max_redirects: val.max_redirects,
|
|
47924
49065
|
retry_count: val.retry_count,
|
|
47925
49066
|
retry_codes: val.retry_codes.into_iter().collect(),
|
|
49067
|
+
retry_initial_delay_ms: val.retry_initial_delay_ms,
|
|
49068
|
+
retry_max_delay_ms: val.retry_max_delay_ms,
|
|
49069
|
+
rate_limit_jitter_ratio: val.rate_limit_jitter_ratio,
|
|
47926
49070
|
cookies_enabled: val.cookies_enabled,
|
|
47927
49071
|
auth: val.auth.map(Into::into),
|
|
47928
49072
|
max_body_size: val.max_body_size,
|
|
@@ -48876,6 +50020,33 @@ impl From<xberg::ExcelWorkbook> for ExcelWorkbook {
|
|
|
48876
50020
|
}
|
|
48877
50021
|
}
|
|
48878
50022
|
|
|
50023
|
+
#[allow(clippy::needless_update)]
|
|
50024
|
+
impl From<ExternalRedactionFinding> for xberg::ExternalRedactionFinding {
|
|
50025
|
+
fn from(val: ExternalRedactionFinding) -> Self {
|
|
50026
|
+
Self {
|
|
50027
|
+
label: val.label,
|
|
50028
|
+
text: val.text,
|
|
50029
|
+
start: val.start,
|
|
50030
|
+
end: val.end,
|
|
50031
|
+
score: val.score,
|
|
50032
|
+
..Default::default()
|
|
50033
|
+
}
|
|
50034
|
+
}
|
|
50035
|
+
}
|
|
50036
|
+
|
|
50037
|
+
#[allow(clippy::redundant_closure)]
|
|
50038
|
+
impl From<xberg::ExternalRedactionFinding> for ExternalRedactionFinding {
|
|
50039
|
+
fn from(val: xberg::ExternalRedactionFinding) -> Self {
|
|
50040
|
+
Self {
|
|
50041
|
+
label: val.label.to_string(),
|
|
50042
|
+
text: val.text.map(|v| v.to_string()),
|
|
50043
|
+
start: val.start,
|
|
50044
|
+
end: val.end,
|
|
50045
|
+
score: val.score,
|
|
50046
|
+
}
|
|
50047
|
+
}
|
|
50048
|
+
}
|
|
50049
|
+
|
|
48879
50050
|
#[allow(clippy::needless_update)]
|
|
48880
50051
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
48881
50052
|
impl From<ExtractInput> for xberg::ExtractInput {
|
|
@@ -50074,6 +51245,7 @@ impl From<ImagePreprocessingConfig> for xberg::ImagePreprocessingConfig {
|
|
|
50074
51245
|
contrast_enhance: val.contrast_enhance,
|
|
50075
51246
|
binarization_method: val.binarization_method,
|
|
50076
51247
|
invert_colors: val.invert_colors,
|
|
51248
|
+
normalize_shaded_rows: val.normalize_shaded_rows,
|
|
50077
51249
|
..Default::default()
|
|
50078
51250
|
}
|
|
50079
51251
|
}
|
|
@@ -50089,6 +51261,7 @@ impl From<xberg::ImagePreprocessingConfig> for ImagePreprocessingConfig {
|
|
|
50089
51261
|
contrast_enhance: val.contrast_enhance,
|
|
50090
51262
|
binarization_method: val.binarization_method.to_string(),
|
|
50091
51263
|
invert_colors: val.invert_colors,
|
|
51264
|
+
normalize_shaded_rows: val.normalize_shaded_rows,
|
|
50092
51265
|
}
|
|
50093
51266
|
}
|
|
50094
51267
|
}
|
|
@@ -50361,7 +51534,7 @@ impl From<xberg::LateInteractionConfig> for LateInteractionConfig {
|
|
|
50361
51534
|
}
|
|
50362
51535
|
}
|
|
50363
51536
|
|
|
50364
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
51537
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50365
51538
|
impl From<LateInteractionMatch> for xberg::LateInteractionMatch {
|
|
50366
51539
|
fn from(val: LateInteractionMatch) -> Self {
|
|
50367
51540
|
Self {
|
|
@@ -50371,7 +51544,7 @@ impl From<LateInteractionMatch> for xberg::LateInteractionMatch {
|
|
|
50371
51544
|
}
|
|
50372
51545
|
}
|
|
50373
51546
|
|
|
50374
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
51547
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50375
51548
|
impl From<xberg::LateInteractionMatch> for LateInteractionMatch {
|
|
50376
51549
|
fn from(val: xberg::LateInteractionMatch) -> Self {
|
|
50377
51550
|
Self {
|
|
@@ -50381,7 +51554,7 @@ impl From<xberg::LateInteractionMatch> for LateInteractionMatch {
|
|
|
50381
51554
|
}
|
|
50382
51555
|
}
|
|
50383
51556
|
|
|
50384
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
51557
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50385
51558
|
impl From<xberg::LateInteractionPreset> for LateInteractionPreset {
|
|
50386
51559
|
fn from(val: xberg::LateInteractionPreset) -> Self {
|
|
50387
51560
|
Self {
|
|
@@ -50840,7 +52013,6 @@ impl From<xberg::Metadata> for Metadata {
|
|
|
50840
52013
|
}
|
|
50841
52014
|
}
|
|
50842
52015
|
|
|
50843
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
50844
52016
|
impl From<xberg::ModelPaths> for ModelPaths {
|
|
50845
52017
|
fn from(val: xberg::ModelPaths) -> Self {
|
|
50846
52018
|
Self {
|
|
@@ -50852,7 +52024,7 @@ impl From<xberg::ModelPaths> for ModelPaths {
|
|
|
50852
52024
|
}
|
|
50853
52025
|
}
|
|
50854
52026
|
|
|
50855
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
52027
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50856
52028
|
impl From<MultiVectorEmbedding> for xberg::MultiVectorEmbedding {
|
|
50857
52029
|
fn from(val: MultiVectorEmbedding) -> Self {
|
|
50858
52030
|
Self {
|
|
@@ -50863,7 +52035,7 @@ impl From<MultiVectorEmbedding> for xberg::MultiVectorEmbedding {
|
|
|
50863
52035
|
}
|
|
50864
52036
|
}
|
|
50865
52037
|
|
|
50866
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
52038
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50867
52039
|
impl From<xberg::MultiVectorEmbedding> for MultiVectorEmbedding {
|
|
50868
52040
|
fn from(val: xberg::MultiVectorEmbedding) -> Self {
|
|
50869
52041
|
Self {
|
|
@@ -51010,6 +52182,7 @@ impl From<OcrConfig> for xberg::OcrConfig {
|
|
|
51010
52182
|
.paddle_ocr_config
|
|
51011
52183
|
.as_ref()
|
|
51012
52184
|
.and_then(|s| serde_json::from_str(s).ok()),
|
|
52185
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51013
52186
|
backend_options: val.backend_options.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
51014
52187
|
element_config: val.element_config.map(Into::into),
|
|
51015
52188
|
quality_thresholds: val.quality_thresholds.map(Into::into),
|
|
@@ -51024,6 +52197,7 @@ impl From<OcrConfig> for xberg::OcrConfig {
|
|
|
51024
52197
|
.tessdata_bytes
|
|
51025
52198
|
.map(|m| m.into_iter().map(|(k, v)| (k, v.to_vec().into())).collect()),
|
|
51026
52199
|
tessdata_path: val.tessdata_path.map(Into::into),
|
|
52200
|
+
numeric_repair: val.numeric_repair,
|
|
51027
52201
|
..Default::default()
|
|
51028
52202
|
}
|
|
51029
52203
|
}
|
|
@@ -51039,6 +52213,7 @@ impl From<xberg::OcrConfig> for OcrConfig {
|
|
|
51039
52213
|
tesseract_config: val.tesseract_config.map(Into::into),
|
|
51040
52214
|
output_format: val.output_format.map(Into::into),
|
|
51041
52215
|
paddle_ocr_config: val.paddle_ocr_config.as_ref().map(ToString::to_string),
|
|
52216
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51042
52217
|
backend_options: val.backend_options.as_ref().map(ToString::to_string),
|
|
51043
52218
|
element_config: val.element_config.map(Into::into),
|
|
51044
52219
|
quality_thresholds: val.quality_thresholds.map(Into::into),
|
|
@@ -51053,6 +52228,7 @@ impl From<xberg::OcrConfig> for OcrConfig {
|
|
|
51053
52228
|
.tessdata_bytes
|
|
51054
52229
|
.map(|m| m.into_iter().map(|(k, v)| (k, v.to_vec().into())).collect()),
|
|
51055
52230
|
tessdata_path: val.tessdata_path.map(|p| p.to_string_lossy().to_string()),
|
|
52231
|
+
numeric_repair: val.numeric_repair,
|
|
51056
52232
|
}
|
|
51057
52233
|
}
|
|
51058
52234
|
}
|
|
@@ -51202,6 +52378,7 @@ impl From<OcrPipelineStage> for xberg::OcrPipelineStage {
|
|
|
51202
52378
|
.paddle_ocr_config
|
|
51203
52379
|
.as_ref()
|
|
51204
52380
|
.and_then(|s| serde_json::from_str(s).ok()),
|
|
52381
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51205
52382
|
vlm_config: val.vlm_config.map(Into::into),
|
|
51206
52383
|
backend_options: val.backend_options.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
51207
52384
|
}
|
|
@@ -51217,6 +52394,7 @@ impl From<xberg::OcrPipelineStage> for OcrPipelineStage {
|
|
|
51217
52394
|
language: val.language.map(|v| v.into_iter().collect()),
|
|
51218
52395
|
tesseract_config: val.tesseract_config.map(Into::into),
|
|
51219
52396
|
paddle_ocr_config: val.paddle_ocr_config.as_ref().map(ToString::to_string),
|
|
52397
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51220
52398
|
vlm_config: val.vlm_config.map(Into::into),
|
|
51221
52399
|
backend_options: val.backend_options.as_ref().map(ToString::to_string),
|
|
51222
52400
|
}
|
|
@@ -51359,7 +52537,6 @@ impl From<xberg::OrientationResult> for OrientationResult {
|
|
|
51359
52537
|
}
|
|
51360
52538
|
}
|
|
51361
52539
|
|
|
51362
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
51363
52540
|
#[allow(clippy::needless_update)]
|
|
51364
52541
|
#[allow(clippy::useless_conversion)]
|
|
51365
52542
|
impl From<PaddleOcrConfig> for xberg::PaddleOcrConfig {
|
|
@@ -51384,7 +52561,6 @@ impl From<PaddleOcrConfig> for xberg::PaddleOcrConfig {
|
|
|
51384
52561
|
}
|
|
51385
52562
|
}
|
|
51386
52563
|
|
|
51387
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
51388
52564
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
51389
52565
|
impl From<xberg::PaddleOcrConfig> for PaddleOcrConfig {
|
|
51390
52566
|
fn from(val: xberg::PaddleOcrConfig) -> Self {
|
|
@@ -52330,12 +53506,16 @@ impl From<RedactionConfig> for xberg::RedactionConfig {
|
|
|
52330
53506
|
preserve_offsets: val.preserve_offsets,
|
|
52331
53507
|
custom_terms: val.custom_terms.into_iter().map(Into::into).collect(),
|
|
52332
53508
|
custom_patterns: val.custom_patterns.into_iter().map(Into::into).collect(),
|
|
53509
|
+
findings: val.findings.into_iter().map(Into::into).collect(),
|
|
53510
|
+
min_score: val.min_score,
|
|
53511
|
+
findings_path: val.findings_path.map(Into::into),
|
|
53512
|
+
findings_offset_encoding: val.findings_offset_encoding.into(),
|
|
52333
53513
|
..Default::default()
|
|
52334
53514
|
}
|
|
52335
53515
|
}
|
|
52336
53516
|
}
|
|
52337
53517
|
|
|
52338
|
-
#[allow(clippy::useless_conversion)]
|
|
53518
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
52339
53519
|
impl From<xberg::RedactionConfig> for RedactionConfig {
|
|
52340
53520
|
fn from(val: xberg::RedactionConfig) -> Self {
|
|
52341
53521
|
Self {
|
|
@@ -52345,6 +53525,10 @@ impl From<xberg::RedactionConfig> for RedactionConfig {
|
|
|
52345
53525
|
preserve_offsets: val.preserve_offsets,
|
|
52346
53526
|
custom_terms: val.custom_terms.into_iter().map(Into::into).collect(),
|
|
52347
53527
|
custom_patterns: val.custom_patterns.into_iter().map(Into::into).collect(),
|
|
53528
|
+
findings: val.findings.into_iter().map(Into::into).collect(),
|
|
53529
|
+
min_score: val.min_score,
|
|
53530
|
+
findings_path: val.findings_path.map(|p| p.to_string_lossy().to_string()),
|
|
53531
|
+
findings_offset_encoding: val.findings_offset_encoding.into(),
|
|
52348
53532
|
}
|
|
52349
53533
|
}
|
|
52350
53534
|
}
|
|
@@ -52435,7 +53619,10 @@ impl From<xberg::RedactionTerm> for RedactionTerm {
|
|
|
52435
53619
|
}
|
|
52436
53620
|
}
|
|
52437
53621
|
|
|
52438
|
-
#[cfg(any(
|
|
53622
|
+
#[cfg(any(
|
|
53623
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
53624
|
+
not(feature = "reranker-presets")
|
|
53625
|
+
))]
|
|
52439
53626
|
impl From<xberg::RerankedDocument> for RerankedDocument {
|
|
52440
53627
|
fn from(val: xberg::RerankedDocument) -> Self {
|
|
52441
53628
|
Self {
|
|
@@ -52611,7 +53798,7 @@ impl From<crawlberg::SitemapUrl> for SitemapUrl {
|
|
|
52611
53798
|
}
|
|
52612
53799
|
}
|
|
52613
53800
|
|
|
52614
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
53801
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
52615
53802
|
impl From<SparseEmbedding> for xberg::SparseEmbedding {
|
|
52616
53803
|
fn from(val: SparseEmbedding) -> Self {
|
|
52617
53804
|
Self {
|
|
@@ -52621,7 +53808,7 @@ impl From<SparseEmbedding> for xberg::SparseEmbedding {
|
|
|
52621
53808
|
}
|
|
52622
53809
|
}
|
|
52623
53810
|
|
|
52624
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
53811
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
52625
53812
|
impl From<xberg::SparseEmbedding> for SparseEmbedding {
|
|
52626
53813
|
fn from(val: xberg::SparseEmbedding) -> Self {
|
|
52627
53814
|
Self {
|
|
@@ -52663,7 +53850,7 @@ impl From<xberg::SparseEmbeddingConfig> for SparseEmbeddingConfig {
|
|
|
52663
53850
|
}
|
|
52664
53851
|
}
|
|
52665
53852
|
|
|
52666
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
53853
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
52667
53854
|
impl From<xberg::SparseEmbeddingPreset> for SparseEmbeddingPreset {
|
|
52668
53855
|
fn from(val: xberg::SparseEmbeddingPreset) -> Self {
|
|
52669
53856
|
Self {
|
|
@@ -53718,6 +54905,26 @@ impl From<xberg::candle_ocr::CandleTrocrVariant> for CandleTrocrVariant {
|
|
|
53718
54905
|
}
|
|
53719
54906
|
}
|
|
53720
54907
|
|
|
54908
|
+
impl From<CaptionAltTextMode> for xberg::CaptionAltTextMode {
|
|
54909
|
+
fn from(val: CaptionAltTextMode) -> Self {
|
|
54910
|
+
match val {
|
|
54911
|
+
CaptionAltTextMode::Preserve => Self::Preserve,
|
|
54912
|
+
CaptionAltTextMode::Combine => Self::Combine,
|
|
54913
|
+
CaptionAltTextMode::Replace => Self::Replace,
|
|
54914
|
+
}
|
|
54915
|
+
}
|
|
54916
|
+
}
|
|
54917
|
+
|
|
54918
|
+
impl From<xberg::CaptionAltTextMode> for CaptionAltTextMode {
|
|
54919
|
+
fn from(val: xberg::CaptionAltTextMode) -> Self {
|
|
54920
|
+
match val {
|
|
54921
|
+
xberg::CaptionAltTextMode::Preserve => Self::Preserve,
|
|
54922
|
+
xberg::CaptionAltTextMode::Combine => Self::Combine,
|
|
54923
|
+
xberg::CaptionAltTextMode::Replace => Self::Replace,
|
|
54924
|
+
}
|
|
54925
|
+
}
|
|
54926
|
+
}
|
|
54927
|
+
|
|
53721
54928
|
impl From<ChunkSizing> for xberg::ChunkSizing {
|
|
53722
54929
|
fn from(val: ChunkSizing) -> Self {
|
|
53723
54930
|
match val {
|
|
@@ -55231,7 +56438,6 @@ impl From<xberg::PSMMode> for PSMMode {
|
|
|
55231
56438
|
}
|
|
55232
56439
|
}
|
|
55233
56440
|
|
|
55234
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
55235
56441
|
impl From<PaddleInferenceBackend> for xberg::PaddleInferenceBackend {
|
|
55236
56442
|
fn from(val: PaddleInferenceBackend) -> Self {
|
|
55237
56443
|
match val {
|
|
@@ -55241,7 +56447,6 @@ impl From<PaddleInferenceBackend> for xberg::PaddleInferenceBackend {
|
|
|
55241
56447
|
}
|
|
55242
56448
|
}
|
|
55243
56449
|
|
|
55244
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
55245
56450
|
impl From<xberg::PaddleInferenceBackend> for PaddleInferenceBackend {
|
|
55246
56451
|
fn from(val: xberg::PaddleInferenceBackend) -> Self {
|
|
55247
56452
|
match val {
|
|
@@ -55251,7 +56456,6 @@ impl From<xberg::PaddleInferenceBackend> for PaddleInferenceBackend {
|
|
|
55251
56456
|
}
|
|
55252
56457
|
}
|
|
55253
56458
|
|
|
55254
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
55255
56459
|
impl From<xberg::PaddleLanguage> for PaddleLanguage {
|
|
55256
56460
|
fn from(val: xberg::PaddleLanguage) -> Self {
|
|
55257
56461
|
match val {
|
|
@@ -55529,6 +56733,26 @@ impl From<xberg::ProcessingStage> for ProcessingStage {
|
|
|
55529
56733
|
}
|
|
55530
56734
|
}
|
|
55531
56735
|
|
|
56736
|
+
impl From<RedactionOffsetEncoding> for xberg::RedactionOffsetEncoding {
|
|
56737
|
+
fn from(val: RedactionOffsetEncoding) -> Self {
|
|
56738
|
+
match val {
|
|
56739
|
+
RedactionOffsetEncoding::Utf8Bytes => Self::Utf8Bytes,
|
|
56740
|
+
RedactionOffsetEncoding::UnicodeCodePoints => Self::UnicodeCodePoints,
|
|
56741
|
+
RedactionOffsetEncoding::Utf16CodeUnits => Self::Utf16CodeUnits,
|
|
56742
|
+
}
|
|
56743
|
+
}
|
|
56744
|
+
}
|
|
56745
|
+
|
|
56746
|
+
impl From<xberg::RedactionOffsetEncoding> for RedactionOffsetEncoding {
|
|
56747
|
+
fn from(val: xberg::RedactionOffsetEncoding) -> Self {
|
|
56748
|
+
match val {
|
|
56749
|
+
xberg::RedactionOffsetEncoding::Utf8Bytes => Self::Utf8Bytes,
|
|
56750
|
+
xberg::RedactionOffsetEncoding::UnicodeCodePoints => Self::UnicodeCodePoints,
|
|
56751
|
+
xberg::RedactionOffsetEncoding::Utf16CodeUnits => Self::Utf16CodeUnits,
|
|
56752
|
+
}
|
|
56753
|
+
}
|
|
56754
|
+
}
|
|
56755
|
+
|
|
55532
56756
|
impl From<RedactionStrategy> for xberg::RedactionStrategy {
|
|
55533
56757
|
fn from(val: RedactionStrategy) -> Self {
|
|
55534
56758
|
match val {
|
|
@@ -56254,6 +57478,10 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56254
57478
|
|
|
56255
57479
|
class.define_method("timeout", method!(BrowserConfig::timeout, 0))?;
|
|
56256
57480
|
|
|
57481
|
+
class.define_method("overall_timeout", method!(BrowserConfig::overall_timeout, 0))?;
|
|
57482
|
+
|
|
57483
|
+
class.define_method("shutdown_timeout", method!(BrowserConfig::shutdown_timeout, 0))?;
|
|
57484
|
+
|
|
56257
57485
|
class.define_method("wait", method!(BrowserConfig::wait, 0))?;
|
|
56258
57486
|
|
|
56259
57487
|
class.define_method("wait_selector", method!(BrowserConfig::wait_selector, 0))?;
|
|
@@ -56299,6 +57527,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56299
57527
|
|
|
56300
57528
|
class.define_method("min_image_area", method!(CaptioningConfig::min_image_area, 0))?;
|
|
56301
57529
|
|
|
57530
|
+
class.define_method("alt_text", method!(CaptioningConfig::alt_text, 0))?;
|
|
57531
|
+
|
|
56302
57532
|
let class = module.define_class("CellChange", ruby.class_object())?;
|
|
56303
57533
|
|
|
56304
57534
|
class.define_singleton_method("new", function!(CellChange::new, -1))?;
|
|
@@ -56321,10 +57551,10 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56321
57551
|
|
|
56322
57552
|
class.define_method("embedding", method!(Chunk::embedding, 0))?;
|
|
56323
57553
|
|
|
56324
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
57554
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
56325
57555
|
class.define_method("sparse_embedding", method!(Chunk::sparse_embedding, 0))?;
|
|
56326
57556
|
|
|
56327
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
57557
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
56328
57558
|
class.define_method("late_interaction", method!(Chunk::late_interaction, 0))?;
|
|
56329
57559
|
|
|
56330
57560
|
class.define_method("metadata", method!(Chunk::metadata, 0))?;
|
|
@@ -56591,6 +57821,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56591
57821
|
method!(ContentConfig::include_document_structure, 0),
|
|
56592
57822
|
)?;
|
|
56593
57823
|
|
|
57824
|
+
class.define_method("extract_metadata", method!(ContentConfig::extract_metadata, 0))?;
|
|
57825
|
+
|
|
56594
57826
|
let class = module.define_class("ContentFilterConfig", ruby.class_object())?;
|
|
56595
57827
|
|
|
56596
57828
|
class.define_singleton_method("new", function!(ContentFilterConfig::new, -1))?;
|
|
@@ -56715,6 +57947,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56715
57947
|
|
|
56716
57948
|
class.define_method("tier_strategy", method!(ConversionOptions::tier_strategy, 0))?;
|
|
56717
57949
|
|
|
57950
|
+
class.define_method("base_url", method!(ConversionOptions::base_url, 0))?;
|
|
57951
|
+
|
|
56718
57952
|
let class = module.define_class("CoreProperties", ruby.class_object())?;
|
|
56719
57953
|
|
|
56720
57954
|
#[cfg(feature = "office")]
|
|
@@ -56799,6 +58033,17 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56799
58033
|
|
|
56800
58034
|
class.define_method("exclude_paths", method!(CrawlConfig::exclude_paths, 0))?;
|
|
56801
58035
|
|
|
58036
|
+
class.define_method(
|
|
58037
|
+
"path_patterns_match_query",
|
|
58038
|
+
method!(CrawlConfig::path_patterns_match_query, 0),
|
|
58039
|
+
)?;
|
|
58040
|
+
|
|
58041
|
+
class.define_method("dedup_include_query", method!(CrawlConfig::dedup_include_query, 0))?;
|
|
58042
|
+
|
|
58043
|
+
class.define_method("strip_tracking_params", method!(CrawlConfig::strip_tracking_params, 0))?;
|
|
58044
|
+
|
|
58045
|
+
class.define_method("tracking_params", method!(CrawlConfig::tracking_params, 0))?;
|
|
58046
|
+
|
|
56802
58047
|
class.define_method("custom_headers", method!(CrawlConfig::custom_headers, 0))?;
|
|
56803
58048
|
|
|
56804
58049
|
class.define_method("request_timeout", method!(CrawlConfig::request_timeout, 0))?;
|
|
@@ -56811,6 +58056,18 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56811
58056
|
|
|
56812
58057
|
class.define_method("retry_codes", method!(CrawlConfig::retry_codes, 0))?;
|
|
56813
58058
|
|
|
58059
|
+
class.define_method(
|
|
58060
|
+
"retry_initial_delay_ms",
|
|
58061
|
+
method!(CrawlConfig::retry_initial_delay_ms, 0),
|
|
58062
|
+
)?;
|
|
58063
|
+
|
|
58064
|
+
class.define_method("retry_max_delay_ms", method!(CrawlConfig::retry_max_delay_ms, 0))?;
|
|
58065
|
+
|
|
58066
|
+
class.define_method(
|
|
58067
|
+
"rate_limit_jitter_ratio",
|
|
58068
|
+
method!(CrawlConfig::rate_limit_jitter_ratio, 0),
|
|
58069
|
+
)?;
|
|
58070
|
+
|
|
56814
58071
|
class.define_method("cookies_enabled", method!(CrawlConfig::cookies_enabled, 0))?;
|
|
56815
58072
|
|
|
56816
58073
|
class.define_method("auth", method!(CrawlConfig::auth, 0))?;
|
|
@@ -57494,6 +58751,20 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
57494
58751
|
|
|
57495
58752
|
class.define_method("revisions", method!(ExcelWorkbook::revisions, 0))?;
|
|
57496
58753
|
|
|
58754
|
+
let class = module.define_class("ExternalRedactionFinding", ruby.class_object())?;
|
|
58755
|
+
|
|
58756
|
+
class.define_singleton_method("new", function!(ExternalRedactionFinding::new, -1))?;
|
|
58757
|
+
|
|
58758
|
+
class.define_method("label", method!(ExternalRedactionFinding::label, 0))?;
|
|
58759
|
+
|
|
58760
|
+
class.define_method("text", method!(ExternalRedactionFinding::text, 0))?;
|
|
58761
|
+
|
|
58762
|
+
class.define_method("start", method!(ExternalRedactionFinding::start, 0))?;
|
|
58763
|
+
|
|
58764
|
+
class.define_method("end", method!(ExternalRedactionFinding::end, 0))?;
|
|
58765
|
+
|
|
58766
|
+
class.define_method("score", method!(ExternalRedactionFinding::score, 0))?;
|
|
58767
|
+
|
|
57497
58768
|
let class = module.define_class("ExtractInput", ruby.class_object())?;
|
|
57498
58769
|
|
|
57499
58770
|
class.define_singleton_method("new", function!(ExtractInput::new, -1))?;
|
|
@@ -58479,6 +59750,11 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
58479
59750
|
|
|
58480
59751
|
class.define_method("invert_colors", method!(ImagePreprocessingConfig::invert_colors, 0))?;
|
|
58481
59752
|
|
|
59753
|
+
class.define_method(
|
|
59754
|
+
"normalize_shaded_rows",
|
|
59755
|
+
method!(ImagePreprocessingConfig::normalize_shaded_rows, 0),
|
|
59756
|
+
)?;
|
|
59757
|
+
|
|
58482
59758
|
let class = module.define_class("ImagePreprocessingMetadata", ruby.class_object())?;
|
|
58483
59759
|
|
|
58484
59760
|
class.define_singleton_method("new", function!(ImagePreprocessingMetadata::new, -1))?;
|
|
@@ -58645,42 +59921,42 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
58645
59921
|
|
|
58646
59922
|
let class = module.define_class("LateInteractionMatch", ruby.class_object())?;
|
|
58647
59923
|
|
|
58648
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59924
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58649
59925
|
class.define_singleton_method("new", function!(LateInteractionMatch::new, -1))?;
|
|
58650
59926
|
|
|
58651
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59927
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58652
59928
|
class.define_method("index", method!(LateInteractionMatch::index, 0))?;
|
|
58653
59929
|
|
|
58654
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59930
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58655
59931
|
class.define_method("score", method!(LateInteractionMatch::score, 0))?;
|
|
58656
59932
|
|
|
58657
59933
|
let class = module.define_class("LateInteractionPreset", ruby.class_object())?;
|
|
58658
59934
|
|
|
58659
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59935
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58660
59936
|
class.define_singleton_method("new", function!(LateInteractionPreset::new, -1))?;
|
|
58661
59937
|
|
|
58662
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59938
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58663
59939
|
class.define_method("name", method!(LateInteractionPreset::name, 0))?;
|
|
58664
59940
|
|
|
58665
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59941
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58666
59942
|
class.define_method("model_repo", method!(LateInteractionPreset::model_repo, 0))?;
|
|
58667
59943
|
|
|
58668
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59944
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58669
59945
|
class.define_method("model_file", method!(LateInteractionPreset::model_file, 0))?;
|
|
58670
59946
|
|
|
58671
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59947
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58672
59948
|
class.define_method("additional_files", method!(LateInteractionPreset::additional_files, 0))?;
|
|
58673
59949
|
|
|
58674
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59950
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58675
59951
|
class.define_method("max_length", method!(LateInteractionPreset::max_length, 0))?;
|
|
58676
59952
|
|
|
58677
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59953
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58678
59954
|
class.define_method("query_max_length", method!(LateInteractionPreset::query_max_length, 0))?;
|
|
58679
59955
|
|
|
58680
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59956
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58681
59957
|
class.define_method("dim", method!(LateInteractionPreset::dim, 0))?;
|
|
58682
59958
|
|
|
58683
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
59959
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58684
59960
|
class.define_method("description", method!(LateInteractionPreset::description, 0))?;
|
|
58685
59961
|
|
|
58686
59962
|
let class = module.define_class("LayoutDetection", ruby.class_object())?;
|
|
@@ -58966,36 +60242,31 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
58966
60242
|
|
|
58967
60243
|
let class = module.define_class("ModelPaths", ruby.class_object())?;
|
|
58968
60244
|
|
|
58969
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
58970
60245
|
class.define_singleton_method("new", function!(ModelPaths::new, -1))?;
|
|
58971
60246
|
|
|
58972
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
58973
60247
|
class.define_method("det_model", method!(ModelPaths::det_model, 0))?;
|
|
58974
60248
|
|
|
58975
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
58976
60249
|
class.define_method("cls_model", method!(ModelPaths::cls_model, 0))?;
|
|
58977
60250
|
|
|
58978
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
58979
60251
|
class.define_method("rec_model", method!(ModelPaths::rec_model, 0))?;
|
|
58980
60252
|
|
|
58981
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
58982
60253
|
class.define_method("dict_file", method!(ModelPaths::dict_file, 0))?;
|
|
58983
60254
|
|
|
58984
60255
|
let class = module.define_class("MultiVectorEmbedding", ruby.class_object())?;
|
|
58985
60256
|
|
|
58986
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60257
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58987
60258
|
class.define_singleton_method("new", function!(MultiVectorEmbedding::new, -1))?;
|
|
58988
60259
|
|
|
58989
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60260
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58990
60261
|
class.define_method("num_tokens", method!(MultiVectorEmbedding::num_tokens, 0))?;
|
|
58991
60262
|
|
|
58992
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60263
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58993
60264
|
class.define_method("dim", method!(MultiVectorEmbedding::dim, 0))?;
|
|
58994
60265
|
|
|
58995
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60266
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58996
60267
|
class.define_method("data", method!(MultiVectorEmbedding::data, 0))?;
|
|
58997
60268
|
|
|
58998
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60269
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
58999
60270
|
class.define_method("is_well_formed", method!(MultiVectorEmbedding::is_well_formed, 0))?;
|
|
59000
60271
|
|
|
59001
60272
|
let class = module.define_class("MultidocInput", ruby.class_object())?;
|
|
@@ -59083,6 +60354,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59083
60354
|
|
|
59084
60355
|
class.define_method("paddle_ocr_config", method!(OcrConfig::paddle_ocr_config, 0))?;
|
|
59085
60356
|
|
|
60357
|
+
class.define_method("paddle_ocr_settings", method!(OcrConfig::paddle_ocr_settings, 0))?;
|
|
60358
|
+
|
|
59086
60359
|
class.define_method("backend_options", method!(OcrConfig::backend_options, 0))?;
|
|
59087
60360
|
|
|
59088
60361
|
class.define_method("element_config", method!(OcrConfig::element_config, 0))?;
|
|
@@ -59107,6 +60380,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59107
60380
|
|
|
59108
60381
|
class.define_method("tessdata_path", method!(OcrConfig::tessdata_path, 0))?;
|
|
59109
60382
|
|
|
60383
|
+
class.define_method("numeric_repair", method!(OcrConfig::numeric_repair, 0))?;
|
|
60384
|
+
|
|
59110
60385
|
let class = module.define_class("OcrElement", ruby.class_object())?;
|
|
59111
60386
|
|
|
59112
60387
|
class.define_singleton_method("new", function!(OcrElement::new, -1))?;
|
|
@@ -59193,6 +60468,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59193
60468
|
|
|
59194
60469
|
class.define_method("paddle_ocr_config", method!(OcrPipelineStage::paddle_ocr_config, 0))?;
|
|
59195
60470
|
|
|
60471
|
+
class.define_method("paddle_ocr_settings", method!(OcrPipelineStage::paddle_ocr_settings, 0))?;
|
|
60472
|
+
|
|
59196
60473
|
class.define_method("vlm_config", method!(OcrPipelineStage::vlm_config, 0))?;
|
|
59197
60474
|
|
|
59198
60475
|
class.define_method("backend_options", method!(OcrPipelineStage::backend_options, 0))?;
|
|
@@ -59378,100 +60655,73 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59378
60655
|
|
|
59379
60656
|
let class = module.define_class("PaddleOcrConfig", ruby.class_object())?;
|
|
59380
60657
|
|
|
59381
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59382
60658
|
class.define_singleton_method("new", function!(PaddleOcrConfig::new, -1))?;
|
|
59383
60659
|
|
|
59384
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59385
60660
|
class.define_method("language", method!(PaddleOcrConfig::language, 0))?;
|
|
59386
60661
|
|
|
59387
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59388
60662
|
class.define_method("cache_dir", method!(PaddleOcrConfig::cache_dir, 0))?;
|
|
59389
60663
|
|
|
59390
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59391
60664
|
class.define_method("use_angle_cls", method!(PaddleOcrConfig::use_angle_cls, 0))?;
|
|
59392
60665
|
|
|
59393
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59394
60666
|
class.define_method(
|
|
59395
60667
|
"enable_table_detection",
|
|
59396
60668
|
method!(PaddleOcrConfig::enable_table_detection, 0),
|
|
59397
60669
|
)?;
|
|
59398
60670
|
|
|
59399
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59400
60671
|
class.define_method("det_db_thresh", method!(PaddleOcrConfig::det_db_thresh, 0))?;
|
|
59401
60672
|
|
|
59402
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59403
60673
|
class.define_method("det_db_box_thresh", method!(PaddleOcrConfig::det_db_box_thresh, 0))?;
|
|
59404
60674
|
|
|
59405
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59406
60675
|
class.define_method("det_db_unclip_ratio", method!(PaddleOcrConfig::det_db_unclip_ratio, 0))?;
|
|
59407
60676
|
|
|
59408
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59409
60677
|
class.define_method("det_limit_side_len", method!(PaddleOcrConfig::det_limit_side_len, 0))?;
|
|
59410
60678
|
|
|
59411
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59412
60679
|
class.define_method("rec_batch_num", method!(PaddleOcrConfig::rec_batch_num, 0))?;
|
|
59413
60680
|
|
|
59414
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59415
60681
|
class.define_method("padding", method!(PaddleOcrConfig::padding, 0))?;
|
|
59416
60682
|
|
|
59417
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59418
60683
|
class.define_method("drop_score", method!(PaddleOcrConfig::drop_score, 0))?;
|
|
59419
60684
|
|
|
59420
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59421
60685
|
class.define_method("model_tier", method!(PaddleOcrConfig::model_tier, 0))?;
|
|
59422
60686
|
|
|
59423
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59424
60687
|
class.define_method("model_version", method!(PaddleOcrConfig::model_version, 0))?;
|
|
59425
60688
|
|
|
59426
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59427
60689
|
class.define_method("inference_backend", method!(PaddleOcrConfig::inference_backend, 0))?;
|
|
59428
60690
|
|
|
59429
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59430
60691
|
class.define_method("with_cache_dir", method!(PaddleOcrConfig::with_cache_dir, 1))?;
|
|
59431
60692
|
|
|
59432
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59433
60693
|
class.define_method(
|
|
59434
60694
|
"with_table_detection",
|
|
59435
60695
|
method!(PaddleOcrConfig::with_table_detection, 1),
|
|
59436
60696
|
)?;
|
|
59437
60697
|
|
|
59438
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59439
60698
|
class.define_method("with_angle_cls", method!(PaddleOcrConfig::with_angle_cls, 1))?;
|
|
59440
60699
|
|
|
59441
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59442
60700
|
class.define_method("with_det_db_thresh", method!(PaddleOcrConfig::with_det_db_thresh, 1))?;
|
|
59443
60701
|
|
|
59444
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59445
60702
|
class.define_method(
|
|
59446
60703
|
"with_det_db_box_thresh",
|
|
59447
60704
|
method!(PaddleOcrConfig::with_det_db_box_thresh, 1),
|
|
59448
60705
|
)?;
|
|
59449
60706
|
|
|
59450
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59451
60707
|
class.define_method(
|
|
59452
60708
|
"with_det_db_unclip_ratio",
|
|
59453
60709
|
method!(PaddleOcrConfig::with_det_db_unclip_ratio, 1),
|
|
59454
60710
|
)?;
|
|
59455
60711
|
|
|
59456
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59457
60712
|
class.define_method(
|
|
59458
60713
|
"with_det_limit_side_len",
|
|
59459
60714
|
method!(PaddleOcrConfig::with_det_limit_side_len, 1),
|
|
59460
60715
|
)?;
|
|
59461
60716
|
|
|
59462
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59463
60717
|
class.define_method("with_rec_batch_num", method!(PaddleOcrConfig::with_rec_batch_num, 1))?;
|
|
59464
60718
|
|
|
59465
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59466
60719
|
class.define_method("with_drop_score", method!(PaddleOcrConfig::with_drop_score, 1))?;
|
|
59467
60720
|
|
|
59468
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59469
60721
|
class.define_method("with_padding", method!(PaddleOcrConfig::with_padding, 1))?;
|
|
59470
60722
|
|
|
59471
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59472
60723
|
class.define_method("with_model_tier", method!(PaddleOcrConfig::with_model_tier, 1))?;
|
|
59473
60724
|
|
|
59474
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59475
60725
|
class.define_method("with_model_version", method!(PaddleOcrConfig::with_model_version, 1))?;
|
|
59476
60726
|
|
|
59477
60727
|
let class = module.define_class("PaddleOcrVlBackendOptions", ruby.class_object())?;
|
|
@@ -60146,6 +61396,17 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
60146
61396
|
|
|
60147
61397
|
class.define_method("custom_patterns", method!(RedactionConfig::custom_patterns, 0))?;
|
|
60148
61398
|
|
|
61399
|
+
class.define_method("findings", method!(RedactionConfig::findings, 0))?;
|
|
61400
|
+
|
|
61401
|
+
class.define_method("min_score", method!(RedactionConfig::min_score, 0))?;
|
|
61402
|
+
|
|
61403
|
+
class.define_method("findings_path", method!(RedactionConfig::findings_path, 0))?;
|
|
61404
|
+
|
|
61405
|
+
class.define_method(
|
|
61406
|
+
"findings_offset_encoding",
|
|
61407
|
+
method!(RedactionConfig::findings_offset_encoding, 0),
|
|
61408
|
+
)?;
|
|
61409
|
+
|
|
60149
61410
|
class.define_method("validate", method!(RedactionConfig::validate, 0))?;
|
|
60150
61411
|
|
|
60151
61412
|
let class = module.define_class("RedactionFinding", ruby.class_object())?;
|
|
@@ -60212,16 +61473,28 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
60212
61473
|
|
|
60213
61474
|
let class = module.define_class("RerankedDocument", ruby.class_object())?;
|
|
60214
61475
|
|
|
60215
|
-
#[cfg(any(
|
|
61476
|
+
#[cfg(any(
|
|
61477
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61478
|
+
not(feature = "reranker-presets")
|
|
61479
|
+
))]
|
|
60216
61480
|
class.define_singleton_method("new", function!(RerankedDocument::new, -1))?;
|
|
60217
61481
|
|
|
60218
|
-
#[cfg(any(
|
|
61482
|
+
#[cfg(any(
|
|
61483
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61484
|
+
not(feature = "reranker-presets")
|
|
61485
|
+
))]
|
|
60219
61486
|
class.define_method("index", method!(RerankedDocument::index, 0))?;
|
|
60220
61487
|
|
|
60221
|
-
#[cfg(any(
|
|
61488
|
+
#[cfg(any(
|
|
61489
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61490
|
+
not(feature = "reranker-presets")
|
|
61491
|
+
))]
|
|
60222
61492
|
class.define_method("score", method!(RerankedDocument::score, 0))?;
|
|
60223
61493
|
|
|
60224
|
-
#[cfg(any(
|
|
61494
|
+
#[cfg(any(
|
|
61495
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61496
|
+
not(feature = "reranker-presets")
|
|
61497
|
+
))]
|
|
60225
61498
|
class.define_method("document", method!(RerankedDocument::document, 0))?;
|
|
60226
61499
|
|
|
60227
61500
|
let class = module.define_class("RerankerConfig", ruby.class_object())?;
|
|
@@ -60378,13 +61651,13 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
60378
61651
|
|
|
60379
61652
|
let class = module.define_class("SparseEmbedding", ruby.class_object())?;
|
|
60380
61653
|
|
|
60381
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61654
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60382
61655
|
class.define_singleton_method("new", function!(SparseEmbedding::new, -1))?;
|
|
60383
61656
|
|
|
60384
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61657
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60385
61658
|
class.define_method("indices", method!(SparseEmbedding::indices, 0))?;
|
|
60386
61659
|
|
|
60387
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61660
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60388
61661
|
class.define_method("values", method!(SparseEmbedding::values, 0))?;
|
|
60389
61662
|
|
|
60390
61663
|
let class = module.define_class("SparseEmbeddingConfig", ruby.class_object())?;
|
|
@@ -60413,25 +61686,25 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
60413
61686
|
|
|
60414
61687
|
let class = module.define_class("SparseEmbeddingPreset", ruby.class_object())?;
|
|
60415
61688
|
|
|
60416
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61689
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60417
61690
|
class.define_singleton_method("new", function!(SparseEmbeddingPreset::new, -1))?;
|
|
60418
61691
|
|
|
60419
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61692
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60420
61693
|
class.define_method("name", method!(SparseEmbeddingPreset::name, 0))?;
|
|
60421
61694
|
|
|
60422
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61695
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60423
61696
|
class.define_method("model_repo", method!(SparseEmbeddingPreset::model_repo, 0))?;
|
|
60424
61697
|
|
|
60425
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61698
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60426
61699
|
class.define_method("model_file", method!(SparseEmbeddingPreset::model_file, 0))?;
|
|
60427
61700
|
|
|
60428
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61701
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60429
61702
|
class.define_method("additional_files", method!(SparseEmbeddingPreset::additional_files, 0))?;
|
|
60430
61703
|
|
|
60431
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61704
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60432
61705
|
class.define_method("max_length", method!(SparseEmbeddingPreset::max_length, 0))?;
|
|
60433
61706
|
|
|
60434
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61707
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60435
61708
|
class.define_method("description", method!(SparseEmbeddingPreset::description, 0))?;
|
|
60436
61709
|
|
|
60437
61710
|
let class = module.define_class("SsrfPolicy", ruby.class_object())?;
|
|
@@ -61034,6 +62307,12 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
61034
62307
|
|
|
61035
62308
|
module.define_module_function("extract_batch", function!(extract_batch_async, -1))?;
|
|
61036
62309
|
|
|
62310
|
+
#[cfg(feature = "redaction")]
|
|
62311
|
+
module.define_module_function(
|
|
62312
|
+
"extract_with_external_redaction",
|
|
62313
|
+
function!(extract_with_external_redaction_async, -1),
|
|
62314
|
+
)?;
|
|
62315
|
+
|
|
61037
62316
|
#[cfg(feature = "markdown-footnotes")]
|
|
61038
62317
|
module.define_module_function("find_unmarked_claims", function!(find_unmarked_claims, 1))?;
|
|
61039
62318
|
|
|
@@ -61046,6 +62325,11 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
61046
62325
|
function!(list_ocr_backend_capabilities, 0),
|
|
61047
62326
|
)?;
|
|
61048
62327
|
|
|
62328
|
+
module.define_module_function(
|
|
62329
|
+
"list_ocr_backend_capabilities_for",
|
|
62330
|
+
function!(list_ocr_backend_capabilities_for, -1),
|
|
62331
|
+
)?;
|
|
62332
|
+
|
|
61049
62333
|
module.define_module_function("list_ocr_backends", function!(list_ocr_backends, 0))?;
|
|
61050
62334
|
|
|
61051
62335
|
module.define_module_function("list_post_processors", function!(list_post_processors, 0))?;
|
|
@@ -61080,6 +62364,17 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
61080
62364
|
function!(ocr_backend_supports_language, 2),
|
|
61081
62365
|
)?;
|
|
61082
62366
|
|
|
62367
|
+
module.define_module_function(
|
|
62368
|
+
"ocr_backend_supports_language_for",
|
|
62369
|
+
function!(ocr_backend_supports_language_for, -1),
|
|
62370
|
+
)?;
|
|
62371
|
+
|
|
62372
|
+
#[cfg(feature = "pdf")]
|
|
62373
|
+
module.define_module_function("pdf_page_count", function!(pdf_page_count, -1))?;
|
|
62374
|
+
|
|
62375
|
+
#[cfg(feature = "redaction")]
|
|
62376
|
+
module.define_module_function("redact_external", function!(redact_external_async, -1))?;
|
|
62377
|
+
|
|
61083
62378
|
#[cfg(feature = "markdown-footnotes")]
|
|
61084
62379
|
module.define_module_function("verify_excerpt", function!(verify_excerpt, 2))?;
|
|
61085
62380
|
|