FBCFG for Georgian

84 views
Skip to first unread message

oleg kapanadze

unread,
Jun 13, 2022, 3:19:14 PM6/13/22
to nltk-users
Hi,

Can smb. advice how is possible to print a more "readable" version of a tree for the   parse output of Georgian:
(S[]
  (NP[SF='SUB', case='N']
    (AJP[SF='MD', case='N']
      (AJP1[SF='MD', case='N'] (Adj1[SF='MD', case='N'] ყველა))
      (Adj[SF='MD', case='N'] მამაცი))
    (N[SF='SUB', case='N'] მეომარი))
  (VP[SF='HEAD', TENSE='pres', val='ND']
    (ADP1[POS='ADV1', SF='MD']
      (Adv1[SF='MD'] ყოველთვის)
      (ADP2[POS='ADV2', SF='MD']
        (Adv2[SF='MD'] ძალიან)
        (Adv3[SF='MD'] თავგანწირვით)))
    (TV[SF='HEAD', TENSE='pres', val='ND'] იცავს))
  (NP[SF='DO', case='D']
    (AJP[SF='MD', case='St']
      (AJP1[SF='MD', case='St'] (Adj1[SF='MD', case='St'] ყველა))
      (Adj[SF='MD', case='St'] სუსტ))
    (N[SF='DO', case='D'] ადამიანს)))
>>> tree.draw
<bound method Tree.draw of Tree(S[], [Tree(NP[SF='SUB', case='N'], [Tree(AJP[SF='MD', case='N'], [Tree(AJP1[SF='MD', case='N'], [Tree(Adj1[SF='MD', case='N'], ['ყველა'])]), Tree(Adj[SF='MD', case='N'], ['მამაცი'])]), Tree(N[SF='SUB', case='N'], ['მეომარი'])]), Tree(VP[SF='HEAD', TENSE='pres', val='ND'], [Tree(ADP1[POS='ADV1', SF='MD'], [Tree(Adv1[SF='MD'], ['ყოველთვის']), Tree(ADP2[POS='ADV2', SF='MD'], [Tree(Adv2[SF='MD'], ['ძალიან']), Tree(Adv3[SF='MD'], ['თავგანწირვით'])])]), Tree(TV[SF='HEAD', TENSE='pres', val='ND'], ['იცავს'])]), Tree(NP[SF='DO', case='D'], [Tree(AJP[SF='MD', case='St'], [Tree(AJP1[SF='MD', case='St'], [Tree(Adj1[SF='MD', case='St'], ['ყველა'])]), Tree(Adj[SF='MD', case='St'], ['სუსტ'])]), Tree(N[SF='DO', case='D'], ['ადამიანს'])])])>

Thanks in advance for your help.

Oleg


Alexis

unread,
Aug 12, 2022, 10:07:56 AM8/12/22
to nltk-...@googlegroups.com
Hi Oleg,

A bit late, so I hope you have found the answer already; but here it is just in case (and perhaps for future readers):

First, you will get a somewhat more formatted version of the tree if you use 

print(tree) 

instead of just writing `tree` at the Python command prompt. Second, the reason the draw() method you tried did not work was because you forgot the parentheses which indicate you want to call the function. If you write this, after a couple of seconds a new window will appear with a drawing of the tree. (If you don't see the new window, look for it under other windows on your screen.) Before you make a screen grab of this window, note that clicking on a non-terminal node will roll it up, so that its contents will appear all together under a triangle symbol. This might come in handy to simplify non-relevant parts of a large tree.

(Please ignore the nonsense leaves in the image, I used Tree.fromstring() on your example and something did not round trip correctly.) 

Hope this helps,

Alexis


Dr. Alexis Dimitriadis | Assistant Professor and Senior Research Fellow | Utrecht Institute of Linguistics OTS | Utrecht University | Trans 10, 3512 JK Utrecht, room 2.33 | +31 30 253 65 68 | a.dimi...@uu.nl | www.hum.uu.nl/medewerkers/a.dimitriadis

--
You received this message because you are subscribed to the Google Groups "nltk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nltk-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/nltk-users/81e89d0e-59cc-464e-9509-444bec01682en%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages