diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-08-11 10:59:10 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-08-11 10:59:10 +0000 |
| commit | 584d589041f63fdd3ea777019679275657902c2d (patch) | |
| tree | 6150ef1da26bc76e0c3e14954e080f9a801b45f4 /src/runtime/java/Test.java | |
| parent | 02dda1e66f80047f0a8718557a8bf7cc84c16625 (diff) | |
a partial support for def rules in the C runtime
The def rules are now compiled to byte code by the compiler and then to
native code by the JIT compiler in the runtime. Not all constructions
are implemented yet. The partial implementation is now in the repository
but it is not activated by default since this requires changes in the
PGF format. I will enable it only after it is complete.
Diffstat (limited to 'src/runtime/java/Test.java')
| -rw-r--r-- | src/runtime/java/Test.java | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/runtime/java/Test.java b/src/runtime/java/Test.java index 7ac11d8a3..08d6445cb 100644 --- a/src/runtime/java/Test.java +++ b/src/runtime/java/Test.java @@ -3,10 +3,10 @@ import java.util.*; import org.grammaticalframework.pgf.*; public class Test { - public static void main(String[] args) { + public static void main(String[] args) throws IOException { PGF gr = null; try { - gr = PGF.readPGF("Phrasebook.pgf"); + gr = PGF.readPGF("/home/krasimir/www.grammaticalframework.org/examples/phrasebook/Phrasebook.pgf"); } catch (FileNotFoundException e) { e.printStackTrace(); return; @@ -14,28 +14,19 @@ public class Test { e.printStackTrace(); return; } - + + Type typ = gr.getFunctionType("Bulgarian"); + System.out.println(typ.getCategory()); System.out.println(gr.getAbstractName()); for (Map.Entry<String,Concr> entry : gr.getLanguages().entrySet()) { System.out.println(entry.getKey()+" "+entry.getValue()+" "+entry.getValue().getName()); entry.getValue().addLiteral("PN", new NercLiteralCallback(gr,entry.getValue())); } - - int count = 10; - for (ExprProb ep : gr.generateAll("Phrase")) { - System.out.println(ep.getExpr()); - - if (count-- <= 0) - break; - } - - Concr eng = gr.getLanguages().get("PhrasebookEng"); - Concr ger = gr.getLanguages().get("PhrasebookGer"); + Concr eng = gr.getLanguages().get("SimpleEng"); try { - for (ExprProb ep : eng.parse(gr.getStartCat(), "where is the hotel")) { + for (ExprProb ep : eng.parse(gr.getStartCat(), "persons who work with Malmö")) { System.out.println("["+ep.getProb()+"] "+ep.getExpr()); - System.out.println(ger.linearize(ep.getExpr())); } } catch (ParseError e) { System.out.println("Parsing failed at token \""+e.getToken()+"\""); |
