2012-09-22 15 views
5

Aşağıda bağımlılık ayrıştırma ağacının bir örneği verilmiştir.Web sayfasındaki bağımlılık ağaç görüntülemesini özme

Ben html web sayfasında resimlemek istiyorum

Dependency Parsing Tree

, herhangi biri bana bazı örnekler veya yön gösterebilir? C/C++, Python'u tanıyorum ama html/javascript ile aşina değilim.

Çok teşekkürler! vs eğrileri olanlar .. Bu doğru yönde bir işaret olmalıdır:

cevap

4

Covert çıkışı ve ayrıştırma ağaca

vb Örneğin için

Demo & Reference

d3 gibi bazı js grafik kütüphanesi raphael geçmek "Ben yapacağım Austin'deki SXSW'de NLP hakkında bir seminer. "

(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)))))))) 
    (. .))) 

[{ 
    "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": [] 
      }] 
     }] 
    }] 
}] 

ve can be drawn using d3 dönüştürülebilir olacaktır.

2

Sen ex onlar kadar koyduk gösterilerde Raphaël JS

Bak kullanarak bunu mümkün olmalıdır.

NOT: Yukarıdaki kodlar hala JS'de kodlanmasını gerektirir, ancak JS'yi çok ileriye doğru toplar. Muhtemelen Raphael ile dosdoğru başlayabilir ve giderken parçaları toplayabilirsiniz.

İyi şanslar. json içine

İlgili konular