jump Index ScientificPsychic.com
Scientific Psychic

Derivational Morphology Dictionary Interface

The DICTGET components in the English Dictionary package contain a derivational morphology dictionary "engmorph.dct" that may be accessed through AZMORPH.DLL. The programs and dictionaries can be used free for research and individual use. Commercial use requires licensing through A. Zamora (Please use the e-mail address listed in the HOME PAGE). Commercial licenses may include consultation and maintenance.

The description below shows how to use the dynamic load library AZMORPH.DLL from Visual Basic. The derivational morphology dictionary contains only lemmas, and consequently, a lemma is required as input. A lemma of a word may be obtained through the AZDICT.DLL paradigm interface.

'=== AZMORPH.DLL
/* * * * * * * * * * * * * * * * * * * * * */
/* * Initialize dictionary, allocate dynamic areas * * * * * */
int dminit(char * cb, char * dicname) {
/* cb is a 100-byte control block */
/* dicname is the dictionary path name (63-byte maximum) */
/* dminit returns 0 for normal completion, >0 otherwise */

/* * * * * * * * * * * * * * * * * * * * * */
/* * Look-up word in dictionary  * * * * * */
int dmlook(char * cb, char * word, char * result) {
/* cb is the control block */
/* word is the word to be looked-up */
/* result is the data returned for the input word. */
/* The result may be a null string, or it may require up to 1000 bytes.*/
/* dmlook returns 1 if found, 0 otherwise */

/* * * * * * * * * * * * * * * * * * * * * */
/* * Terminate processing, free all dynamic areas * * * * */
int dmterm(char * cb) {
/* cb is the control block */
/* dmterm returns 0 for normal execution, >0 otherwise */


' === VB Morphology interface
' dminit initializes dictionary
Declare Function dminit Lib "azmorph" _
  (ByRef p1 As Byte, _
  ByVal p2 As String) As Integer

' dmlook does dictionary look-up
Declare Function dmlook Lib "azmorph" _
  (ByRef p1 As Byte, _
  ByVal p2 As String, _
  ByVal p3 As String) As Integer

' dmterm closes dictionary and frees dynamic areas
Declare Function dmterm Lib "azmorph" _
  (ByRef p1 As Byte) As Integer

Dim CBM(100) As Byte

 swm = 0
 ' Morphology dict
 dictname = App.Path & "\engmorph.dct"
 rc = dminit(CBM(1), dictname)
 If rc <> 0 Then
  'MsgBox "Cannot open " & dictname
  cmdMorph.Enabled = False
 Else
  swm = 1
 End If

 morout = String(1000, " ") ' allocate 1000-byte area for output
 rc = dmlook(CBM(1), wrd, morout)
 If rc > 0 Then
  'Text2.Text = "Word matched"
  wd = ""
  For i = 1 To Len(morout)
   c1 = Mid(morout, i, 1)
   'MsgBox ("cmdMorph c1=" & Hex(Asc(c1)))
   If Asc(c1) = 0 Then 'null terminator
    List1.AddItem wd
    Exit For
   End If
   If c1 = " " Then
    List1.AddItem wd
    wd = ""
   Else
    wd = wd & c1
   End If
  Next i
 Else
  List1.AddItem "No match"
 End If
 morout = ""

 ' Morphology dict
 If swm = 1 Then
  rc = dmterm(CBM(1))
  swm = 0
 End If


© Copyright  - Antonio Zamora