Skip to content

LkbMacintosh

JohnCarroll edited this page Aug 4, 2017 · 30 revisions

Running the LKB on MacOS

Currently (August 2017) there is a new, native version of the LKB for macOS, which looks and behaves similarly to the long-established version developed in Allegro CL. At present, the code is very fluid, so the changes to the LKB source code required for this version have not yet been committed to the central code repository. Until that happens, you can download a binary for macOS, lkb_macos.tgz. See the following sections for installation and usage instructions.

An alternative approach is to run a Linux or Windows version of the LKB in a virtual machine. You can install Windows on the Mac using Parallels Desktop. This will let you run a virtual Windows machine in a window on your running macOS system. Then you can install the Windows binary of LKB into Parallels. This seems to work well. One caveat is that the virtual Windows machine will want to allocate its own chunk of memory when it is started, in order to emulate physical memory for Windows. You can control how much memory you want it to take; note that you will need substantially more physical memory than you allocate to the virtual machine.

LKB MacOS Version

The macOS version of the LKB uses X Windows graphics, which requires XQuartz. If you don't already have this application, download it from https://www.xquartz.org and install it. Then follow the 'Manual Installation' instructions on the LkbInstallation page. The file lkb_macos.tgz contains an LKB precompiled binary, lkb.command. You can run this binary by typing its name in the Terminal application or in an xterm hosted by XQuartz. Alternatively, you can just double-click it.

There is built-in support for the Linguistic User Interface (LUI): see the LkbLui pages for information on installing and using the LUI. Type (lui-initialize) and (lui-shutdown) to enable and disable it, respectively. Unfortunately the current macOS version of the LUI has usability problems; to mitigate some of these, the LKB overrides the LUI's phrase structure tree display facilities.

Features and Enhancements

Porting the LKB to macOS has provided an opportunity to make some improvements to the LKB code base. In addition, the use of a different underlying Lisp system (SBCL with McCLIM rather than Allegro CL and its native CLIM implementation) gives advantages in the areas of efficiency, multilingual support, and visual appearance. Moreover, SBCL and McCLIM are open source, which means that this version of the LKB will be completely open source when it is fully released. Improved features include:

  • Dialogs: these have been reimplemented to improve their appearance, and a user-friendly file selector dialog has been added.
  • Parser local ambiguity packing: this was previously turned off by default, resulting in even moderately long or ambiguous sentences over-running the chart edge limit. A couple of minor packing/unpacking issues have been resolved and packing is now turned on by default.
  • Multilingual support: SBCL has excellent support for Unicode and McCLIM works well for Unicode output, so the LKB can work with grammars using any language script.

Experienced LKB users might notice further refinements:

  • Aesthetic window placement, using intelligent cascading.
  • Responsive window resizing (file selector dialogs and parse tree windows reformat their contents when they are resized).
  • More informative window titles.
  • Info line in tree windows, showing details of the currently selected tree or tree node.
  • More intelligent defaults for view commands.
  • Much faster type hierarchy and chart window display.

Practical Hints and Tips

Text fields in dialogs do not respond to mouse or trackpad gestures (clicking / dragging), but expect keyboard commands using the arrow keys, backspace key and standard emacs key bindings. Useful commands in this context are:

Ctrl-space: set mark
Alt-B / Alt-F: go backwards / forwards one word
Alt-Backspace / Alt-D: delete previous / next word

In addition, the following commands access the macOS clipboard:

Ctrl-C: copy to clipboard the text between cursor and mark
Ctrl-X: cut to clipboard the text between cursor and mark
Ctrl-V: paste from clipboard at cursor
Ctrl-Z: undo the last change

The LKB can output characters in any Unicode font. However, there is no font substitution: all characters to be displayed have to be in the (single) selected font. For input, at present there is no way to switch keyboard layouts or select input methods. A workaround is to copy the text to the clipboard and then paste it into the parse dialog. The GeFaqUnicodeInput page suggests further workarounds.

Suitable Unicode fonts for output are DejaVu Sans (attractive, and covering many scripts), Code2000 (less attractive, but with even better coverage), or WenQuanYi Zen Hei (reasonably attractive, with full CJK coverage). These are not standard macOS fonts, so you will have to download them yourself and install them - a suitable location on your machine is /opt/X11/share/fonts/TTF/. Once installed, you can use the following Unix command to select DejaVu Sans:

cat > ~/.fonts.conf <<!
<?xml version="1.0"?>
<fontconfig>
 <dir>/opt/X11/share/fonts/TTF</dir>
 <alias>
 <family>sans-serif</family>
 <prefer>
 <family>DejaVu Sans</family>
 <family>Code2000</family>
 <family>WenQuanYi Zen Hei</family>
 </prefer>
 </alias>
</fontconfig>
!

You can verify that DejaVu Sans is selected by running the Unix command

fc-match Sans:

The output of this command should be

DejaVuSans.ttf: "DejaVu Sans" "Book"

You can then start up the LKB and it will use this font. Note that if you want to input or output non-ASCII characters, you should make sure you are using a Unicode locale such as en_US.UTF-8.

Problems

Unanticipated errors may cause the LKB graphical interface to become unresponsive. This is because the underlying Lisp system is expecting the user to enter the debugger for that thread. To enter the debugger, execute (sb-thread::release-foreground) at the Lisp prompt. You can then type backtrace to inspect the context of the error, and Ctrl-D to kill the thread. The interface should then start responding again.

If you encounter problems using the macOS LKB, please email the support address for the LKB (and other LinGO resources): [email protected].

Clone this wiki locally