Working with syntax trees

dokondr dokondr at gmail.com
Fri Oct 28 15:36:04 BST 2011


Please advise on Haskell libraries and data types to do the following work:
I need to compare both structure and node contents of two graphs, find
similar sub-graphs, and need some metric to measure distance between two
graphs. These graphs are produced by POS (part of speech) sentence tagging.
POS tagging is done by Standford statistical parser:
http://nlp.stanford.edu/software/lex-parser.shtml

For example in the graph G1:

(ROOT
  (S
    (NP (DT The) (NN voice) (NN quality))
    (VP (VBD was)
      (ADJP (JJ clear) (RB too)))
    (. .)))

G1 has an NP node (lets call this sub-graph SG1)  which has three child leaf
nodes: (DT The) (NN voice) (NN quality), where
DT, NN - nodes names, and
"The", "voice", "quality" - corresponding leaf values of these nodes.

I need to compare this graph with graph G2:

(ROOT
  (S
    (SBAR (IN Although)
      (S
        (NP (DT the) (NN battery) (NN life))
        (VP (VBD was) (RB not)
          (ADJP (JJ long)))))
    (, ,)
    (NP (DT that))
    (VP (VBZ is)
      (VP (VBN ok)
        (PP (IN for)
          (NP (PRP me)))))
    (. .)))

G2 also has the NP node (let's call it sub-graph SG2)  which also has three
child leaf nodes: (DT the) (NN battery) (NN life))
I need to find that G1 and G2 has sub-graphs SG1 and SG2 with the similar
structure, but with different values of the leaf nodes.
I also need to devise some general metric that will allow me to estimate
distance between any two graphs. This distance should account both for
structural and leaf-node values similarity.

It would be easier to measure distance between vectors then graphs. So I am
thinking how to convert directed graph (that results from POS tagging) into
vector. Any ideas, links here?

Thanks!

-- 
All the best,
Dmitri O. Kondratiev

"This is what keeps me going: discovery"
dokondr at gmail.com
http://sites.google.com/site/dokondr/welcome
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/nlp/attachments/20111028/56638a71/attachment.htm>


More information about the NLP mailing list