Commit Graph

177 Commits

Author SHA1 Message Date
Aarne Ranta
79feeaf5b8 new option linerize -tabtreebank for tab-separated treebank generation 2017-12-06 17:37:12 +01:00
Krasimir Angelov
0bb6b5968e temporaryly fix GF.Command.Commands2 2017-10-05 21:09:38 +02:00
Krasimir Angelov
15d014abb8 the parser in the C runtime can now detect incomplete sentences just like the parser in the Haskell runtime. This is also reflected in all bindings. 2017-09-06 12:38:42 +02:00
Krasimir Angelov
c3297dd2e9 update documentation for command pt 2017-09-05 10:33:53 +02:00
Krasimir Angelov
01a8e1b88f GF.Command.TreeOperations is now independent from the runtime's internals 2017-09-05 10:29:02 +02:00
Krasimir Angelov
13d8045814 added exprSize and exprFunctions in the Haskell runtime too and use them in TreeOperations 2017-09-05 10:16:48 +02:00
Krasimir Angelov
da091824a3 pt -paraphrase was never properly implemented and is now removed 2017-09-04 13:11:17 +02:00
Krasimir Angelov
1f908fa7bf eliminate modules PGF.Lexing, PGF.LexingAGreek. Make PGF.Utilities an internal module in the runtime. These are not really part of the core runtime. 2017-09-04 11:43:37 +02:00
Krasimir Angelov
e214a00ed3 added command "rt" in the C shell 2017-09-01 10:40:12 +02:00
Krasimir Angelov
5c38482e56 the C shell now type checks expressions before they are used 2017-09-01 10:19:36 +02:00
Krasimir Angelov
d5a7945ba0 complete details for the "ai" command in the C shell 2017-09-01 09:57:00 +02:00
Krasimir Angelov
5a37660811 added function treeProbability in the Haskell binding 2017-09-01 08:46:52 +02:00
Krasimir Angelov
1182a9b63d giza alignment in the C shell 2017-09-01 08:23:12 +02:00
Krasimir Angelov
b9c04fd612 graphvizWordAlignment in the C runtime 2017-08-31 13:03:11 +02:00
Krasimir Angelov
eaf9f0c3ac the C runtime now supports the same customizations for GraphViz as the Haskell runtime 2017-08-31 10:58:49 +02:00
Krasimir Angelov
675ef4573c remove move dead code in the C shell 2017-08-31 08:12:18 +02:00
Krasimir Angelov
16828fb91e some dead code elimination 2017-08-30 20:42:04 +02:00
Krasimir Angelov
070d00a20c an almost complete ai command in the C shell 2017-08-30 19:44:10 +02:00
Krasimir Angelov
13a854d349 implement rf in the C shell 2017-08-30 19:19:10 +02:00
Krasimir Angelov
34294bf36e pg in the C shell now supports most output formats 2017-08-30 19:04:29 +02:00
Krasimir Angelov
fd56b4b5f3 remove some dead code in the C shell 2017-08-30 16:56:00 +02:00
Krasimir Angelov
ccf9227c05 in the C shell rename the ga command to gt to be consistent with the standard shell 2017-08-30 16:40:25 +02:00
Krasimir Angelov
137a06586a "lc" was a temporary hack and is now removed from the C shell 2017-08-30 16:36:57 +02:00
Krasimir Angelov
7db9f51d78 "ma" command in the C shell 2017-08-30 16:35:57 +02:00
Krasimir Angelov
4a24bc98f2 the l command in the C shell now supports the same options as in the normal shell 2017-08-30 16:18:26 +02:00
aarne
ee2f3d085e vd command now reads local concrete configurations to deal with syncat words; TODO: dissolve clustered multiwords bound with + 2017-04-06 11:55:21 +00:00
hallgren
ae512e09e0 Fix compilation errors caused by changes in PGF2
These prevented GF from being built with C run-time support (-fc-runtime).
2017-02-21 13:21:59 +00:00
krasimir
db0f8b0dce improve the documentation for PGF2 2017-01-25 20:30:54 +00:00
hallgren
096b4cfcee PGF service & minibar: only show dependency diagrams if the labels are known
+ The PGF service now reads and caches dependency label configuration files.
+ The grammar info returned by command=grammar has a new boolean field 
  'hasDependencyLabels' to indicate if dependency labels were found for
  the grammar. Also, command=deptree will now fail if no labels are present.
