Commit 7c8787af132faa88e7cccf8245e517426c2f4dd9
Merge remote-tracking branch 'origin/integration' into disambiguation
Showing
8 changed files
with
224 additions
and
13 deletions
LCGparser/ENIAM_LCG_XMLof.ml
0 → 100644
1 | +(* | ||
2 | + * ENIAM_LCGparser, a parser for Logical Categorial Grammar formalism | ||
3 | + * Copyright (C) 2016-2017 Wojciech Jaworski <wjaworski atSPAMfree mimuw dot edu dot pl> | ||
4 | + * Copyright (C) 2016-2017 Institute of Computer Science Polish Academy of Sciences | ||
5 | + * | ||
6 | + * This library is free software: you can redistribute it and/or modify | ||
7 | + * it under the terms of the GNU Lesser General Public License as published by | ||
8 | + * the Free Software Foundation, either version 3 of the License, or | ||
9 | + * (at your option) any later version. | ||
10 | + * | ||
11 | + * This library is distributed in the hope that it will be useful, | ||
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + * GNU Lesser General Public License for more details. | ||
15 | + * | ||
16 | + * You should have received a copy of the GNU Lesser General Public License | ||
17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | + *) | ||
19 | + | ||
20 | +open ENIAM_LCGtypes | ||
21 | + | ||
22 | +let rec linear_term = function | ||
23 | + Var v -> Xml.Element("Var",[],[Xml.PCData v]) | ||
24 | + | Tuple l -> Xml.Element("Tuple",[],Xlist.map l linear_term) | ||
25 | + | Variant(e,l) -> | ||
26 | + Xml.Element("Variant",["label",e],Xlist.map l (fun (i,t) -> | ||
27 | + Xml.Element("option",["number",i],[linear_term t]))) | ||
28 | + | VariantVar(v,t) -> Xml.Element("VariantVar",["var",v],[linear_term t]) | ||
29 | + | ProjVar(v,t) -> Xml.Element("ProjVar",["var",v],[linear_term t]) | ||
30 | + | SubstVar v -> Xml.Element("SubstVar",[],[Xml.PCData v]) | ||
31 | + | Subst(s,v,t) -> Xml.Element("Subst",["var",v],[linear_term s;linear_term t]) | ||
32 | + | Inj(n,t) -> Xml.Element("Inj",["option",string_of_int n],[linear_term t]) | ||
33 | + | Case(t,l) -> | ||
34 | + Xml.Element("Case",[], | ||
35 | + Xml.Element("matched",[],[linear_term t]) :: | ||
36 | + Xlist.map l (fun (v,t) -> Xml.Element("option",["var",v],[linear_term t]))) | ||
37 | + | Lambda(v,t) -> Xml.Element("Lambda",["var",v],[linear_term t]) | ||
38 | + | LambdaSet(l,t) -> Xml.Element("LambdaSet",[],Xlist.map l (fun v -> Xml.Element("var",[],[Xml.PCData v])) @ [linear_term t]) | ||
39 | + | LambdaRot(n,t) -> Xml.Element("LambdaRot",["number",string_of_int n],[linear_term t]) | ||
40 | + | App(s,t) -> Xml.Element("App",[],[linear_term s;linear_term t]) | ||
41 | + | Dot -> Xml.Element("Dot",[],[]) | ||
42 | + | Val s -> Xml.Element("Val",[],[Xml.PCData s]) | ||
43 | + | SetAttr(e,s,t) -> Xml.Element("SetAttr",["label",v],[linear_term s;linear_term t]) | ||
44 | + | Fix(s,t) -> Xml.Element("Fix",[],[linear_term s;linear_term t]) | ||
45 | + | Empty t -> Xml.Element("Empty",[],[linear_term t]) | ||
46 | + | Apply t -> Xml.Element("Apply",[],[linear_term t]) | ||
47 | + | Insert(s,t) -> Xml.Element("Insert",[],[linear_term s;linear_term t]) | ||
48 | + | Node t -> | ||
49 | + Xml.Element("Node",["orth",t.orth;"lemma",t.lemma;"pos",t.pos; | ||
50 | + "weight",string_of_float t.weight;"id",string_of_int t.id;"arg_dir",t.arg_dir], | ||
51 | + [Xml.Element("symbol",[],[linear_term t.symbol]); | ||
52 | + Xml.Element("arg_symbol",[],[linear_term t.arg_symbol]); | ||
53 | + Xml.Element("attrs",[],Xlist.map t.attrs (fun (k,v) -> Xml.Element("attr",["name",k],[linear_term v]))); | ||
54 | + Xml.Element("args",[],[linear_term t.args])]) | ||
55 | + | Ref i -> Xml.Element("Ref",["index",string_of_int i],[]) | ||
56 | + | Cut t -> Xml.Element("Cut",[],[linear_term t]) | ||
57 | + | ||
58 | +let linear_term_array a = | ||
59 | + let l = Int.fold 0 (Array.length a - 1) [] (fun l i -> | ||
60 | + Xml.Element("element",["index",string_of_int i],[linear_term a.(i)]) :: l) in | ||
61 | + Xml.Element("array",[],List.rev l) | ||
62 | + |
LCGparser/eniam-lcg-parser-2.2.tar.bz2
0 → 100644
No preview for this file type
exec/ENIAMexecXMLof.ml
0 → 100644
1 | +(* | ||
2 | + * ENIAMexec implements ENIAM processing stream | ||
3 | + * Copyright (C) 2016 Wojciech Jaworski <wjaworski atSPAMfree mimuw dot edu dot pl> | ||
4 | + * Copyright (C) 2016 Institute of Computer Science Polish Academy of Sciences | ||
5 | + * | ||
6 | + * This library is free software: you can redistribute it and/or modify | ||
7 | + * it under the terms of the GNU Lesser General Public License as published by | ||
8 | + * the Free Software Foundation, either version 3 of the License, or | ||
9 | + * (at your option) any later version. | ||
10 | + * | ||
11 | + * This library is distributed in the hope that it will be useful, | ||
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + * GNU Lesser General Public License for more details. | ||
15 | + * | ||
16 | + * You should have received a copy of the GNU Lesser General Public License | ||
17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | + *) | ||
19 | + | ||
20 | +open ENIAMexecTypes | ||
21 | +open Printf | ||
22 | + | ||
23 | +let eniam_sentence (result : eniam_parse_result) = | ||
24 | + match result.status with | ||
25 | + Parsed -> [ENIAM_LCG_XMLof.linear_term_array result.dependency_tree6b] | ||
26 | + | SemParsed -> [ENIAMsemXMLof.linear_term result.semantic_graph12] | ||
27 | + | _ -> [] | ||
28 | + | ||
29 | +let token_extarray t = | ||
30 | + Xml.Element("tokens",[], List.rev (Int.fold 0 (ExtArray.size t - 1) [] (fun l id -> | ||
31 | + ENIAMtokens.xml_of_token_env id (ExtArray.get t id) :: l))) | ||
32 | + | ||
33 | +let token_list paths msg = | ||
34 | + if msg = "" then Xml.Element("tokens",[],Xlist.map paths (fun t -> ENIAMtokens.xml_of_token_env (-1) t)) | ||
35 | + else Xml.Element("error",[],[Xml.PCData msg]) | ||
36 | + | ||
37 | +let xml_of_dep_sentence paths = | ||
38 | + List.rev (Int.fold 0 (Array.length paths - 1) [] (fun l conll_id -> | ||
39 | + let id,super,label = paths.(conll_id) in | ||
40 | + Xml.Element("edge",["conll_id",string_of_int conll_id;"id",string_of_int id] @ | ||
41 | + (if super = (-1) then [] else ["super",string_of_int super]) @ | ||
42 | + (if label = "" then [] else ["label",label]),[]) :: l)) | ||
43 | + | ||
44 | +let xml_of_edge (id,lnode,rnode) = | ||
45 | + Xml.Element("edge",["id",string_of_int id;"lnode",string_of_int lnode;"rnode",string_of_int rnode],[]) | ||
46 | + | ||
47 | +let set_mode m = | ||
48 | + if m = "" then [] else ["mode",m] | ||
49 | + | ||
50 | +let rec sentence m = function | ||
51 | + RawSentence s -> Xml.Element("RawSentence",set_mode m,[Xml.PCData s]) | ||
52 | + | StructSentence(paths,last) -> Xml.Element("StructSentence",(set_mode m) @ ["last",string_of_int last],Xlist.map paths xml_of_edge) | ||
53 | + | DepSentence paths -> failwith "ENIAMsubsyntaxXMLof.sentence: ni" (*Xml.Element("DepSentence", | ||
54 | + (set_mode m) @ ["size",string_of_int (Array.length paths)],xml_of_dep_sentence paths)*) (* FIXME *) | ||
55 | + | ENIAMSentence result -> Xml.Element("ENIAMSentence",set_mode m @ ["status",ENIAMvisualization.string_of_status result.status],eniam_sentence result) | ||
56 | + | QuotedSentences sentences -> | ||
57 | + Xml.Element("QuotedSentences",set_mode m,Xlist.map sentences (fun p -> | ||
58 | + Xml.Element("Sentence",["id",p.id;"beg",string_of_int p.beg;"len",string_of_int p.len;"next",string_of_int p.next],[sentence "" p.sentence]))) | ||
59 | + | AltSentence l -> Xml.Element("AltSentence",set_mode m,Xlist.map l (fun (m,t) -> sentence (ENIAMvisualization.string_of_mode m) t)) | ||
60 | + | ||
61 | +let rec paragraph m = function | ||
62 | + RawParagraph s -> Xml.Element("RawParagraph",set_mode m,[Xml.PCData s]) | ||
63 | + | StructParagraph sentences -> | ||
64 | + Xml.Element("StructParagraph",set_mode m,Xlist.map sentences (fun p -> | ||
65 | + Xml.Element("Sentence",["id",p.id;"beg",string_of_int p.beg;"len",string_of_int p.len;"next",string_of_int p.next],[sentence "" p.sentence]))) | ||
66 | + | AltParagraph l -> Xml.Element("AltParagraph",set_mode m,Xlist.map l (fun (m,t) -> paragraph (ENIAMvisualization.string_of_mode m) t)) | ||
67 | + | ||
68 | +let rec text m = function | ||
69 | + RawText s -> Xml.Element("RawText",set_mode m,[Xml.PCData s]) | ||
70 | + | StructText paragraphs -> Xml.Element("StructText",set_mode m,Xlist.map paragraphs (paragraph "")) | ||
71 | + | AltText l -> Xml.Element("AltText",set_mode m,Xlist.map l (fun (m,t) -> text (ENIAMvisualization.string_of_mode m) t)) | ||
72 | + | ||
73 | +let message msg = | ||
74 | + Xml.Element("error",[],[Xml.PCData msg]) |
exec/makefile
@@ -9,21 +9,21 @@ OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa b | @@ -9,21 +9,21 @@ OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa b | ||
9 | eniam-mst-disambiguation.cmxa eniam-lexSemantics.cmxa eniam-semantics.cmxa eniam-exec.cmxa | 9 | eniam-mst-disambiguation.cmxa eniam-lexSemantics.cmxa eniam-semantics.cmxa eniam-exec.cmxa |
10 | INSTALLDIR=`ocamlc -where`/eniam | 10 | INSTALLDIR=`ocamlc -where`/eniam |
11 | 11 | ||
12 | -SOURCES= ENIAMexecTypes.ml ENIAMexec.ml ENIAMselectSent.ml ENIAMvisualization.ml | 12 | +SOURCES= ENIAMexecTypes.ml ENIAMexec.ml ENIAMselectSent.ml ENIAMvisualization.ml ENIAMexecXMLof.ml |
13 | 13 | ||
14 | all: eniam-exec.cma eniam-exec.cmxa | 14 | all: eniam-exec.cma eniam-exec.cmxa |
15 | 15 | ||
16 | install: all | 16 | install: all |
17 | mkdir -p $(INSTALLDIR) | 17 | mkdir -p $(INSTALLDIR) |
18 | cp eniam-exec.cmxa eniam-exec.a eniam-exec.cma $(INSTALLDIR) | 18 | cp eniam-exec.cmxa eniam-exec.a eniam-exec.cma $(INSTALLDIR) |
19 | - cp ENIAMexecTypes.cmi ENIAMexec.cmi ENIAMselectSent.cmi ENIAMvisualization.cmi $(INSTALLDIR) | ||
20 | - cp ENIAMexecTypes.cmx ENIAMexec.cmx ENIAMselectSent.cmx ENIAMvisualization.cmx $(INSTALLDIR) | 19 | + cp ENIAMexecTypes.cmi ENIAMexec.cmi ENIAMselectSent.cmi ENIAMexecXMLof.cmi ENIAMvisualization.cmi $(INSTALLDIR) |
20 | + cp ENIAMexecTypes.cmx ENIAMexec.cmx ENIAMselectSent.cmx ENIAMexecXMLof.cmx ENIAMvisualization.cmx $(INSTALLDIR) | ||
21 | 21 | ||
22 | install-local: all | 22 | install-local: all |
23 | mkdir -p $(INSTALLDIR) | 23 | mkdir -p $(INSTALLDIR) |
24 | cp eniam-exec.cmxa eniam-exec.a eniam-exec.cma $(INSTALLDIR) | 24 | cp eniam-exec.cmxa eniam-exec.a eniam-exec.cma $(INSTALLDIR) |
25 | - cp ENIAMexecTypes.cmi ENIAMexec.cmi ENIAMselectSent.cmi ENIAMvisualization.cmi $(INSTALLDIR) | ||
26 | - cp ENIAMexecTypes.cmx ENIAMexec.cmx ENIAMselectSent.cmx ENIAMvisualization.cmx $(INSTALLDIR) | 25 | + cp ENIAMexecTypes.cmi ENIAMexec.cmi ENIAMselectSent.cmi ENIAMexecXMLof.cmi ENIAMvisualization.cmi $(INSTALLDIR) |
26 | + cp ENIAMexecTypes.cmx ENIAMexec.cmx ENIAMselectSent.cmx ENIAMexecXMLof.cmx ENIAMvisualization.cmx $(INSTALLDIR) | ||
27 | 27 | ||
28 | eniam-exec.cma: $(SOURCES) | 28 | eniam-exec.cma: $(SOURCES) |
29 | ocamlc -linkall -a -o eniam-exec.cma $(OCAMLFLAGS) $^ | 29 | ocamlc -linkall -a -o eniam-exec.cma $(OCAMLFLAGS) $^ |
exec/parser.ml
@@ -23,7 +23,7 @@ open Xstd | @@ -23,7 +23,7 @@ open Xstd | ||
23 | let rules = ENIAM_LCGlexicon.make_rules false ENIAM_LCGlexiconTypes.rules_filename | 23 | let rules = ENIAM_LCGlexicon.make_rules false ENIAM_LCGlexiconTypes.rules_filename |
24 | let dep_rules = ENIAM_LCGlexicon.make_rules true ENIAM_LCGlexiconTypes.rules_filename | 24 | let dep_rules = ENIAM_LCGlexicon.make_rules true ENIAM_LCGlexiconTypes.rules_filename |
25 | 25 | ||
26 | -type output = (*Text | Xml |*) Html | Marsh (*| Graphviz*) | 26 | +type output = (*Text |*) Xml | Html | Marsh (*| Yaml | Graphviz*) |
27 | 27 | ||
28 | let output = ref Html | 28 | let output = ref Html |
29 | let comm_stdio = ref true | 29 | let comm_stdio = ref true |
@@ -43,10 +43,11 @@ let perform_integration = ref false | @@ -43,10 +43,11 @@ let perform_integration = ref false | ||
43 | let spec_list = [ | 43 | let spec_list = [ |
44 | "-i", Arg.Unit (fun () -> comm_stdio:=true), "Communication using stdio (default)"; | 44 | "-i", Arg.Unit (fun () -> comm_stdio:=true), "Communication using stdio (default)"; |
45 | "-p", Arg.Int (fun p -> comm_stdio:=false; port:=p), "<port> Communication using sockets on given port number"; | 45 | "-p", Arg.Int (fun p -> comm_stdio:=false; port:=p), "<port> Communication using sockets on given port number"; |
46 | - (*"-t", Arg.Unit (fun () -> output:=Text), "Output as plain text (default)"; | ||
47 | - "-x", Arg.Unit (fun () -> output:=Xml), "Output as XML";*) | 46 | + (*"-t", Arg.Unit (fun () -> output:=Text), "Output as plain text (default)";*) |
47 | + "-x", Arg.Unit (fun () -> output:=Xml), "Output as XML"; | ||
48 | "-m", Arg.Unit (fun () -> output:=Marsh), "Output as marshalled Ocaml data structure"; | 48 | "-m", Arg.Unit (fun () -> output:=Marsh), "Output as marshalled Ocaml data structure"; |
49 | "-h", Arg.Unit (fun () -> output:=Html), "Output as HTML (default)"; | 49 | "-h", Arg.Unit (fun () -> output:=Html), "Output as HTML (default)"; |
50 | + (* "-y", Arg.Unit (fun () -> output:=Yaml), "Output as YAML"; *) | ||
50 | (*"-g", Arg.Unit (fun () -> output:=Graphviz; sentence_split:=false), "Output as graphviz dot file; turns sentence split off";*) | 51 | (*"-g", Arg.Unit (fun () -> output:=Graphviz; sentence_split:=false), "Output as graphviz dot file; turns sentence split off";*) |
51 | (* "-r", Arg.String (fun p -> | 52 | (* "-r", Arg.String (fun p -> |
52 | ENIAMtokenizerTypes.set_resource_path p; | 53 | ENIAMtokenizerTypes.set_resource_path p; |
@@ -124,6 +125,7 @@ let rec main_loop sub_in sub_out in_chan out_chan = | @@ -124,6 +125,7 @@ let rec main_loop sub_in sub_out in_chan out_chan = | ||
124 | if msg <> "" then | 125 | if msg <> "" then |
125 | (match !output with | 126 | (match !output with |
126 | | Html -> Printf.fprintf out_chan "%s\n%!" msg | 127 | | Html -> Printf.fprintf out_chan "%s\n%!" msg |
128 | + | Xml -> Printf.fprintf out_chan "%s\n%!" (Xml.to_string_fmt (ENIAMexecXMLof.message msg)) | ||
127 | | Marsh -> Marshal.to_channel out_chan (text,tokens,lex_sems,msg) []; flush out_chan) else ( | 129 | | Marsh -> Marshal.to_channel out_chan (text,tokens,lex_sems,msg) []; flush out_chan) else ( |
128 | let text = ENIAMexec.translate_text text in | 130 | let text = ENIAMexec.translate_text text in |
129 | let text = ENIAMexec.parse !timeout !verbosity rules dep_rules tokens lex_sems text in | 131 | let text = ENIAMexec.parse !timeout !verbosity rules dep_rules tokens lex_sems text in |
@@ -132,6 +134,7 @@ let rec main_loop sub_in sub_out in_chan out_chan = | @@ -132,6 +134,7 @@ let rec main_loop sub_in sub_out in_chan out_chan = | ||
132 | let text = if !semantic_processing_flag then ENIAMexec.semantic_processing !verbosity tokens lex_sems text else text in | 134 | let text = if !semantic_processing_flag then ENIAMexec.semantic_processing !verbosity tokens lex_sems text else text in |
133 | (match !output with | 135 | (match !output with |
134 | | Html -> ENIAMvisualization.print_html_text !output_dir "parsed_text" text !img !verbosity tokens | 136 | | Html -> ENIAMvisualization.print_html_text !output_dir "parsed_text" text !img !verbosity tokens |
137 | + | Xml -> Printf.fprintf out_chan "%s\n%!" (Xml.to_string_fmt (ENIAMexecXMLof.text "" text)) | ||
135 | | Marsh -> Marshal.to_channel out_chan (text,tokens,lex_sems,msg) []; flush out_chan)); | 138 | | Marsh -> Marshal.to_channel out_chan (text,tokens,lex_sems,msg) []; flush out_chan)); |
136 | prerr_endline "Done!"; | 139 | prerr_endline "Done!"; |
137 | main_loop sub_in sub_out in_chan out_chan) | 140 | main_loop sub_in sub_out in_chan out_chan) |
integration/opis_do_dzieła.txt
0 → 100644
1 | +W katalogach exec oraz integration zawarte są moduły ENIAMexec oraz ENIAMintegration, które w ramach wykonania dzieła zostały rozszerzone do postaci umożliwiającej integrację z gramatyką POLFIE. Uruchamiany jest parser XLE wraz z gramatyką POLFIE-OT, będącą rezultatem projektu Clarin-pl 1, poszczególne zdania przetwarzanego tekstu przekazywane są do tego parsera, w wyniku czego powstają pliki z wygenerowanymi na ich podstawie c-strukturami i f-strukturami, które następnie wczytywane są przez parser zintegrowany. | ||
2 | +Parsowanie za pomocą POLFIE można włączać bądź wyłączać za pomocą parametrów uruchomieniowych parsera. Kiedy parsowanie za pomocą POLFIE jest włączone powyższe moduły do swojego działania wymagają zainstalowanego parsera XLE. |
semantics/ENIAMsemXMLof.ml
0 → 100644
1 | +(* | ||
2 | + * ENIAMsemantics implements semantic processing for ENIAM | ||
3 | + * Copyright (C) 2016-2017 Wojciech Jaworski <wjaworski atSPAMfree mimuw dot edu dot pl> | ||
4 | + * Copyright (C) 2016-2017 Institute of Computer Science Polish Academy of Sciences | ||
5 | + * | ||
6 | + * This library is free software: you can redistribute it and/or modify | ||
7 | + * it under the terms of the GNU Lesser General Public License as published by | ||
8 | + * the Free Software Foundation, either version 3 of the License, or | ||
9 | + * (at your option) any later version. | ||
10 | + * | ||
11 | + * This library is distributed in the hope that it will be useful, | ||
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + * GNU Lesser General Public License for more details. | ||
15 | + * | ||
16 | + * You should have received a copy of the GNU Lesser General Public License | ||
17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | + *) | ||
19 | + | ||
20 | +open ENIAMsemTypes | ||
21 | + | ||
22 | +let rec linear_term = function | ||
23 | + | Tuple l -> Xml.Element("Tuple",[],Xlist.map l linear_term) | ||
24 | + | Variant(e,l) -> | ||
25 | + Xml.Element("Variant",["label",e],Xlist.map l (fun (i,t) -> | ||
26 | + Xml.Element("option",["number",i],[linear_term t]))) | ||
27 | + | Dot -> Xml.Element("Dot",[],[]) | ||
28 | + | Val s -> Xml.Element("Val",[],[Xml.PCData s]) | ||
29 | + | Node t -> | ||
30 | + Xml.Element("Node",["orth",t.orth;"lemma",t.lemma;"pos",t.pos; | ||
31 | + "weight",string_of_float t.weight;"id",string_of_int t.id;"arg_dir",t.arg_dir;"gf",t.gf; | ||
32 | + "role",t.role;"role_attr",t.role_attr;"arole",t.arole;"arole_attr",t.arole_attr; | ||
33 | + "arev",string_of_bool t.arev;"label",t.label;"def_label",t.def_label], | ||
34 | + [Xml.Element("symbol",[],[linear_term t.symbol]); | ||
35 | + Xml.Element("arg_symbol",[],[linear_term t.arg_symbol]); | ||
36 | + Xml.Element("attrs",[],Xlist.map t.attrs (fun (k,v) -> Xml.Element("attr",["name",k],[linear_term v]))); | ||
37 | + Xml.Element("args",[],[linear_term t.args]); | ||
38 | + Xml.Element("selprefs",[],[linear_term t.selprefs]); | ||
39 | + Xml.Element("meaning",[],[linear_term t.meaning]); | ||
40 | + Xml.Element("sem_args",[],[linear_term t.sem_args])]) | ||
41 | + | Ref i -> Xml.Element("Ref",["index",string_of_int i],[]) | ||
42 | + | Concept c -> | ||
43 | + Xml.Element("Concept",["local_quant",string_of_bool c.c_local_quant; | ||
44 | + "label",c.c_label;"def_label",c.c_def_label; | ||
45 | + "variable",fst c.c_variable ^ "_" ^ snd c.c_variable;"pos",string_of_int c.c_pos], | ||
46 | + [Xml.Element("sense",[],[linear_term c.c_sense]); | ||
47 | + Xml.Element("name",[],[linear_term c.c_name]); | ||
48 | + Xml.Element("quant",[],[linear_term c.c_quant]); | ||
49 | + Xml.Element("relations",[],[linear_term c.c_relations]); | ||
50 | + Xml.Element("cat",[],[linear_term c.c_cat])]) | ||
51 | + | Context c -> | ||
52 | + Xml.Element("Context", | ||
53 | + ["variable",fst c.cx_variable ^ "_" ^ snd c.cx_variable;"pos",string_of_int c.cx_pos], | ||
54 | + [Xml.Element("sense",[],[linear_term c.cx_sense]); | ||
55 | + Xml.Element("contents",[],[linear_term c.cx_contents]); | ||
56 | + Xml.Element("relations",[],[linear_term c.cx_relations]); | ||
57 | + Xml.Element("cat",[],[linear_term c.cx_cat])]) | ||
58 | + | Relation(r,a,c) -> Xml.Element("Relation",["role",r;"role_attribute",a],[linear_term c]) | ||
59 | + | RevRelation(r,a,c) -> Xml.Element("RevRelation",["role",r;"role_attribute",a],[linear_term c]) | ||
60 | + | SingleRelation r -> Xml.Element("SingleRelation",[],[linear_term r]) | ||
61 | + | AddRelation(t,r,a,s) -> | ||
62 | + Xml.Element("AddRelation",["role",r;"role_attribute",a], | ||
63 | + [Xml.Element("",[],[linear_term t]);Xml.Element("",[],[linear_term s])]) | ||
64 | + | RemoveRelation(r,a,t) -> Xml.Element("RemoveRelation",["role",r;"role_attribute",a],[linear_term t]) | ||
65 | + | SetContextName(s,t) -> | ||
66 | + Xml.Element("SetContextName",[],[linear_term s;linear_term t]) | ||
67 | + | CreateContext(s,t) -> | ||
68 | + Xml.Element("CreateContext",[],[linear_term (Context s);linear_term t]) | ||
69 | + | ManageCoordination(t,r) -> | ||
70 | + Xml.Element("ManageCoordination",[],[linear_term (Node t);linear_term r]) |
semantics/makefile
@@ -9,23 +9,23 @@ OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa b | @@ -9,23 +9,23 @@ OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa b | ||
9 | eniam-lexSemantics.cmxa #eniam-semantics.cmxa | 9 | eniam-lexSemantics.cmxa #eniam-semantics.cmxa |
10 | INSTALLDIR=`ocamlc -where`/eniam | 10 | INSTALLDIR=`ocamlc -where`/eniam |
11 | 11 | ||
12 | -SOURCES= ENIAMsemTypes.ml ENIAMsemLexicon.ml ENIAMsemValence.ml ENIAMdisambiguation.ml ENIAMcoreference.ml ENIAMsemStringOf.ml ENIAMsemGraph.ml ENIAMsemLatexOf.ml ENIAMsemGraphOf.ml | 12 | +SOURCES= ENIAMsemTypes.ml ENIAMsemLexicon.ml ENIAMsemValence.ml ENIAMdisambiguation.ml ENIAMcoreference.ml ENIAMsemStringOf.ml ENIAMsemXMLof.ml ENIAMsemGraph.ml ENIAMsemLatexOf.ml ENIAMsemGraphOf.ml |
13 | 13 | ||
14 | all: eniam-semantics.cma eniam-semantics.cmxa | 14 | all: eniam-semantics.cma eniam-semantics.cmxa |
15 | 15 | ||
16 | install: all | 16 | install: all |
17 | mkdir -p $(INSTALLDIR) | 17 | mkdir -p $(INSTALLDIR) |
18 | cp eniam-semantics.cmxa eniam-semantics.a eniam-semantics.cma $(INSTALLDIR) | 18 | cp eniam-semantics.cmxa eniam-semantics.a eniam-semantics.cma $(INSTALLDIR) |
19 | - cp ENIAMsemTypes.cmi ENIAMsemLexicon.cmi ENIAMsemValence.cmi ENIAMdisambiguation.cmi ENIAMcoreference.cmi ENIAMsemStringOf.cmi ENIAMsemGraph.cmi ENIAMsemLatexOf.cmi ENIAMsemGraphOf.cmi $(INSTALLDIR) | ||
20 | - cp ENIAMsemTypes.cmx ENIAMsemLexicon.cmx ENIAMsemValence.cmx ENIAMdisambiguation.cmx ENIAMcoreference.cmx ENIAMsemStringOf.cmx ENIAMsemGraph.cmx ENIAMsemLatexOf.cmx ENIAMsemGraphOf.cmx $(INSTALLDIR) | 19 | + cp ENIAMsemTypes.cmi ENIAMsemLexicon.cmi ENIAMsemValence.cmi ENIAMdisambiguation.cmi ENIAMcoreference.cmi ENIAMsemStringOf.cmi ENIAMsemGraph.cmi ENIAMsemXMLof.cmi ENIAMsemLatexOf.cmi ENIAMsemGraphOf.cmi $(INSTALLDIR) |
20 | + cp ENIAMsemTypes.cmx ENIAMsemLexicon.cmx ENIAMsemValence.cmx ENIAMdisambiguation.cmx ENIAMcoreference.cmx ENIAMsemStringOf.cmx ENIAMsemGraph.cmx ENIAMsemXMLof.cmx ENIAMsemLatexOf.cmx ENIAMsemGraphOf.cmx $(INSTALLDIR) | ||
21 | mkdir -p /usr/share/eniam/semantics | 21 | mkdir -p /usr/share/eniam/semantics |
22 | cp resources/* /usr/share/eniam/semantics | 22 | cp resources/* /usr/share/eniam/semantics |
23 | 23 | ||
24 | install-local: all | 24 | install-local: all |
25 | mkdir -p $(INSTALLDIR) | 25 | mkdir -p $(INSTALLDIR) |
26 | cp eniam-semantics.cmxa eniam-semantics.a eniam-semantics.cma $(INSTALLDIR) | 26 | cp eniam-semantics.cmxa eniam-semantics.a eniam-semantics.cma $(INSTALLDIR) |
27 | - cp ENIAMsemTypes.cmi ENIAMsemLexicon.cmi ENIAMsemValence.cmi ENIAMdisambiguation.cmi ENIAMcoreference.cmi ENIAMsemStringOf.cmi ENIAMsemGraph.cmi ENIAMsemLatexOf.cmi ENIAMsemGraphOf.cmi $(INSTALLDIR) | ||
28 | - cp ENIAMsemTypes.cmx ENIAMsemLexicon.cmx ENIAMsemValence.cmx ENIAMdisambiguation.cmx ENIAMcoreference.cmx ENIAMsemStringOf.cmx ENIAMsemGraph.cmx ENIAMsemLatexOf.cmx ENIAMsemGraphOf.cmx $(INSTALLDIR) | 27 | + cp ENIAMsemTypes.cmi ENIAMsemLexicon.cmi ENIAMsemValence.cmi ENIAMdisambiguation.cmi ENIAMcoreference.cmi ENIAMsemStringOf.cmi ENIAMsemGraph.cmi ENIAMsemXMLof.cmi ENIAMsemLatexOf.cmi ENIAMsemGraphOf.cmi $(INSTALLDIR) |
28 | + cp ENIAMsemTypes.cmx ENIAMsemLexicon.cmx ENIAMsemValence.cmx ENIAMdisambiguation.cmx ENIAMcoreference.cmx ENIAMsemStringOf.cmx ENIAMsemGraph.cmx ENIAMsemXMLof.cmx ENIAMsemLatexOf.cmx ENIAMsemGraphOf.cmx $(INSTALLDIR) | ||
29 | mkdir -p /usr/local/share/eniam/semantics | 29 | mkdir -p /usr/local/share/eniam/semantics |
30 | cp resources/* /usr/local/share/eniam/semantics | 30 | cp resources/* /usr/local/share/eniam/semantics |
31 | 31 |