Commit Graph

703 Commits

Author SHA1 Message Date
hallgren
1cfdffd5e9 Fix warnings in 16 modules, mostly forward compatibility warnings from GHC 7.8 2014-08-13 22:16:18 +00:00
kr.angelov
912225a5dd pattern matching in def rules is now supported 2014-08-11 15:53:41 +00:00
kr.angelov
03b067782c 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.
2014-08-11 10:59:10 +00:00
john.j.camilleri
d59749c914 PGF Web Service: include entire completion in full mode
When using full=yes in the web service 'complete' command,
you now get an additional field 'seq' with the longest possible completion.
So, given:

  lin
    f1 = ss "the" ;
    f2 = ss ("the red house" | "the real deal") ;

and trying to complete on input "th", you get:

    [
        {
            "from": "TestCnc",
            "brackets": {
                "cat": "_",
                "fid": 0,
                "index": 0,
                "fun": "_",
                "children": []
            },
            "text": "th",
            "completions": [
                {
                    "token": "the",
                    "funs": [
                        {
                            "fun": "f1",
                            "hyps": [],
                            "cat": "C",
                            "seq": "the"
                        },
                        {
                            "fun": "f2",
                            "hyps": [],
                            "cat": "C",
                            "seq": "the red house"
                        },
                        {
                            "fun": "f2",
                            "hyps": [],
                            "cat": "C",
                            "seq": "the real deal"
                        }
                    ]
                }
            ]
        }
    ]
2014-07-15 09:33:22 +00:00
john
747287055f PGF web service: Return additional completion info with 'full' flag
BETA! The 'complete' command now has a new flag 'full' which when set
returns additional info about completions.

Without 'full' flag (default):

[
    {
        "from": "PhrasebookEng",
        "brackets": {
            "cat": "_",
            "fid": 0,
            "index": 0,
            "fun": "_",
            "children": [
                {
                    "token": "the"
                }
            ]
        },
        "text": "su",
        "completions": [
            "supermarket",
            "suspect"
        ]
    }
]

With full=true or full=yes:

[
    {
        "from": "PhrasebookEng",
        "brackets": {
            "cat": "_",
            "fid": 0,
            "index": 0,
            "fun": "_",
            "children": [
                {
                    "token": "the"
                }
            ]
        },
        "text": "su",
        "completions": [
            {
                "token": "supermarket",
                "funs": [
                    {
                        "fid": 421,
                        "fun": "Supermarket",
                        "hyps": [],
                        "cat": "PlaceKind"
                    }
                ]
            },
            {
                "token": "suspect",
                "funs": [
                    {
                        "fid": 445,
                        "fun": "Suspect",
                        "hyps": [],
                        "cat": "Property"
                    }
                ]
            }
        ]
    }
]
2014-07-11 09:25:26 +00:00
kr.angelov
0138869499 implemented computing with abstract syntax trees. It passes all test cases except those that require def rules. The design is consistent with the STG virtual machine 2014-07-08 19:45:49 +00:00
kr.angelov
b3397f8071 bugfix for the typechecker in the C runtime 2014-07-08 19:19:48 +00:00
kr.angelov
153479e991 an API for visitor patterns on abstract syntax trees from Python. This makes the embedded grammars especially pleasing 2014-07-06 23:48:51 +00:00
kr.angelov
a794ec5c42 small fix for the embedded mode in Python 2014-07-06 19:55:08 +00:00
kr.angelov
7afbff6fa8 embedded mode for GF grammar in Python. Only generation for now 2014-07-06 19:49:17 +00:00
kr.angelov
42dea944d9 added bracketedLinearize in the Java binding 2014-07-02 07:08:01 +00:00
kr.angelov
410b7c78ce fixed rare memory leak in the Java bindings 2014-07-02 07:06:51 +00:00
kr.angelov
b9ffc8ac00 a few changes in the Nerc that I have forgoten to push 2014-07-01 17:32:25 +00:00
kr.angelov
3843f5505e fix warnings in the compilation of the Java binding 2014-07-01 17:31:29 +00:00
hallgren
158519624e runtime/c/setup.sh: use make -j to speed up compilation
The configuration script takes significantly longer to run than the compilation
of all the C code, which is a hint that is in need of a major simplification.
2014-06-19 09:26:44 +00:00
hallgren
7b1ad9de51 build-binary-dist.sh: updated to include the Python binding to the C run-time
There are also some changes in src/runtime/python/setyp.py to support this.
2014-06-18 16:09:46 +00:00
kr.angelov
7d713d1687 now the named entities recognizer returns dictionary entries if the name is known 2014-06-17 06:57:12 +00:00
hallgren
bbeca32a43 src/runtime/c/setup.sh: executable version of INSTALL, used from debian/rules 2014-06-16 23:28:12 +00:00
kr.angelov
21e855c91d fixed memory leak in the Haskell binding to the C runtime 2014-06-16 08:49:13 +00:00
hallgren
f739841497 PGF library: expose only PGF and PGF.Internal instead of all modules
PGF exports the public, stable API.
PGF.Internal exports additional things needed in the GF compiler & shell,
including the nonstardard version of Data.Binary.
2014-06-12 14:43:18 +00:00
hallgren
bc0249b501 PGF2.hsc: use throwIO instead of throw
From the documentation: the throwIO variant should be used in preference to
throw to raise an exception within the IO monad because it guarantees ordering
with respect to other IO operations, whereas throw does not.

