This commit is contained in:
15
docs/snippets/ruby/config/document_structure_config.md
Normal file
15
docs/snippets/ruby/config/document_structure_config.md
Normal file
@@ -0,0 +1,15 @@
|
||||
```ruby title="Document Structure Config (Ruby)"
|
||||
require 'kreuzberg'
|
||||
|
||||
config = Kreuzberg::ExtractionConfig.new(include_document_structure: true)
|
||||
|
||||
result = Kreuzberg.extract_file_sync('document.pdf', config: config)
|
||||
|
||||
if result.document
|
||||
result.document['nodes'].each do |node|
|
||||
node_type = node['content']['node_type']
|
||||
text = node['content']['text'] || ''
|
||||
puts "[#{node_type}] #{text[0...80]}"
|
||||
end
|
||||
end
|
||||
```
|
||||
Reference in New Issue
Block a user