Commit 2667fa91bfa4c7761e59650b82eceea9f2eb209c

Authored by Wojciech Jaworski
1 parent 8f0e1464

rozpoczęcie poprawiania interfejsu do Słowosieci w lexSemantics

lexSemantics/ENIAMlexSemanticsTypes.ml
... ... @@ -77,3 +77,15 @@ let subst_uncountable_lexemes_filename2 = resource_path ^ "/Walenty/subst_uncoun
77 77 let subst_container_lexemes_filename = resource_path ^ "/Walenty/subst_container.dat"
78 78 let subst_numeral_lexemes_filename = resource_path ^ "/Walenty/subst_numeral.dat"
79 79 let subst_time_lexemes_filename = resource_path ^ "/Walenty/subst_time.dat" *)
  80 +
  81 +(*let rzeczownik_filename = resource_path ^ "/plWordnet/rzeczownik.tab"
  82 +let czasownik_filename = resource_path ^ "/plWordnet/czasownik.tab"
  83 +let przymiotnik_filename = resource_path ^ "/plWordnet/przymiotnik.tab"
  84 +let synsets_filename = resource_path ^ "/plWordnet/synsets.tab"
  85 +let hipero_filename = resource_path ^ "/plWordnet/hipero.tab"
  86 +let predef_filename = resource_path ^ "/plWordnet/predef_prefs.tab"
  87 +let proper_classes_filename = resource_path ^ "/plWordnet/proper_classes.tab"*)
  88 +
  89 +let lu_filename = resource_path ^ "/plWordnet/lu.tab"
  90 +let ex_hipo_filename = resource_path ^ "/plWordnet/ex_hipo.tab"
  91 +let syn_filename = resource_path ^ "/plWordnet/syn.tab"
