Since it was released in 1988, the AMPLE program has been used for morphological analysis in many different languages. It has always functioned as a batch processing program, which is useful for production work such as analyzing an entire book, but is less useful during the early stages of developing a morphological description. The LinguaLinks AMPLE DLL has therefore been developed with the goal of making it possible to embed AMPLE style morphological parsing into LinguaLinks.
The LinguaLinks AMPLE DLL is built with the AMPLE function library. See section `Introduction' in AMPLE Function Library Reference Manual. For maximum usefulness, it is a Win32 DLL, not a Win16 (Microsoft Windows 3.x) DLL. It is compiled for an 80386 or better CPU, and is compatible with Microsoft Windows NT, Windows 95, and `WIN32S.DLL' for Windows 3.x.
This manual, and the DLL it documents, are still being revised.
The LinguaLinks AMPLE DLL functions all return a character string. This string contains either a value dependent on the function or an error message. The arguments to these functions, which vary in number from zero to four, are also all character strings.
(This is, of course, subject to negotiation and change.)
DllExport char * AmpleAddSelectiveAnalysisMorphs( const char * pszMorphs_in)
AmpleAddSelectiveAnalysisMorphs
adds one or more morphnames to
the existing list of morphnames for selective analysis. It may be
called once or more than once to build up the list of morphnames.
AmpleAddSelectiveAnalysisMorphs
is an alternative to
AmpleSetParameter(
"SelectiveAnalysisFile",
filename)
. It erases any filename stored for the
SelectiveAnalysisFile
parameter, but does not erase any
morphnames already in the list for selective analysis.
2.0.3 Return Value a string indicating success or failure
2.0.4 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC1)(const char *); ... HANDLE hAmpleLib; AMPLEFUNC1 pfAmpleAddSelectiveAnalysisMorphs; char * pszResult; ... char szNewEntry[] = "\ \\m mateo\n\ \\t root\n\ \\c N0\n\ \\a mateo {Matthew_1}\n\ \\a mateu {Matthew_2}\n\ \\a matei {Matthew_3}\n\ "; hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleAddSelectiveAnalysisMorphs = (AMPLEFUNC1)GetProcAddress(hAmpleLib, "AmpleAddSelectiveAnalysisMorphs"); if (pfAmpleAddSelectiveAnalysisMorphs == NULL) { MessageBox(0, "Cannot find AmpleAddSelectiveAnalysisMorphs in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleAddSelectiveAnalysisMorphs != NULL) { pszResult = (*pfAmpleAddSelectiveAnalysisMorphs)(szNewEntry); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleAddSelectiveAnalysisMorphs = NULL; ... } ...
`llample.c'
DllExport char * AmpleGetParameter( const char * pszName_in)
AmpleGetParameter
retrieves the value of a LinguaLinks AMPLE DLL
parameter (global variable). The following parameter names are
recognized.
AppendLogFile
BeginComment
DebugAllomorphConds
DebugLevel
LogFile
MaxMorphnameLength
MaxTrieDepth
OutputStyle
AmpleParseFile
. The
possible values are Ana
(for the normal standard output analysis
file), AResult
(for SGML output similar to that produced by
AmpleParseText
), and Ptext
(for SGML output according to
the `ptext.dtd' document type definition). (Ptext
is not
yet implemented.)
The default style is Ana
.
RootGlosses
SelectiveAnalysisFile
TraceAnalysis
Note that the parameter names are not case sensitive, even though they are shown here in a mixture of uppercase and lowercase.
a string indicating the parameter value, or an error message
2.0.9 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC1)(const char *); ... HANDLE hAmpleLib; AMPLEFUNC1 pfAmpleGetParameter; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleGetParameter = (AMPLEFUNC1)GetProcAddress(hAmpleLib, "AmpleGetParameter"); if (pfAmpleGetParameter == NULL) { MessageBox(0, "Cannot find AmpleGetParameter in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleGetParameter != NULL) { pszResult = (*pfAmpleGetParameter)("MaxTrieDepth"); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleGetParameter = NULL; ... } ...
`llample.c'
DllExport char * AmpleLoadControlFiles( const char * pszAnalysisDataFile_in, const char * pszDictCodeTable_in, const char * pszDictOrthoChangeTable_in, const char * pszTextInputControlFile_in)
AmpleLoadControlFiles
loads the indicated control files into
memory.
2.0.13 Return Value a string indicating success or failure
2.0.14 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC4)(const char *, const char *, const char *, const char *); ... HANDLE hAmpleLib; AMPLEFUNC4 pfAmpleLoadControlFiles; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleLoadControlFiles = (AMPLEFUNC4)GetProcAddress(hAmpleLib, "AmpleLoadControlFiles"); if (pfAmpleLoadControlFiles == NULL) { MessageBox(0, "Cannot find AmpleLoadControlFiles in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleLoadControlFiles != NULL) { pszResult = (*pfAmpleLoadControlFiles)("D:/HG/HGAD01.CTL", "D:/HG/HGANCD.TAB", NULL, "D:/HG/HGINTX.CTL"); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleLoadControlFiles = NULL; ... } ...
`llample.c'
DllExport char * AmpleLoadDictionary( const char * pszFilePath_in)
AmpleLoadDictionary
loads the indicated (unified) AMPLE
dictionary file into memory.
2.0.18 Return Value a string indicating success or failure
2.0.19 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC1)(const char *); ... HANDLE hAmpleLib; AMPLEFUNC1 pfAmpleLoadDictionary; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleLoadDictionary = (AMPLEFUNC1)GetProcAddress( hAmpleLib, "AmpleLoadDictionary"); if (pfAmpleLoadDictionary == NULL) { MessageBox(0, "Cannot find AmpleLoadDictionary in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleLoadDictionary != NULL) { pszResult = (*pfAmpleLoadDictionary)("D:/HG/HGMORPH.DIC"); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleLoadDictionary = NULL; ... } ...
`llample.c'
DllExport char * AmpleParseFile( const char * pszInFilePath_in, const char * pszOutFilePath_in)
AmpleParseFile
parses an input text file, producing an output
analysis file.
2.0.23 Return Value a string indicating success or failure
2.0.24 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC2)(const char *, const char *); ... HANDLE hAmpleLib; AMPLEFUNC2 pfAmpleParseFile; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleParseFile = (AMPLEFUNC2)GetProcAddress(hAmpleLib, "AmpleParseFile"); if (pfAmpleParseFile == NULL) { MessageBox(0, "Cannot find AmpleParseFile in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleParseFile != NULL) { pszResult = (*pfAmpleParseFile)("D:/HG/HGMT05.TXT", "D:/HG/HGMT05.SGM"); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleParseFile = NULL; ... } ...
`llample.c'
DllExport char * AmpleParseText( const char * pszInputText_in)
AmpleParseText
parses the words in the input string. If the
string contains only one word, then that word is parsed, obviating the
need for a separate AmpleParseWord
function.
The parse output follows the simple SGML style format given by the following document type definition. (The parse output is not quite SGML because it does not begin with a DOCTYPE declaration and it does not quote attribute values even when needed.)
<!ELEMENT AResult - - ((error | parse)*) > <!ELEMENT error - - (#PCDATA) > <!ATTLIST error code (analysisFailure | rootFailure) #REQUIRED > <!ELEMENT parse - - (analysis*) > <!ATTLIST parse id CDATA #REQUIRED > <!ELEMENT analysis - - (morph*) > <!ATTLIST analysis cat CDATA #REQUIRED > <!ELEMENT morph - O EMPTY > <!ATTLIST morph id CDATA #REQUIRED allo CDATA #REQUIRED >
a string containing either the parse output or an error message
2.0.29 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC1)(const char *); ... HANDLE hAmpleLib; AMPLEFUNC1 pfAmpleParseText; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleParseText = (AMPLEFUNC1)GetProcAddress(hAmpleLib, "AmpleParseText"); if (pfAmpleParseText == NULL) { MessageBox(0, "Cannot find AmpleParseText in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleParseText != NULL) { pszResult = (*pfAmpleParseText)( "Chayta rikar loomaman wicharkur hamakuykuran yachachinanpaq."); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleParseText = NULL; ... } ...
`llample.c'
DllExport char * AmpleRemoveSelectiveAnalysisMorphs()
AmpleRemoveSelectiveAnalysisMorphs
erases any existing list of
morphnames for selective analysis. It also erases any filename stored
for the SelectiveAnalysisFile
parameter.
2.0.33 Return Value a string indicating success or failure
2.0.34 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC0)(void); ... HANDLE hAmpleLib; AMPLEFUNC0 pfAmpleRemoveSelectiveAnalysisMorphs; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleRemoveSelectiveAnalysisMorphs = (AMPLEFUNC0)GetProcAddress(hAmpleLib, "AmpleRemoveSelectiveAnalysisMorphs"); if (pfAmpleRemoveSelectiveAnalysisMorphs == NULL) { MessageBox(0, "Cannot find AmpleRemoveSelectiveAnalysisMorphs in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleRemoveSelectiveAnalysisMorphs != NULL) { pszResult = (*pfAmpleRemoveSelectiveAnalysisMorphs)(); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleRemoveSelectiveAnalysisMorphs = NULL; ... } ...
`llample.c'
DllExport char * AmpleReset()
AmpleReset
removes all control and dictionary information from
memory, and restores all internal settings to their default values.
2.0.38 Return Value a string indicating success or failure
2.0.39 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC0)(void); ... HANDLE hAmpleLib; AMPLEFUNC0 pfAmpleReset; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleReset = (AMPLEFUNC0)GetProcAddress(hAmpleLib, "AmpleReset"); if (pfAmpleReset == NULL) { MessageBox(0, "Cannot find AmpleReset in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleReset != NULL) { pszResult = (*pfAmpleReset)(); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleReset = NULL; ... } ...
`llample.c'
DllExport char * AmpleSetParameter( const char * pszName_in, const char * pszValue_in)
AmpleSetParameter
sets the value of a LinguaLinks AMPLE DLL
parameter (global variable). The following parameter names are
recognized. If pszValue_in
is NULL
, the parameter is set
to its default value.
AppendLogFile
"TRUE"
(or "T"
) and
"FALSE"
(or "F"
). The default value is "FALSE"
.
BeginComment
"|"
. If the value
string does not contain any nonspace characters, then nothing can mark
comments in the input files.
DebugAllomorphConds
"TRUE"
(or "T"
) and "FALSE"
(or "F"
). The default value is "FALSE"
.
DebugLevel
"0"
.
LogFile
MaxMorphnameLength
"15"
.
MaxTrieDepth
"2"
.
OutputStyle
AmpleParseFile
. The
possible values are "Ana"
(for the normal standard output
analysis file), "AResult"
(for SGML output similar to that
produced by AmpleParseText
), and "Ptext"
for SGML output
according to the `ptext.dtd' document type definition).
The default value is "Ana"
.
RootGlosses
"TRUE"
(or "T"
) and "FALSE"
(or "F"
). The default value is "FALSE"
.
SelectiveAnalysisFile
TraceAnalysis
"OFF"
, "ON"
(for normal AMPLE
tracing), and "SGML"
(for <AmpleTrace>
tracing). The
default value is "OFF"
. Note that the trace output is written
to the log file, and may be mixed with other log output.
Note that the parameter names are not case sensitive, even though they are shown here in a mixture of uppercase and lowercase.
a string indicating success or failure
2.0.44 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC2)(const char *, const char *); ... HANDLE hAmpleLib; AMPLEFUNC2 pfAmpleSetParameter; char * pszResult; ... hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleSetParameter = (AMPLEFUNC2)GetProcAddress(hAmpleLib, "AmpleSetParameter"); if (pfAmpleSetParameter == NULL) { MessageBox(0, "Cannot find AmpleSetParameter in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleSetParameter != NULL) { pszResult = (*pfAmpleSetParameter)("MaxTrieDepth", "3"); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleSetParameter = NULL; ... } ...
`llample.c'
DllExport char * AmpleUpdateEntry( const char * pszNewEntry_in)
AmpleUpdateEntry
updates an entry in the dictionary.
The input string looks like an entry from the standard format
dictionary file. The default values for the standard format markers
are the lowercase characters for the internal codes described in the
AMPLE reference manual.
See section `Dictionary Files' in AMPLE Reference Manual.
2.0.48 Return Value a string indicating success or failure
2.0.49 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC1)(const char *); ... HANDLE hAmpleLib; AMPLEFUNC1 pfAmpleUpdateEntry; char * pszResult; ... char szNewEntry[] = "\ \\m mateo\n\ \\t root\n\ \\c N0\n\ \\a mateo {Matthew_1}\n\ \\a mateu {Matthew_2}\n\ \\a matei {Matthew_3}\n\ "; hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleUpdateEntry = (AMPLEFUNC1)GetProcAddress(hAmpleLib, "AmpleUpdateEntry"); if (pfAmpleUpdateEntry == NULL) { MessageBox(0, "Cannot find AmpleUpdateEntry in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleUpdateEntry != NULL) { pszResult = (*pfAmpleUpdateEntry)(szNewEntry); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleUpdateEntry = NULL; ... } ...
`llample.c'
DllExport char * AmpleWriteDictionary( const char * pszOutputDictionary_in)
AmpleWriteDictionary
writes the dictionary to a standard format
file. The standard format markers are based on the lowercase letters
of the internal codes described in the AMPLE reference manual.
See section Dictionary files in AMPLE Reference
Manual.
2.0.53 Return Value a string indicating success or failure
2.0.54 Example
#include <windows.h> typedef char * (CALLBACK * AMPLEFUNC1)(const char *); ... HANDLE hAmpleLib; AMPLEFUNC1 pfAmpleWriteDictionary; char * pszResult; ... char szOutputDictionary[] = "updated.dic"; hAmpleLib = LoadLibrary("LLAMPLE.DLL"); if ((unsigned long)hAmpleLib < 32) { MessageBox(0, "Error loading LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); hAmpleLib = 0; } ... if (hAmpleLib != 0) { pfAmpleWriteDictionary = (AMPLEFUNC1)GetProcAddress(hAmpleLib, "AmpleWriteDictionary"); if (pfAmpleWriteDictionary == NULL) { MessageBox(0, "Cannot find AmpleWriteDictionary in LLAMPLE.DLL", "App Name", MB_OK | MB_ICONEXCLAMATION); } } ... if (pfAmpleWriteDictionary != NULL) { pszResult = (*pfAmpleWriteDictionary)(szOutputDictionary); ... } ... if (hAmpleLib != 0) { FreeLibrary(hAmpleLib); hAmpleLib = 0; pfAmpleWriteDictionary = NULL; ... } ...
`llample.c'
The following error message strings may be returned by the LinguaLinks AMPLE DLL functions. Most of these messages should be self explanatory.
<error code=badAnalysisDataFile>Error reading the analysis data file</error>
<error code=badDictCodeTableFile>Error reading the dictionary code table file</error>
<error code=badDictEntry>Error updating the dictionary</error>
<error code=badDictOrthoChangesFile>Error reading the dictionary orthography changes table file</error>
<error code=badDictionaryFile>Error reading the dictionary file</error>
<error code=badTextInputControlFile>Error reading the text input control file</error>
<error code=fatalCrash>AMPLE DLL has crashed badly!</error>
<error code=invalidInputFilename>Cannot open file for input</error>
<error code=invalidOutputFilename>Cannot open file for output</error>
<error code=invalidParameterName>Parameter name not recognized</error>
AmpleGetParameter
or
AmpleSetParameter
.
<error code=invalidParameterValue>Bad parameter value string</error>
AmpleSetParameter
.
<error code=missingArgument>Required argument is empty</error>
<error code=none>Success</error>
This document was generated on 20 March 2003 using texi2html 1.56k.