mods_postprocessor submodule
This module is used to fix bugs in XSLT template.
Sometimes in some cases, there are missing tags, or the data are with special
characters, which are not required (Ostrava] for example - we need only
Ostrava).
-
ltp.mods_postprocessor._remove_hairs(inp, hairs='/:;, - []<>()')[source]
Remove “special” characters from beginning and the end of the inp. For
example ,a-sd,-/ -> a-sd.
Parameters: | inp (str) – Input string. |
Returns: | Cleaned string. |
Return type: | str |
-
ltp.mods_postprocessor.insert_tag(tag, before, root)[source]
Insert tag before before tag if present. If not, insert it into root.
Parameters: |
- tag (obj) – HTMLElement instance.
- before (obj) – HTMLElement instance.
- root (obj) – HTMLElement instance.
|
-
ltp.mods_postprocessor.transform_content(tags, content_transformer)[source]
Transform content in all tags using result of content_transformer(tag)
call.
Parameters: |
- tags (obj/list) – HTMLElement instance, or list of HTMLElement
instances.
- content_transformer (function) – Function which is called as
content_transformer(tag).
|
-
ltp.mods_postprocessor.postprocess_mods_volume(mods, uuid)[source]
Fix bugs in mods produced by XSLT template.
Parameters: |
- mods (str) – XML string generated by XSLT template.
- uuid (str) – UUID of the package.
|
Returns: | Updated XML.
|
Return type: | str
|