find all pairs of adjacent subtrees (rooted in specific nonterminal) of a parse tree

已查看 26 次
跳至第一个未读帖子

Tatiana Gaponova

未读,
2015年4月24日 14:30:402015/4/24
收件人 nltk-...@googlegroups.com

How can I efficiently list all pairs of subtrees (rooted in specific nonterminal) of a parse tree? For example, I have the following tree:

(S (S (S (S (X (PRO pro))) (X (V v))) (X (ADJ adj))) (X (N n)))

You can see the image on this link.

I want to list all adjacent instances of the symbol X expanding to other symbols, i. e.:

  1. (X (PRO pro)) and (X (V v))
  2. (X (V v)) and (X (ADJ adj))
  3. (X (ADJ adj)) and (X (N n))

Raúl Speroni

未读,
2015年5月4日 17:02:142015/5/4
收件人 nltk-...@googlegroups.com
Hi, could yo solve this? im facing a similar problem. 

thanks!

Steven Bird

未读,
2015年5月13日 06:57:262015/5/13
收件人 nltk-...@googlegroups.com

I recommend using the new tgrep module recently added to NLTK (install the latest version from GitHub), and once you've identified the nodes of interest, generate all pairs of subtrees using nested iteration.


--
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.
For more options, visit https://groups.google.com/d/optout.
回复全部
回复作者
转发
0 个新帖子