forked from GitHub/gf-core
added preliminary API for custom literals from Java. Not functional yet
This commit is contained in:
@@ -38,6 +38,8 @@ public class Concr {
|
||||
|
||||
public native void unload();
|
||||
|
||||
public native void addLiteral(String cat, LiteralCallback callback);
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// private stuff
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.grammaticalframework.pgf;
|
||||
|
||||
public class ExprBuilder {
|
||||
public ExprBuilder() {
|
||||
|
||||
}
|
||||
|
||||
ExprBuilder(long poolRef) {
|
||||
}
|
||||
|
||||
public native Expr mkApp(String fun, Expr... args);
|
||||
|
||||
public native Expr mkLiteral(String s);
|
||||
public native Expr mkLiteral(int n);
|
||||
public native Expr mkLiteral(double d);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.grammaticalframework.pgf;
|
||||
|
||||
public interface LiteralCallback {
|
||||
public int match(Concr concr, int lin_idx, ExprBuilder builder, String sentence, int start_offset);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.grammaticalframework.pgf;
|
||||
|
||||
public class NercLiteralCallback implements LiteralCallback {
|
||||
public int match(Concr concr, int lin_idx, ExprBuilder builder, String sentence, int start_offset) {
|
||||
return start_offset;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user