7

A number of questions are of the type: 'Can you diagram this sentence?', or 'How do you parse this sentence?'.

On the same order of the Google ngram tool, are there any diagramming or parsing tools?

Actually I don't expect anything like a 'diagramming' tool because I frankly think of that as 1950's technology, when junior high enlgish teachers should be teaching parse trees with S, NP, P, etc. (but is that now behind the times too?).

So are there any quick online tools to throw a sentence at and get a parse tree (in a copyable image?) or at least parts of speech tagging?

1
  • 2
    Here's one, Mitch. link.cs.cmu.edu/link/submit-sentence-4.html If you lose the link, just type 'parse a sentence' into a google and it's the first one up. Let us know how it works for you, what the problems are that you see. There's quite a bit of background info that describes the process.
    – user7501
    Commented Apr 26, 2011 at 5:00

2 Answers 2

7

There seem to be two parts to this request. One is to do the graphical work of displaying a parse tree (with nodes and lines) given a parsing. The other is to do the linguistic work of determining the parts/derivation of a sentence using some grammar. Another is to allow you to -define- a grammar, and then allow you to parse a sentence using the grammar you created (also called a compiler-compiler).

What I've found so far:

  • phpSyntaxTree: this draws a syntax tree, if you give it a parsing. (in fact this is really a drawer of any kind of rooted labeled tree, but it is advertised and probably directed towards parsing). So you, the user, have to determine the parsing that you want with the labels, and lay it out with the labels you see fit. But you can save the image easily and then upload easily in stackexchange.

  • Link Grammar Parser: this takes a sentence and returns -many- attempts at assigning a parse tree (they call it a constituent tree). The form of the tree is -almost- close enough for the above phpSyntaxTree (replace '(' with '[' etc), but even among the many attempts, it was hard to pick one that seemed to capture things just right. But that could be used as a semi-official start and then edited as you please. The grammar itself, a link grammar, seems to be out of the TCS/AI field rather than linguistics, and 'links' seem to have some special meaning which I don't understand.

  • ANTLR and JavaCC: I put these together because they act in the same way (even though some details are different). These are compiler -compilers, meaning you write a grammar (in variations/extensions of Backus-Naur form (BNF) which allow something beyond context-free grammar). There are three difficulties here:

    • you have to write your language grammar yourself (I couldn't find any natural language parsers for either of these that were already written)
    • BNF is not particularly well suited to natural language because of the non-context-free-ness of most natural language (just consider any kind of inflectional agreement). natural language is pretty ... fluid and sentences can have multiple interpretations even without considering word ambiguity. and these compiler-compilers were designed for computer programming languages where the whole point is to remove any ambiguity.
    • because the intention of these compiler-compilers is to produce output for computers, some extra work may be needed to get a parse tree output in readable text form.

Please add any more examples you might find (e.g. a English grammar in ANTLR or JavaCC)

3

On StackOverflow the same question has been asked here, or also a similar one here.

6
  • 4
    I'll write it here, because it's more of a comment of mine rather than a part of the answer: I'm honestly skeptical towards tools like this, as much as I am towards tools that translate sentences (less, especially with everyday used sentences, but idioms are an example of how translators are not reliable) or long texts (much more). They will never be 100% effective, I think.
    – Alenanno
    Commented Apr 21, 2011 at 15:37
  • I share your skepticism, but sometimes for NNSs (ESLers? people who don't speak English natively?), a picture can help make sense of non-idiomatic phrases. One can always comment on a diagram to say that it is problematic.
    – Mitch
    Commented Apr 21, 2011 at 15:44
  • I got your point. But as you also "said", there is a human intervention. By the way, if you try those tools I linked, share with everyone if they worked, problems you've encountered, etc. For example, parse a simple sentence by yourself (NB that you know is correctly parsed), try it out there and see if it corresponds. :D
    – Alenanno
    Commented Apr 21, 2011 at 15:53
  • those are all excellent parsing ideas...but for programming languages (ANTLR, goldparser). One could presumably write an ANTLR format (or javacc or even yacc/bison) parser for english, but that's a lot of work (maybe there's one that has been written already?). I have found an online app that allows you to layout yourself a parse tree (with the labels that you decide) which is a good step. I'd also be looking for something that takes a sentence and returns the parsing structure for an English sentence (which none of those examples do).
    – Mitch
    Commented Apr 21, 2011 at 16:19
  • @Mitch: Write your last sentence in your comment in your question, if it's an actual request related to your question. The parse tree you found that can be labelled by the user is a very nice solution, maybe the best one so you can avoid "scanning" or taking pics of your own parse tree on your notebook lol :D
    – Alenanno
    Commented Apr 21, 2011 at 16:21
  • I'm not so sceptical: such programs are like dictionaries, which may give 4 or 5 meanings and 2 or 3 functions for a word: They are a reasonable place to start.
    – Greybeard
    Commented Mar 12, 2020 at 10:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .