3

I am trying to run the Charniak parser provided in stanford-corenlp-1.3.5.jar. The package for the record is edu.stanford.nlp.parser.charniak and the class CharniakParser.

So I will give a code example of how I am trying to use it just for completeness:

CharniakParser cp = new CharniakParser();
PTBTokenizer<HasWord> ptbt = new PTBTokenizer(new FileReader("sample1.txt"), new WordTokenFactory(), "");
List<Word> tokens = new ArrayList<Word>();
for (Word token; ptbt.hasNext(); ) {
    token = (Word) ptbt.next();
    tokens.add(token);
}
Tree t = cp.getBarseParse(tokens);

On the last line there when running this code , I get

cannot run program "/u/nlp/packages/bllip-parser/reranking-parser.sh" ... The system cannot find the specified file

The problem is the human cannot find the specified file either. I do not see that included in the distribution and I cannot find a dependency that I might need to download with that name. A Google search reveals that the only place a 'reranking-parser.sh' exists is in the actual source code for Stanford's version of Charniak parser (I am trying hard to be clear because I know Stanford did not originally create the Charniak parser, it is from Brown).

So, does anyone have experience with this parser? What is missing? I like my chances better on SO, so I ask here.

demongolem
  • 9,474
  • 36
  • 90
  • 105
  • Mind creating a short tag wiki for [tag:charniak-parser]? It's a good tag, just not very self-descriptive. –  Apr 17 '13 at 15:31
  • @Telthien Yes, actually it slipped my mind ... thanks I will do it – demongolem Apr 17 '13 at 15:32
  • 1
    I imagine the mailing lists shown at the bottom of this page will help you more. http://nlp.stanford.edu/software/corenlp.shtml – Daniel Moses Apr 17 '13 at 16:15

2 Answers2

2

Ok, ok, @DMoses et al. I subscribed to the mailing list and I got my answer as to what needs to be done. So let me pass it along as answer for future visitors since it is not documented (until now):

The file reranking-parser.sh belongs to a particular version of the Charniak parser. So you need to get that version of the parser which is on github and called "bllip-parser". There is no official support in CoreNLP for the Charniak parser, nor is the functionality provided meant to be standalone, rather it is a student extension meant to work with the external parser from github.

A fairly simple procedure really to point to the C++ executable, but this does not work for me because at this point I would be using Python to call Java to call C++.

demongolem
  • 9,474
  • 36
  • 90
  • 105
0

Unfortunately, the CoreNLP's code for CharniakParser.java has a hardcoded path in it. To use the parser, you'd probably need to edit the source to point it to parse-50best.sh in the Charniak parser distribution (which would need to be downloaded separately from Stanford CoreNLP -- see the BLLIP Parser GitHub project in the second link).

dmcc
  • 2,519
  • 28
  • 30