You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using HierarchicalChunker + contextualize() to split document into parts to use for embeddings. The problem is some chunks are too granular. Sometimes it's a single number or word.
I've noticed these granular items are often inside groups so I want to try using whole group instead. Document's body.children contains top level objects without duplicates so I've tried iterating it and serializing these objects without traversing entire tree.
Serializer doesn't have an overridable method like serialize_group so I assume that is not the way to go.
This snippet seems to work correctly, joining all group items into a single SerializationResult but now section headers are separate. I think contextualize method on chunker adds them.
My questions are:
Can groups be nested?
How do I capture headings, captions etc similar to contextualize? Do I need to manually count groups/text nodes and try to match them or does docling have utilities for this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm using
HierarchicalChunker
+contextualize()
to split document into parts to use for embeddings. The problem is some chunks are too granular. Sometimes it's a single number or word.I've noticed these granular items are often inside groups so I want to try using whole group instead. Document's
body.children
contains top level objects without duplicates so I've tried iterating it and serializing these objects without traversing entire tree.Serializer doesn't have an overridable method like
serialize_group
so I assume that is not the way to go.This is the code i've got:
This snippet seems to work correctly, joining all group items into a single
SerializationResult
but now section headers are separate. I thinkcontextualize
method on chunker adds them.My questions are:
contextualize
? Do I need to manually count groups/text nodes and try to match them or does docling have utilities for this?Beta Was this translation helpful? Give feedback.
All reactions