parsekit-bin 0.1.2-arm64-darwin-23 → 0.2.0-arm64-darwin-23
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/parsekit/Cargo.toml +5 -5
- data/ext/parsekit/src/parser.rs +7 -9
- data/lib/parsekit/parsekit.bundle +0 -0
- data/lib/parsekit/version.rb +1 -1
- data/lib/parsekit.rb +8 -2
- metadata +10 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3829c5724ef17010e882645be9d1a3e41e3759505b19822da82298a207586501
|
|
4
|
+
data.tar.gz: 80c44bfdddb47f3420005c1a2d77da7d6239a920e2bbed1d4c66b6418033e81b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87a3fb103a507c0306a0224f3e45fcf44e229af1b662890e72b46035f9d527aba0587b8c6bac209cdadfc9f2708db1753f2f2ea8d9fdc5e3f9eedc461136445b
|
|
7
|
+
data.tar.gz: 6c49bafb9e66c30ae2ce5107df9cd0ea4c9c6658d5c73518171057712d631d8fcc903a6075258820220df5a91c24d85eb53b04df37769ff1438c55f4e4d6bfa7
|
data/ext/parsekit/Cargo.toml
CHANGED
|
@@ -14,14 +14,14 @@ name = "parsekit"
|
|
|
14
14
|
magnus = { version = "0.8", features = ["rb-sys"] }
|
|
15
15
|
# Document parsing - testing embedded C libraries
|
|
16
16
|
# MuPDF builds from source and statically links
|
|
17
|
-
mupdf = { version = "0.
|
|
17
|
+
mupdf = { version = "0.8", default-features = false, features = [] }
|
|
18
18
|
# OCR - Using tesseract-rs for both system and bundled modes
|
|
19
|
-
tesseract-rs = "0.
|
|
19
|
+
tesseract-rs = "0.4" # Tesseract with optional bundling
|
|
20
20
|
image = "0.25" # Image processing library (match rusty-tesseract's version)
|
|
21
|
-
calamine = "0.
|
|
21
|
+
calamine = "0.36" # Excel parsing
|
|
22
22
|
docx-rs = "0.4" # Word document parsing
|
|
23
|
-
quick-xml = "0.
|
|
24
|
-
zip = "
|
|
23
|
+
quick-xml = "0.42" # XML parsing
|
|
24
|
+
zip = "8.2" # ZIP archive handling for PPTX
|
|
25
25
|
serde_json = "1.0" # JSON parsing
|
|
26
26
|
regex = "1.10" # Text parsing
|
|
27
27
|
encoding_rs = "0.8" # Encoding detection
|
data/ext/parsekit/src/parser.rs
CHANGED
|
@@ -242,7 +242,7 @@ impl Parser {
|
|
|
242
242
|
// Continue on page errors rather than failing entirely
|
|
243
243
|
if let Ok(page) = doc.load_page(page_num) {
|
|
244
244
|
// Extract text from the page
|
|
245
|
-
if let Ok(text) = page.to_text() {
|
|
245
|
+
if let Ok(text) = page.to_text_page(mupdf::TextPageFlags::empty()).and_then(|tp| tp.to_text()) {
|
|
246
246
|
all_text.push_str(&text);
|
|
247
247
|
all_text.push('\n');
|
|
248
248
|
}
|
|
@@ -390,25 +390,23 @@ impl Parser {
|
|
|
390
390
|
// Look for text elements (a:t or t)
|
|
391
391
|
let name = e.name();
|
|
392
392
|
let local_name_bytes = name.local_name();
|
|
393
|
-
let local_name =
|
|
393
|
+
let local_name: &str = local_name_bytes.as_ref();
|
|
394
394
|
if local_name == "t" {
|
|
395
395
|
in_text_element = true;
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
Ok(Event::Text(e)) => {
|
|
399
399
|
if in_text_element {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
text_parts.push(text_str.to_string());
|
|
404
|
-
}
|
|
400
|
+
let text_str = e.trim();
|
|
401
|
+
if !text_str.is_empty() {
|
|
402
|
+
text_parts.push(text_str.to_string());
|
|
405
403
|
}
|
|
406
404
|
}
|
|
407
405
|
}
|
|
408
406
|
Ok(Event::End(ref e)) => {
|
|
409
407
|
let name = e.name();
|
|
410
408
|
let local_name_bytes = name.local_name();
|
|
411
|
-
let local_name =
|
|
409
|
+
let local_name: &str = local_name_bytes.as_ref();
|
|
412
410
|
if local_name == "t" {
|
|
413
411
|
in_text_element = false;
|
|
414
412
|
}
|
|
@@ -475,7 +473,7 @@ impl Parser {
|
|
|
475
473
|
loop {
|
|
476
474
|
match reader.read_event_into(&mut buf) {
|
|
477
475
|
Ok(Event::Text(e)) => {
|
|
478
|
-
txt.push_str(
|
|
476
|
+
txt.push_str(e.as_ref());
|
|
479
477
|
txt.push(' ');
|
|
480
478
|
}
|
|
481
479
|
Ok(Event::Eof) => break,
|
|
Binary file
|
data/lib/parsekit/version.rb
CHANGED
data/lib/parsekit.rb
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "parsekit/version"
|
|
4
4
|
|
|
5
|
-
# Load the
|
|
5
|
+
# Load the compiled Rust extension. Precompiled (platform) gems install it into a
|
|
6
|
+
# Ruby-ABI-versioned subdir (lib/parsekit/<major.minor>/parsekit.{so,bundle}) so a
|
|
7
|
+
# single fat gem can carry a binary per Ruby version; source/dev builds place it flat
|
|
8
|
+
# at lib/parsekit/parsekit.{so,bundle}. Try the versioned path first, fall back to the
|
|
9
|
+
# flat one. Resolution goes through $LOAD_PATH (`require`, never `require_relative`)
|
|
10
|
+
# because RubyGems installs native extensions outside the gem's lib/ dir.
|
|
6
11
|
begin
|
|
7
|
-
|
|
12
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
|
13
|
+
require "parsekit/#{Regexp.last_match(1)}/parsekit"
|
|
8
14
|
rescue LoadError
|
|
9
15
|
require "parsekit/parsekit"
|
|
10
16
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: parsekit-bin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: arm64-darwin-23
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Petersen
|
|
@@ -16,6 +16,9 @@ dependencies:
|
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
18
|
version: '0.9'
|
|
19
|
+
- - ">="
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.9.129
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -23,6 +26,9 @@ dependencies:
|
|
|
23
26
|
- - "~>"
|
|
24
27
|
- !ruby/object:Gem::Version
|
|
25
28
|
version: '0.9'
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 0.9.129
|
|
26
32
|
- !ruby/object:Gem::Dependency
|
|
27
33
|
name: rake
|
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,17 +123,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
117
123
|
requirements:
|
|
118
124
|
- - ">="
|
|
119
125
|
- !ruby/object:Gem::Version
|
|
120
|
-
version: '
|
|
126
|
+
version: '4.0'
|
|
121
127
|
- - "<"
|
|
122
128
|
- !ruby/object:Gem::Version
|
|
123
|
-
version:
|
|
129
|
+
version: 4.1.dev
|
|
124
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
131
|
requirements:
|
|
126
132
|
- - ">="
|
|
127
133
|
- !ruby/object:Gem::Version
|
|
128
134
|
version: '0'
|
|
129
135
|
requirements: []
|
|
130
|
-
rubygems_version:
|
|
136
|
+
rubygems_version: 4.0.20
|
|
131
137
|
specification_version: 4
|
|
132
138
|
summary: Ruby document parsing toolkit with PDF and OCR support
|
|
133
139
|
test_files: []
|