-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Structure information #26
Comments
We're currently completely ignoring the |
@labusch told me there's interest in per-page information ("This is a title page" or whatever types exist). IMHO This should not go into the mods_info, but a separate file/table - and I would consider this after reviewing first (I am simply not familiar enough with |
AFAICT, what we would need is this: for a given list of PPNs, we want the information which specific image files per PPN correspond to each (if any) of the Strukturdaten listed here (scroll down to "Strukturtypen - vollständige Liste"): https://digital.staatsbibliothek-berlin.de/features-und-hilfe/suchen-und-stoebern. |
Yeah that's per-page information :) Need to look at it for specifics. I somewhat think it might still be an idea to read the METS but now that I understand the use case I might be able to come up with something that is easier to digest than 1. to deal with all that XML and 2. understand METS structure. Just because of the grammar reversing it, what you want is this:
That should be possible, as far as I can see now. There will be some difficulties (omnibus volumes (Sammelbände) etc.), but it could work. |
Exactly. The use case is to automatically ingest the structural tags for e.g. title pages as tags into the image search db, so that users can easily select all images from all PPNs that are title pages and annotate the according regions on those images. |
That's the other way around ;) But I think I understand now and will implement it. |
The details are a bit tricky, but this seems a good way to do it: Per PPN and page (as in structMap TYPE=PHYSICAL → TYPE=page):
This way there's an immediate link between a file name and a logical type. (Hardcoding a fileGrp or guessing e.g. filename from the ID in
|
I've been held up by the joy of Sammelbände... Implementing it as above also is a bit trickier than I thought (e.g. need to read the fileGrp to know to which a file FILEID belongs and associating structMap PHYSICAL vs structMap LOGICAL is full of ID pointers, too), but I started it. |
Alright, this looks like it's going somewhere:
This dict is going to be a line in a DataFrame and gives both the filenames (as they are in METS) and the associated TYPEs in the
The way our METS is set up, you get these TYPEs explicitly, but I also made it transitive, e.g. if an With this info you can get the structMap TYPEs for a given page and also have it backwards, i.e. get pages with illustrations on it. |
(Currently working in branch |
Implementation is too slow: For sbb-mets-PPN821507109.xml (~1300 pages), it takes 80s to process... For now, I'll ignore this and improve later. It's probably all the XPath in here.
|
Structure types were given transitively in my test files, e.g. a page that had type I had code that would sanitize this, i.e. walk up the tree and add the types. Coincidentally this was buggy and failed for some hundred documents - so I noticed the - possible - inconsistency.
|
Feature is now merged into master; may need more work on performance (VERY slow interpretation of the structure information, slow as in "takes 2 weeks to export") See above. |
Saving per-page information (like this structure information) is now optional ( |
I already fixed this months ago and forgot about it; mods4pandas is now 2 orders of magnitudes faster. |
This is done; Nesting is not done directly, but by having multiple structure types at once. |
@labusch had questions regarding structure information (from METS metadata) and @joergleh already had suggestions regarding missing information (#23, #24).
While there is certainly information that I find out of scope for this tool (like the location of a title page → should use the original METS for this) there is certainly information we should include (like the count/presence of a title page).
(Edit: Moved the missing field documentation to #27.)
structMap[@TYPE="LOGICAL"]
: should count the divs, grouped by their type. They are nested, so this needs to be accounted for.structMap[@TYPE="PHYSICAL"]
: Count?tests/data
to read them more easilyThe text was updated successfully, but these errors were encountered: