Extracting typehierarchy with lgbtypes

Hi all,

I am trying to extract the expanded hierarchy with the lgbtypes but I haven’t had much luck. I tried reading through the source files but they are a bit obscure. The output format could be a tdl, or hash table or whatever. My guess is this should be possible, given that the functions to parse and process the hierarchy are there…

Thanks a lot!

There is a function lkb:output-types that may do what you want.

I have a patched version here that outputs them as xml:

I would like the opposite, output types without the glbs, if anyone
knows how to do that :-).

This works, thanks! Btw, is there any way to run this as a script without having to click through the lkb interface?

Glad to help!

take a look at: https://github.com/fcbond/ltdb/blob/master/make-ltdb.bash

Perfect, thank you!

I think this should be fairly easily doable with PyDelphin’s tdl module, since it does not compute glb types. You would use tdl.iterparse() to enumerate the objects in some top-level TDL file, then look for TypeDefinition events and extract the object’s identifier and supertypes in order to build the hierarchy, and look for FileInclude events to parse an included TDL file.

Apologies for the late reply. The function that best matches your description is lkb::types-to-xml. It outputs only type names, including GLB types. E.g. (lkb::types-to-xml :file "myfile.txt")

<type name="*top*">
    <type name="u"/>
    <type name="tree_node_label"/>
    <type name="tokens"/>
    <type name="token_trait"/>
    <type name="tnt_main"/>
    <type name="tnt"/>
    <type name="scratch"/>
    <type name="scp_pr"/>
    <type name="n"/>
    <type name="mrs_transfer_rule"/>
    <type name="hook_min"/>
    <type name="flags"/>
    <type name="chart_mapping_rule"/>
    <type name="*sort*"/>
    <type name="*avm*"/>
<type name="sign_min">
    <type name="*avm*"/>
    <type name="word_or_lexrule_min"/>
    <type name="sign"/>

You could run this in a script, immediately after loading your grammar with read-script-file-aux.