+ The minibar only shows word dependency trees if labels are present.
+ Also changed the type of getDepLabels from [String] -> Labels to
  String -> Labels, since all uses were in the form "getDepLabels . lines".
2016-06-09 13:12:14 +00:00
hallgren
649ab21cec Changes for compatibility with GHC 8.0.1 2016-05-22 20:15:31 +00:00
hallgren
31df4a6c46 GF.Command.Commands2: adapt gf -cshell to the changes in the previous patch 2016-04-07 14:55:13 +00:00
hallgren
ab3cc77656 GF shell: fix a parsing problem with the cc command
This patch fixes a problem introduced last year when the GF shell was
refactored to allow more commands to be treated uniformly and be part
of pipes. The cc command was one of those commands, but unfortunately this
introduced a parsing problem, e.g.

	> cc "last"
	constant not found: last

	> cc "last"++"year"
	command not parsed: cc "last"++"year"

This happened because the generic command line parser in
GF.Command.{Abstract,Parse} assumes that all commands have an argument of
type PGF.Expr. Commands that expect other types of arguments have to
use PGF.showExpr combined with other conversion to the argument type they
expect. The cc command excpets a GF.Grammar.Term, and unfortunately not 
all terms survice the roundtrip through PGF.Expr, in part because of
an additional hack to allow strings to be roundtripped through PGF.Expr
without adding superfluous double quotes.

To solve the problem, this patch

 + makes room for arguments of type Term in the Argument type in
   GF.Command.Abstract.
   
 + makes a special case for the cc command in GF.Command.Parse, by
   calling the partial parser 'runPartial pTerm' recently added in
   GF.Grammar.Lexer and GF.Grammar.Parser. Care was taken so that
   that "|" and ";" can be used both inside terms and as separators between
   commands in the shell, e.g. things like the following now work:

       > cc ("a"|"b") | ps -lexcode
       variants { "a" ; "b" }

 + introduces a type CommandArgument that replaces [Expr] as the
   type of values passed between commands in pipes. It has room for
   values of type [Expr], [String] and Term, thus eliminating the need
   to roundtrip through the Expr type all the time.
   The hack to avoid adding superfluous quotes when strings are
   roundtripped through Expr has been left in place for now,
   but can probably be removed.
2016-04-07 13:40:05 +00:00
krasimir
a393c1a246 fix the handling of separators in BNFC which are not nonempty 2016-03-22 13:13:35 +00:00
krasimir
ce70720859 CFGtoPGF is now extended to support context-free grammars with primitive parameters 2016-03-22 10:28:15 +00:00
krasimir
c8ebe09315 initial support for BNFC syntax in context-free grammars for GF. Not all features are supported yet. Based on contribution from Gleb Lobanov 2016-03-21 13:27:44 +00:00
leiss
df2901c9c0 add lexer and unlexer for Ancient Greek accent normalization 2016-02-23 16:30:39 +00:00
hallgren
f2b057c078 GF shell, cc command: try to compute pre{...} tokens in token sequences
This is implemented as a simple post-processing step after partial evaluation
to try compute pre{...} tokens in token sequences. Nothing is done to deal
with intervening free variants.