Also removed some unused imports.
2014-06-10 12:42:01 +00:00
kr.angelov
78d8524138 bugfix in the Java binding. it was causing a crash in the Android app 2014-05-23 10:52:00 +00:00
kr.angelov
2c04554be5 small fix in tabularLinearize 2014-05-22 13:33:18 +00:00
kr.angelov
c2aad9e313 added tabularLinearize in the python binding 2014-05-22 13:30:14 +00:00
hallgren
33af15e803 Haskell binding: free memory pool to avoid space leak when readPGF fails 2014-05-13 14:07:36 +00:00
kr.angelov
802a106b3e fix the literals API in Java for strings with non-latin characters 2014-05-08 14:56:46 +00:00
kr.angelov
c2ae35cfb2 fix memory leak in the Haskell binding 2014-05-08 08:41:58 +00:00
hallgren
b3d92a1378 pgf-shell.hs: fix compilation problem with GHC 7.4 2014-05-07 17:06:34 +00:00
hallgren
7c88b7935f Two improvements in the pgf-shell example
1. Like pgf-translate, it now shows one result at a time, press Enter to get
   more results.
2. You can load a new grammar with the command 'i <path-to-pgf>'
2014-05-07 16:37:28 +00:00
kr.angelov
b21f2c04e1 an initial Java/C API for predicting literals. Still not utilized 2014-04-25 08:53:18 +00:00
kr.angelov
68c8d3cba8 bugfix in the handling of BIND in the C runtime 2014-04-22 13:53:18 +00:00
kr.angelov
d8e5206e7f now word completion from Java works. It could be made better 2014-04-17 11:00:27 +00:00
kr.angelov
c2d79790a3 forgoten Completer.java 2014-04-11 07:52:10 +00:00
kr.angelov
a28d0d246f expose Java API for word completion 2014-04-11 07:50:22 +00:00
kr.angelov
ea40bc151b change the JVM version to 1.6 in JNI_OnLoad 2014-04-11 07:15:27 +00:00
kr.angelov
77c545fa4f bugfix in the Java binding 2014-04-10 16:43:40 +00:00
kr.angelov
a9ebeaea44 now fully functional Java API for custom literals 2014-04-10 14:14:31 +00:00
kr.angelov
3a0aa8b997 bugfix in the C runtime 2014-04-10 07:42:49 +00:00
kr.angelov
66d60ce9d1 a quick hack to enable the NERC from bindings. This should be made available from the API but for now I just hacked the C runtime 2014-04-10 07:27:07 +00:00
hallgren
f2cc1d2c68 Change the type of PGF.Lexing.bindTok to [String] -> [String]
The old type was [String] -> String. This function was only used
in GF.Text.Lexing.stringOp, which now uses (unwords . bindTok) instead,
with no change in behaviour.
2014-04-09 17:39:21 +00:00
hallgren
0d1ad2f0e5 Unlexers: move capitalization of first word from GF.Text.Lexing to PGF.Lexing
The capitalization of the first word was done in GF.Text.Lexing.stringOp,
but is now done in the functions unlexText and unlexMixed in PGF.Lexing.
These functions are only used in stringOp and in PGFService (where the change
is needed), so the subtle change in behaviour should not cause any bugs.
2014-04-09 17:26:23 +00:00
hallgren
1602eab5b6 PGF Service: a bit more clever lexer=text
Only change the first word to lowercase if the original input is not found in
the grammar's morphology. This allows parsing of sentenses starting with "I" in 
English, nouns in German and proper names in other languages, but it can make
the wrong choice for multi-words.
2014-04-09 14:13:18 +00:00
hallgren
cf34ee8890 Move basic lexing functions from GF.Text.Lexing to the new module PGF.Lexing
They are thus part of the PGF Run-Time Library, making it possible to add
lexing functionality in PGF service in a natural way.
2014-04-08 14:07:49 +00:00
kr.angelov
be62b047f4 added preliminary API for custom literals from Java. Not functional yet 2014-04-08 13:54:49 +00:00
kr.angelov
52377b46cf bugfix in the C runtime that shows up with only some grammars 2014-04-08 12:41:41 +00:00
kr.angelov
baef6eee90 Expr and ExprProb are now serializable objects 2014-04-07 12:52:51 +00:00
kr.angelov
268e7a697f fix the haskell binding to handle parse errors 2014-04-04 11:46:40 +00:00
kr.angelov
d110df7a1f initial binding to Prolog for the C runtime 2014-04-02 10:03:19 +00:00
kr.angelov
709f5dfcd8 small fixes in the C runtime 2014-03-25 13:57:57 +00:00
kr.angelov
b33c163068 added hasLinearization method in the Python binding 2014-03-20 14:48:47 +00:00