2012-09-22 10 views

Antwort

4

Covert die Ausgabe in json und übergeben es an einigen js Graph-Bibliothek wie d3, raphael usw.

Demo & Reference

Zum Beispiel Parse Baum für

„Ich werde tun ein Seminar über NLP auf der SXSW in Austin. "

würde

sein
(ROOT 
    (S 
    (NP (PRP I)) 
    (VP (VBP am) 
     (VP (VBG going) 
     (S 
      (VP (TO to) 
      (VP (VB do) 
       (NP 
       (NP (DT a) (NN seminar)) 
       (PP (IN on) 
        (NP (NNP NLP)))) 
       (PP (IN at) 
       (NP (NNP SXSW))) 
       (PP (IN in) 
       (NP (NNP Austin)))))))) 
    (. .))) 

zu

[{ 
    "data": { 
     "type": "ROOT" 
    }, 
    "children": [{ 
     "data": { 
      "type": "S" 
     }, 
     "children": [{ 
      "data": { 
       "type": "NP" 
      }, 
      "children": [{ 
       "data": { 
        "type": "PRP" 
       }, 
       "children": [{ 
        "data": { 
         "ne": "O", 
         "word": "I", 
         "type": "TK", 
         "pos": "PRP" 
        }, 
        "children": [] 
       }] 
      }] 
     }, { 
      "data": { 
       "type": "VP" 
      }, 
      "children": [{ 
       "data": { 
        "type": "VBP" 
       }, 
       "children": [{ 
        "data": { 
         "ne": "O", 
         "word": "am", 
         "type": "TK", 
         "pos": "VBP" 
        }, 
        "children": [] 
       }] 
      }, { 
       "data": { 
        "type": "VP" 
       }, 
       "children": [{ 
        "data": { 
         "type": "VBG" 
        }, 
        "children": [{ 
         "data": { 
          "ne": "O", 
          "word": "going", 
          "type": "TK", 
          "pos": "VBG" 
         }, 
         "children": [] 
        }] 
       }, { 
        "data": { 
         "type": "S" 
        }, 
        "children": [{ 
         "data": { 
          "type": "VP" 
         }, 
         "children": [{ 
          "data": { 
           "type": "TO" 
          }, 
          "children": [{ 
           "data": { 
            "ne": "O", 
            "word": "to", 
            "type": "TK", 
            "pos": "TO" 
           }, 
           "children": [] 
          }] 
         }, { 
          "data": { 
           "type": "VP" 
          }, 
          "children": [{ 
           "data": { 
            "type": "VB" 
           }, 
           "children": [{ 
            "data": { 
             "ne": "O", 
             "word": "do", 
             "type": "TK", 
             "pos": "VB" 
            }, 
            "children": [] 
           }] 
          }, { 
           "data": { 
            "type": "NP" 
           }, 
           "children": [{ 
            "data": { 
             "type": "NP" 
            }, 
            "children": [{ 
             "data": { 
              "type": "DT" 
             }, 
             "children": [{ 
              "data": { 
               "ne": "O", 
               "word": "a", 
               "type": "TK", 
               "pos": "DT" 
              }, 
              "children": [] 
             }] 
            }, { 
             "data": { 
              "type": "NN" 
             }, 
             "children": [{ 
              "data": { 
               "ne": "O", 
               "word": "seminar", 
               "type": "TK", 
               "pos": "NN" 
              }, 
              "children": [] 
             }] 
            }] 
           }, { 
            "data": { 
             "type": "PP" 
            }, 
            "children": [{ 
             "data": { 
              "type": "IN" 
             }, 
             "children": [{ 
              "data": { 
               "ne": "O", 
               "word": "on", 
               "type": "TK", 
               "pos": "IN" 
              }, 
              "children": [] 
             }] 
            }, { 
             "data": { 
              "type": "NP" 
             }, 
             "children": [{ 
              "data": { 
               "type": "NN" 
              }, 
              "children": [{ 
               "data": { 
                "ne": "ORGANIZATION", 
                "word": "NLP", 
                "type": "TK", 
                "pos": "NN" 
               }, 
               "children": [] 
              }] 
             }] 
            }] 
           }] 
          }, { 
           "data": { 
            "type": "PP" 
           }, 
           "children": [{ 
            "data": { 
             "type": "IN" 
            }, 
            "children": [{ 
             "data": { 
              "ne": "O", 
              "word": "at", 
              "type": "TK", 
              "pos": "IN" 
             }, 
             "children": [] 
            }] 
           }, { 
            "data": { 
             "type": "NP" 
            }, 
            "children": [{ 
             "data": { 
              "type": "NNP" 
             }, 
             "children": [{ 
              "data": { 
               "ne": "ORGANIZATION", 
               "word": "SXSW", 
               "type": "TK", 
               "pos": "NNP" 
              }, 
              "children": [] 
             }] 
            }] 
           }] 
          }, { 
           "data": { 
            "type": "PP" 
           }, 
           "children": [{ 
            "data": { 
             "type": "IN" 
            }, 
            "children": [{ 
             "data": { 
              "ne": "O", 
              "word": "in", 
              "type": "TK", 
              "pos": "IN" 
             }, 
             "children": [] 
            }] 
           }, { 
            "data": { 
             "type": "NP" 
            }, 
            "children": [{ 
             "data": { 
              "type": "NNP" 
             }, 
             "children": [{ 
              "data": { 
               "ne": "LOCATION", 
               "word": "Austin", 
               "type": "TK", 
               "pos": "NNP" 
              }, 
              "children": [] 
             }] 
            }] 
           }] 
          }] 
         }] 
        }] 
       }] 
      }] 
     }, { 
      "data": { 
       "type": "." 
      }, 
      "children": [{ 
       "data": { 
        "ne": "O", 
        "word": ".", 
        "type": "TK", 
        "pos": "." 
       }, 
       "children": [] 
      }] 
     }] 
    }] 
}] 

und can be drawn using d3 umgewandelt werden kann.

2

sollten Sie in der Lage sein, dass sie für die Ex-Aufmachungen haben, an den Demos Raphaël JS

Schauen Sie mit tun: die, die mit Kurven etc .. Dass Sie in die richtige Richtung zeigen sollte.

HINWEIS: Das oben genannte würde immer noch erfordern, dass Sie es in JS codieren, aber JS sehr direkt abholen. Sie können wahrscheinlich direkt mit Raphael beginnen und die Teile aufheben, wie Sie gehen.

Viel Glück.

Verwandte Themen