... ...
lexSemantics/ENIAMplWordnet.ml 0 → 100644
  1 +(*
  2 + * ENIAMlexSemantics is a library that assigns tokens with lexicosemantic information.
  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 Xstd
  21 +open ENIAMlexSemanticsTypes
  22 +
  23 +let load_lu filename =
  24 + File.fold_tab filename IntMap.empty (fun lumap -> function
  25 + [lu_id; lemma; variant; syn_id] -> IntMap.add lumap (int_of_string lu_id) (lemma,variant,int_of_string syn_id)
  26 + | l -> failwith ("load_lu: " ^ String.concat "\t" l))
  27 +
  28 +let load_syn filename =
  29 + File.fold_tab filename IntMap.empty (fun synmap -> function
  30 + syn_id :: pos :: lu_ids ->
  31 + let lu_ids = Xlist.map lu_ids int_of_string in
  32 + IntMap.add synmap (int_of_string syn_id) (pos,lu_ids)
  33 + | l -> failwith ("load_syn: " ^ String.concat "\t" l))
  34 +
  35 +let load_ex_hipo filename =
  36 + File.fold_tab filename IntMap.empty (fun ex_hipo -> function
  37 + [parent; child; cost] ->
  38 + let parent = int_of_string parent in
  39 + let child = int_of_string child in
  40 + let cost = int_of_string cost in
  41 + let children = try IntMap.find ex_hipo parent with Not_found -> IntMap.empty in
  42 + let children = IntMap.add_inc children child cost (fun _ -> failwith "load_ex_hipo") in
  43 + IntMap.add ex_hipo parent children
  44 + | l -> failwith ("load_ex_hipo: " ^ String.concat "\t" l))
  45 +
  46 +let lumap = load_lu lu_filename
  47 +let synmap = load_syn syn_filename
  48 +let ex_hipo = load_ex_hipo ex_hipo_filename
... ...
lexSemantics/makefile
... ... @@ -3,20 +3,20 @@ OCAMLOPT=ocamlopt
3 3 OCAMLDEP=ocamldep
4 4 INCLUDES=-I +xml-light -I +xlib -I +zip -I +bz2 -I +eniam
5 5 OCAMLFLAGS=$(INCLUDES) -g
6   -#OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa bz2.cmxa xlib.cmxa eniam-tokenizer.cmxa eniam-morphology.cmxa eniam-subsyntax.cmxa eniam-lcg-parser.cmxa eniam-lcg-lexicon.cmxa #eniam-plWordnet.cmxa #eniam-lexSemantics.cmxa
7   -OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa bz2.cmxa xlib.cmxa eniam-tokenizer.cmxa eniam-morphology.cmxa eniam-subsyntax.cmxa eniam-lcg-parser.cmxa eniam-lcg-lexicon.cmxa eniam-lexSemantics.cmxa
  6 +OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa bz2.cmxa xlib.cmxa eniam-tokenizer.cmxa eniam-morphology.cmxa eniam-subsyntax.cmxa eniam-lcg-parser.cmxa eniam-lcg-lexicon.cmxa #eniam-plWordnet.cmxa #eniam-lexSemantics.cmxa
  7 +#OCAMLOPTFLAGS=$(INCLUDES) unix.cmxa xml-light.cmxa str.cmxa nums.cmxa zip.cmxa bz2.cmxa xlib.cmxa eniam-tokenizer.cmxa eniam-morphology.cmxa eniam-subsyntax.cmxa eniam-lcg-parser.cmxa eniam-lcg-lexicon.cmxa eniam-lexSemantics.cmxa
8 8 INSTALLDIR=`ocamlc -where`/eniam
9 9  
10 10 SOURCES= entries.ml ENIAMwalTypes.ml ENIAMwalStringOf.ml ENIAMwalParser.ml ENIAMwalReduce.ml ENIAMvalence.ml ENIAMwalRenderer.ml ENIAMadjuncts.ml \
11   - ENIAMlexSemanticsTypes.ml ENIAMlexSemanticsStringOf.ml ENIAMlexSemanticsHTMLof.ml ENIAMlexSemanticsXMLof.ml ENIAMlexSemantics.ml #ENIAMlexSemanticsData.ml
  11 + ENIAMlexSemanticsTypes.ml ENIAMlexSemanticsStringOf.ml ENIAMlexSemanticsHTMLof.ml ENIAMlexSemanticsXMLof.ml ENIAMplWordnet.ml ENIAMlexSemantics.ml #ENIAMlexSemanticsData.ml
12 12  
13 13 all: eniam-lexSemantics.cma eniam-lexSemantics.cmxa
14 14  
15 15 install: all
16 16 mkdir -p $(INSTALLDIR)
17 17 cp eniam-lexSemantics.cmxa eniam-lexSemantics.a eniam-lexSemantics.cma $(INSTALLDIR)
18   - cp entries.cmi ENIAMwalTypes.cmi ENIAMwalStringOf.cmi ENIAMwalParser.cmi ENIAMwalReduce.cmi ENIAMvalence.cmi ENIAMwalRenderer.cmi ENIAMadjuncts.cmi ENIAMlexSemanticsTypes.cmi ENIAMlexSemanticsStringOf.cmi ENIAMlexSemanticsHTMLof.cmi ENIAMlexSemanticsXMLof.cmi ENIAMlexSemantics.cmi $(INSTALLDIR)
19   - cp entries.cmx ENIAMwalTypes.cmx ENIAMwalStringOf.cmx ENIAMwalParser.cmx ENIAMwalReduce.cmx ENIAMvalence.cmx ENIAMwalRenderer.cmx ENIAMadjuncts.cmx ENIAMlexSemanticsTypes.cmx ENIAMlexSemanticsStringOf.cmx ENIAMlexSemanticsHTMLof.cmx ENIAMlexSemanticsXMLof.cmx ENIAMlexSemantics.cmx $(INSTALLDIR)
  18 + cp entries.cmi ENIAMwalTypes.cmi ENIAMwalStringOf.cmi ENIAMwalParser.cmi ENIAMwalReduce.cmi ENIAMvalence.cmi ENIAMwalRenderer.cmi ENIAMadjuncts.cmi ENIAMlexSemanticsTypes.cmi ENIAMlexSemanticsStringOf.cmi ENIAMlexSemanticsHTMLof.cmi ENIAMlexSemanticsXMLof.cmi ENIAMplWordnet.cmi ENIAMlexSemantics.cmi $(INSTALLDIR)
  19 + cp entries.cmx ENIAMwalTypes.cmx ENIAMwalStringOf.cmx ENIAMwalParser.cmx ENIAMwalReduce.cmx ENIAMvalence.cmx ENIAMwalRenderer.cmx ENIAMadjuncts.cmx ENIAMlexSemanticsTypes.cmx ENIAMlexSemanticsStringOf.cmx ENIAMlexSemanticsHTMLof.cmx ENIAMlexSemanticsXMLof.cmx ENIAMplWordnet.cmx ENIAMlexSemantics.cmx $(INSTALLDIR)
20 20 mkdir -p /usr/share/eniam/lexSemantics
21 21 # cp resources/* /usr/share/eniam/lexSemantics
22 22 ln -s /usr/share/eniam/lexSemantics/proper_names_20160104.tab /usr/share/eniam/lexSemantics/proper_names.tab
... ... @@ -25,8 +25,8 @@ install: all
25 25 install-local: all
26 26 mkdir -p $(INSTALLDIR)
27 27 cp eniam-lexSemantics.cmxa eniam-lexSemantics.a eniam-lexSemantics.cma $(INSTALLDIR)
28   - cp entries.cmi ENIAMwalTypes.cmi ENIAMwalStringOf.cmi ENIAMwalParser.cmi ENIAMwalReduce.cmi ENIAMvalence.cmi ENIAMwalRenderer.cmi ENIAMadjuncts.cmi ENIAMlexSemanticsTypes.cmi ENIAMlexSemantics.cmi $(INSTALLDIR)
29   - cp entries.cmx ENIAMwalTypes.cmx ENIAMwalStringOf.cmx ENIAMwalParser.cmx ENIAMwalReduce.cmx ENIAMvalence.cmx ENIAMwalRenderer.cmx ENIAMadjuncts.cmx ENIAMlexSemanticsTypes.cmx ENIAMlexSemantics.cmx $(INSTALLDIR)
  28 + cp entries.cmi ENIAMwalTypes.cmi ENIAMwalStringOf.cmi ENIAMwalParser.cmi ENIAMwalReduce.cmi ENIAMvalence.cmi ENIAMwalRenderer.cmi ENIAMadjuncts.cmi ENIAMlexSemanticsTypes.cmi ENIAMlexSemanticsStringOf.cmi ENIAMlexSemanticsHTMLof.cmi ENIAMlexSemanticsXMLof.cmi ENIAMplWordnet.cmi ENIAMlexSemantics.cmi $(INSTALLDIR)
  29 + cp entries.cmx ENIAMwalTypes.cmx ENIAMwalStringOf.cmx ENIAMwalParser.cmx ENIAMwalReduce.cmx ENIAMvalence.cmx ENIAMwalRenderer.cmx ENIAMadjuncts.cmx ENIAMlexSemanticsTypes.cmx ENIAMlexSemanticsStringOf.cmx ENIAMlexSemanticsHTMLof.cmx ENIAMlexSemanticsXMLof.cmx ENIAMplWordnet.cmx ENIAMlexSemantics.cmx $(INSTALLDIR)
30 30 mkdir -p /usr/local/share/eniam/lexSemantics
31 31 # cp resources/* /usr/local/share/eniam/lexSemantics
32 32 ln -s /usr/local/share/eniam/lexSemantics/proper_names_20160104.tab /usr/local/share/eniam/lexSemantics/proper_names.tab
... ...