Skip to content

Commit

Permalink
Fixes to the LKB-Freeling interface
Browse files Browse the repository at this point in the history
  • Loading branch information
olzama committed Dec 4, 2023
1 parent a7732d4 commit e69104b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lkb/script
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@
(when (and (listp *last-parses*) (= (length *last-parses*) 1))
(setf *last-parses* '("Mi perro duerme." "La ventana se abrió.")))

;;; Initialize LUI visualization
(lui-initialize)

;;;
;;; Start up FreeLing as preprocessor (in this setup, REPP and token mapping
;;; rules are bypassed).
Expand Down
4 changes: 2 additions & 2 deletions util/freeling2lkb.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
from tokenize_and_tag import Freeling_tok_tagger
from tokenize_and_tag import Freeling_tok_tagger, PATH_TO_SPPP_DAT
from srg_freeling2yy import convert_sentences
import parse_sppp_dat


if __name__ == "__main__":
fuse, replace, no_disambiguate, output = parse_sppp_dat.parse_sppp('~/delphin/SRG/grammar/srg/util/freeling_api/srg-freeling.dat')
fuse, replace, no_disambiguate, output = parse_sppp_dat.parse_sppp(PATH_TO_SPPP_DAT)
override_dicts = {'fuse': fuse, 'replace': replace, 'no_disambiguate': no_disambiguate, 'output': output}

# read input from file or standard input, one sentence per line. Put each
Expand Down
4 changes: 3 additions & 1 deletion util/tokenize_and_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from freeling_api.python_API import pyfreeling_api
import sys, os

PATH_TO_SPPP_DAT = '/home/olga/delphin/SRG/grammar/srg/util/freeling_api/srg-freeling.dat'

class Freeling_tok_tagger:
'''
NB: There are numerous ways to configure the Freeling modules (the morphological analyzer, the splitter, the tagger).
Expand All @@ -21,7 +23,7 @@ def __init__(self):

# Location of FreeLing configuration files.
self.DATA = os.environ["FREELINGDIR"]+"/share/freeling/" #usermap; currently empty
self.CUSTOM_DATA = "~/delphin/SRG/grammar/srg/util/freeling_api/srg-freeling.dat"
self.CUSTOM_DATA = PATH_TO_SPPP_DAT
# Init locales
pyfreeling_api.util_init_locale("default")
# create language detector. Used just to show it. Results are printed
Expand Down

0 comments on commit e69104b

Please sign in to comment.