This was done in response to a query from René T on the gf-dev mailing list.
2015-12-02 16:41:18 +00:00
aarne
0a38e137b6 vd -conll2latex now converts conll to latex. Without going through GF trees, but as a service to the dependency parser community. 2015-11-23 10:43:03 +00:00
aarne
d6a505169a added -output=latex to visialize_dependencies. This generates more familiar-looking output than the default graphviz, which can moreover be pasted into LaTeX documents. Some more work is needed to make long sentences look nice and fit on a page; a constant word length is now used to simplify computing the coordinates. 2015-11-17 09:11:10 +00:00
aarne
ce6557f1f2 the visualization commands (aw,vd,vp,vt) can now show multiple trees. Previously they only showed one tree even if there were for instance after ambiguous parsing. The reason was that dot (graphviz) ignored all graphs but the first one. Now the graphs are put into separate files. The 'convert' command from ImageMagick package is used to combine them to one pdf. If this is a problem, the old behaviour can be restored by the -number=1 option to the tree-generating command, which cuts away all trees but the one and doesn't require ImageMagick. 2015-11-05 16:47:41 +00:00
aarne
eb49b6ab56 improved documentation of vp -showdep 2015-11-05 08:23:33 +00:00
aarne
0786dc6f42 dependency labels in parse trees now with the -deps flag, -file=labels_file for configuration. With -nocat option this shows reasonable dep trees, more familiar looking than the vd command. With -showfun flag, the tree gives a rather complete picture of the analysis of the sentence. 2015-11-04 20:36:47 +00:00
aarne
e39787ab88 prepared visualize_parse for showing dependency labels 2015-11-04 17:28:09 +00:00
hallgren
35be182824 Preliminary new shell feature: cc -trace.
You can now do things like 

	cc -trace mkV "debug"

to see a trace of all opers with their arguments and results during the
computation of mkV "debug".
2015-09-28 22:23:56 +00:00
hallgren
32f18b515e GF shell: write_file now writes one tree per line
This compensates for other changes that removed line breaks.
Maybe it should have a -lines options like ps and rf?
2015-09-03 20:42:38 +00:00
hallgren
5bfaf10de5 Comment out some dead code found with -fwarn-unused-binds
Also fixed some warnings and tightened some imports
2015-08-28 13:59:43 +00:00
hallgren
128236eab9 GF shell: change parse & linearize to obtain useful results from p|l and l|p in more cases
These changes are inspired by the gf -cshell implementation of these commands.

The output of the linearize command has been changed to remove superfluous
blank lines and commas, and deliver the result as a list of strings instead of
a single multi-line string. This makes it possible to use -all and pipe the
results to the parse command. This also means that with -treebank -all,
the language tag will be repeated for each result from the same language.

The parse command, when trying to parse with more than one language, would
"forget" other results after a failed parse, and thus not send all
successful parses through the pipe. For example, if English is not the first
language in the grammar,

    p "hello" | l

would output nothing, instead of translations of "hello" to all languages,
forcing the user to write

   p -lang=Eng "hello" | l

instead, to get the expected result. The cause of this behaviour was in the
function fromParse, which was rather messy, so I assume it is not intentional,
but the result of a programming mistake at some point.

The fromParse function has now been refactored from a big recursive function
into 

    fromParse opts = foldr (joinPiped . fromParse1 opts) void

where the helper functions fromParse1 deals with a single parse result and
joinPiped combines multiple parse results.
2015-08-26 13:56:23 +00:00
hallgren
c25705519a GF shell bug fix: visualize_parse didn't accept the -lang flag
Even though the -lang flag was handled in the implementation, it was not
documented, and GF.Command.Interpreter rejects undocumented flags:

	option not interpreted: lang

This must be a fairly old bug, so it suggests that the vp command isn't used
much...
2015-08-21 12:20:40 +00:00
hallgren
e178615338 GF -cshell: implement visualize_parse
Supported options and flags: -lang -format -view
None of the rendering options available in the Haskell run-time are supported.
2015-08-21 12:14:47 +00:00
hallgren
026d6a73ad gf -cshell: implement visualize_tree
But the following options are not supported: -mk -nocats -nofuns
2015-08-21 10:14:46 +00:00