forked from GitHub/gf-core
a bit more on the Java to C binding. Now it is possible to load a grammar and query for the list of languages
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
import org.grammaticalframework.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import org.grammaticalframework.pgf.*;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
PGF gr = PGF.readPGF("/home/krasimir/www.grammaticalframework.org/treebanks/PennTreebank/ParseEngAbs.pgf");
|
||||
gr.close();
|
||||
PGF gr = null;
|
||||
try {
|
||||
gr = PGF.readPGF("/home/krasimir/www.grammaticalframework.org/treebanks/PennTreebank/ParseEngAbs.pgf");
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} catch (PGFError e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(gr.getAbstractName());
|
||||
for (Map.Entry<String,Concr> entry : gr.getLanguages().entrySet()) {
|
||||
System.out.println(entry.getKey()+" "+entry.getValue()+" "+entry.getValue().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user