bpodgursky / nlpviz

Source code for a sentence parse tree visualization found here: http://nlpviz.bpodgursky.com/
Other
137 stars 45 forks source link

move renderText() and populate() to a new Javascript file (nlpviz.js) #8

Open ekoontz opened 9 years ago

ekoontz commented 9 years ago

for ease of reuse in other contexts

ekoontz commented 9 years ago

Also use input.keyup() so that parsing is incremental: parser called upon every keystroke rather than just when the return key is hit. I can move this into a separate commit/PR if you prefer.

bpodgursky commented 9 years ago

hmmm I'm a bit concerned about keyup. responses for new text aren't super fast (~1s to parse reasonably complex strings -- the default is only really fast because of an nginx cache) so I'm worried (1) about murdering my server and (2) getting out-of-order ajax responses. I like the idea of incremental updates but I'm not sure the best way to do it efficiently.

for the other refactoring, not sure what you're envisioning for other contexts, but if you wanted it to be fully reusable it might be better to pass in references to to specific elements like #svg-canvas. maybe it would make sense for the success callback to be the method which gets pulled into a separate class? that way it's not so dependent on the specific data source (the ajax call)