Mac OS 9
LanguageAnalysis.h
Go to the documentation of this file.
1 
19 #ifndef __LANGUAGEANALYSIS__
20 #define __LANGUAGEANALYSIS__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __FILES__
27 #include <Files.h>
28 #endif
29 
30 #ifndef __AEREGISTRY__
31 #include <AERegistry.h>
32 #endif
33 
34 #ifndef __DICTIONARY__
35 #include <Dictionary.h>
36 #endif
37 
38 #ifndef __TEXTCOMMON__
39 #include <TextCommon.h>
40 #endif
41 
42 #ifndef __MACERRORS__
43 #include <MacErrors.h>
44 #endif
45 
46 #if PRAGMA_ONCE
47 #pragma once
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55 #if PRAGMA_IMPORT
56 #pragma import on
57 #endif
58 
59 #if PRAGMA_STRUCT_ALIGN
60 #pragma options align = power
61 #elif PRAGMA_STRUCT_PACKPUSH
62 #pragma pack(push, 2)
63 #elif PRAGMA_STRUCT_PACK
64 #pragma pack(2)
65 #endif
66 
67  typedef struct OpaqueLAEnvironmentRef *LAEnvironmentRef;
68  typedef struct OpaqueLAContextRef *LAContextRef;
69  typedef AEKeyword LAPropertyKey;
70  typedef DescType LAPropertyType;
75  {
76  ByteCount sourceTextLength;
77  LogicalAddress sourceTextPtr;
78  ByteCount morphemeTextLength;
79  LogicalAddress morphemeTextPtr;
80  UInt32 partOfSpeech;
81  };
82  typedef struct LAMorphemeRec LAMorphemeRec;
84  {
85  ItemCount morphemesCount;
86  ByteCount processedTextLength;
87  ByteCount morphemesTextLength;
88  LAMorphemeRec morphemes[1];
89  };
90  typedef struct LAMorphemesArray LAMorphemesArray;
92  enum
93  {
94  kLAMorphemesArrayVersion = 0
95  };
96 
101  typedef AERecord LAMorphemePath;
102  typedef AERecord LAMorpheme;
103  typedef AERecord LAHomograph;
104  enum
105  {
106  keyAELAMorphemeBundle = FOUR_CHAR_CODE('lmfb'),
107  keyAELAMorphemePath = FOUR_CHAR_CODE('lmfp'),
108  keyAELAMorpheme = FOUR_CHAR_CODE('lmfn'),
109  keyAELAHomograph = FOUR_CHAR_CODE('lmfh')
110  };
111 
112  enum
113  {
114  typeLAMorphemeBundle = typeAERecord,
115  typeLAMorphemePath = typeAERecord,
116  typeLAMorpheme = typeAEList,
117  typeLAHomograph = typeAEList
118  };
119 
123  enum
124  {
125  keyAEMorphemePartOfSpeechCode = FOUR_CHAR_CODE('lamc'),
126  keyAEMorphemeTextRange = FOUR_CHAR_CODE('lamt')
127  };
128 
129  enum
130  {
131  typeAEMorphemePartOfSpeechCode = FOUR_CHAR_CODE('lamc'),
132  typeAEMorphemeTextRange = FOUR_CHAR_CODE('lamt')
133  };
134 
135  typedef UInt32 MorphemePartOfSpeech;
137  {
138  UInt32 sourceOffset;
139  UInt32 length;
140  };
141  typedef struct MorphemeTextRange MorphemeTextRange;
145  enum
146  {
147  kLAEndOfSourceTextMask = 0x00000001
148  };
149 
153  enum
154  {
155  kLADefaultEdge = 0,
156  kLAFreeEdge = 1,
157  kLAIncompleteEdge = 2
158  };
159 
163  enum
164  {
165  kLAAllMorphemes = 0
166  };
167 
179  UInt32
181 
193  OSStatus
194  LATextToMorphemes(LAContextRef context, TextEncoding preferedEncoding,
195  ByteCount textLength, ConstLogicalAddress sourceText,
196  ByteCount bufferSize, OptionBits convertFlags,
197  UInt32 structureVersion, ByteCount *acceptedLength,
198  LAMorphemesArrayPtr resultBuffer);
199 
211  OSStatus
212  LAOpenAnalysisContext(LAEnvironmentRef environ, LAContextRef *context);
213 
222  OSStatus
223  LACloseAnalysisContext(LAContextRef context);
224 
236  OSStatus
237  LAGetEnvironmentList(UInt32 maxCount, UInt32 *actualCount,
238  LAEnvironmentRef environmentList[]);
239 
248  OSStatus
249  LAGetEnvironmentName(LAEnvironmentRef environment, Str63 environmentName);
250 
259  OSStatus
260  LAGetEnvironmentRef(ConstStr63Param targetEnvironmentName,
261  LAEnvironmentRef *environment);
262 
271  OSStatus
272  LACreateCustomEnvironment(LAEnvironmentRef baseEnvironment,
273  ConstStr63Param newEnvironmentName,
274  Boolean persistent, LAEnvironmentRef *newEnvironment);
275 
284  OSStatus
285  LADeleteCustomEnvironment(LAEnvironmentRef environment);
286 
298  OSStatus
299  LAOpenDictionary(LAEnvironmentRef environ, const FSSpec *dictionary);
300 
309  OSStatus
310  LACloseDictionary(LAEnvironmentRef environ, const FSSpec *dictionary);
311 
320  OSStatus
321  LAListAvailableDictionaries(LAEnvironmentRef environ, ItemCount maxCount,
322  ItemCount *actualCount, FSSpec dictionaryList[],
323  Boolean opened[]);
324 
333  OSStatus
334  LAAddNewWord(LAEnvironmentRef environ, const FSSpec *dictionary,
335  const AEDesc *dataList);
336 
348  OSStatus
349  LAMorphemeAnalysis(LAContextRef context, ConstUniCharArrayPtr text,
350  UniCharCount textLength, LAMorphemePath *leadingPath,
351  LAMorphemePath *trailingPath, ItemCount pathCount,
352  LAMorphemeBundle *result);
353 
362  OSStatus
363  LAContinuousMorphemeAnalysis(LAContextRef context, ConstUniCharArrayPtr text,
364  UniCharCount textLength, Boolean incrementalText,
365  LAMorphemePath *leadingPath,
366  LAMorphemePath *trailingPath, Boolean *modified);
367 
376  OSStatus
377  LAGetMorphemes(LAContextRef context, LAMorphemePath *result);
378 
387  OSStatus
388  LAShiftMorphemes(LAContextRef context, ItemCount morphemeCount,
389  LAMorphemePath *path, UniCharCount *shiftedLength);
390 
399  OSStatus
400  LAResetAnalysis(LAContextRef context);
401 
405 #if TARGET_RT_MAC_CFM
406 #ifdef __cplusplus
407  inline pascal Boolean LALanguageAnalysisAvailable()
408  {
409  return (LALibraryVersion != (void *)kUnresolvedCFragSymbolAddress);
410  }
411 #else
412 #define LALanguageAnalysisAvailable() ((LALibraryVersion != (void*)kUnresolvedCFragSymbolAddress)
413 #endif
414 #elif TARGET_RT_MAC_MACHO
415 /* Language Analysis Manager is always available on OS X */
416 #ifdef __cplusplus
417 inline pascal Boolean LALanguageAnalysisAvailable() { return true; }
418 #else
419 #define LALanguageAnalysisAvailable() (true)
420 #endif
421 #endif /* */
422 
431 #define kLAJapaneseKanaKanjiEnvironment "\pKanaKanjiConversion"
432 #define kLAJapaneseMorphemeAnalysisEnvironment "\pJapaneseMorphemeAnalysis"
433 #define kLAJapaneseTTSEnvironment "\pJapaneseTextToSpeech"
437  enum
438  {
439  kAppleJapaneseDictionarySignature = FOUR_CHAR_CODE('jlan')
440  };
441 
445  enum
446  {
447  kMaxInputLengthOfAppleJapaneseEngine = 200
448  };
449 
454  typedef MorphemePartOfSpeech JapanesePartOfSpeech;
455  typedef UInt16 HomographWeight;
456  typedef UInt8 HomographAccent;
460  enum
461  {
462  keyAEHomographDicInfo = FOUR_CHAR_CODE('lahd'),
463  keyAEHomographWeight = FOUR_CHAR_CODE('lahw'),
464  keyAEHomographAccent = FOUR_CHAR_CODE('laha')
465  };
466 
467  enum
468  {
469  typeAEHomographDicInfo = FOUR_CHAR_CODE('lahd'),
470  typeAEHomographWeight = typeShortInteger,
471  typeAEHomographAccent = FOUR_CHAR_CODE('laha')
472  };
473 
478  {
479  DCMDictionaryID dictionaryID;
480  DCMUniqueID uniqueID;
481  };
491  enum
492  {
493  kLASpeechRoughClassMask = 0x0000F000,
494  kLASpeechMediumClassMask = 0x0000FF00,
495  kLASpeechStrictClassMask = 0x0000FFF0,
496  kLASpeechKatsuyouMask = 0x0000000F
497  };
498 
502  enum
503  {
504  kLASpeechMeishi = 0x00000000, /* noun */
505  kLASpeechFutsuuMeishi = 0x00000000, /* general noun */
506  kLASpeechJinmei = 0x00000100, /* person name */
507  kLASpeechJinmeiSei = 0x00000110, /* family name */
508  kLASpeechJinmeiMei = 0x00000120, /* first name */
509  kLASpeechChimei = 0x00000200, /* place name */
510  kLASpeechSetsubiChimei = 0x00000210, /* place name with suffix */
511  kLASpeechSoshikimei = 0x00000300, /* organization name */
512  kLASpeechKoyuuMeishi = 0x00000400, /* proper noun */
513  kLASpeechSahenMeishi = 0x00000500, /* special noun */
514  kLASpeechKeidouMeishi = 0x00000600, /* special noun */
515  kLASpeechRentaishi = 0x00001000,
516  kLASpeechFukushi = 0x00002000, /* adverb */
517  kLASpeechSetsuzokushi = 0x00003000, /* conjunction */
518  kLASpeechKandoushi = 0x00004000,
519  kLASpeechDoushi = 0x00005000, /* verb */
520  kLASpeechGodanDoushi = 0x00005000,
521  kLASpeechKagyouGodan = 0x00005000,
522  kLASpeechSagyouGodan = 0x00005010,
523  kLASpeechTagyouGodan = 0x00005020,
524  kLASpeechNagyouGodan = 0x00005030,
525  kLASpeechMagyouGodan = 0x00005040,
526  kLASpeechRagyouGodan = 0x00005050,
527  kLASpeechWagyouGodan = 0x00005060,
528  kLASpeechGagyouGodan = 0x00005070,
529  kLASpeechBagyouGodan = 0x00005080,
530  kLASpeechIchidanDoushi = 0x00005100,
531  kLASpeechKahenDoushi = 0x00005200,
532  kLASpeechSahenDoushi = 0x00005300,
533  kLASpeechZahenDoushi = 0x00005400,
534  kLASpeechKeiyoushi = 0x00006000, /* adjective */
535  kLASpeechKeiyoudoushi = 0x00007000,
536  kLASpeechSettougo = 0x00008000, /* prefix*/
537  kLASpeechSuujiSettougo = 0x00008100, /* prefix for numbers */
538  kLASpeechSetsubigo = 0x00009000, /* suffix */
539  kLASpeechJinmeiSetsubigo = 0x00009100, /* suffix for person name */
540  kLASpeechChimeiSetsubigo = 0x00009200, /* suffix for place name */
541  kLASpeechSoshikimeiSetsubigo = 0x00009300, /* suffix for organization name */
542  kLASpeechSuujiSetsubigo = 0x00009400, /* suffix for numbers */
543  kLASpeechMuhinshi = 0x0000A000, /* no category */
544  kLASpeechTankanji = 0x0000A000, /* character */
545  kLASpeechKigou = 0x0000A100, /* symbol */
546  kLASpeechKuten = 0x0000A110,
547  kLASpeechTouten = 0x0000A120,
548  kLASpeechSuushi = 0x0000A200, /* numbers */
549  kLASpeechDokuritsugo = 0x0000A300,
550  kLASpeechSeiku = 0x0000A400,
551  kLASpeechJodoushi = 0x0000B000, /* auxiliary verb */
552  kLASpeechJoshi = 0x0000C000 /* postpositional particle */
553  };
554 
558  enum
559  {
560  kLASpeechKatsuyouGokan = 0x00000001, /* stem */
561  kLASpeechKatsuyouMizen = 0x00000002,
562  kLASpeechKatsuyouRenyou = 0x00000003,
563  kLASpeechKatsuyouSyuushi = 0x00000004,
564  kLASpeechKatsuyouRentai = 0x00000005,
565  kLASpeechKatsuyouKatei = 0x00000006,
566  kLASpeechKatsuyouMeirei = 0x00000007
567  };
568 
569 #if PRAGMA_STRUCT_ALIGN
570 #pragma options align = reset
571 #elif PRAGMA_STRUCT_PACKPUSH
572 #pragma pack(pop)
573 #elif PRAGMA_STRUCT_PACK
574 #pragma pack()
575 #endif
576 
577 #ifdef PRAGMA_IMPORT_OFF
578 #pragma import off
579 #elif PRAGMA_IMPORT
580 #pragma import reset
581 #endif
582 
583 #ifdef __cplusplus
584 }
585 #endif
586 
587 #endif /* __LANGUAGEANALYSIS__ */
ResType DescType
Definition: AEDataModel.h:165
AppleEvents Registry Interface.
Dictionary Manager Interfaces.
File Manager (MFS, HFS, and HFS+) Interfaces.
OSStatus LAGetMorphemes(LAContextRef context, LAMorphemePath *result)
OSStatus LATextToMorphemes(LAContextRef context, TextEncoding preferedEncoding, ByteCount textLength, ConstLogicalAddress sourceText, ByteCount bufferSize, OptionBits convertFlags, UInt32 structureVersion, ByteCount *acceptedLength, LAMorphemesArrayPtr resultBuffer)
OSStatus LAAddNewWord(LAEnvironmentRef environ, const FSSpec *dictionary, const AEDesc *dataList)
OSStatus LAOpenAnalysisContext(LAEnvironmentRef environ, LAContextRef *context)
OSStatus LAResetAnalysis(LAContextRef context)
OSStatus LAShiftMorphemes(LAContextRef context, ItemCount morphemeCount, LAMorphemePath *path, UniCharCount *shiftedLength)
OSStatus LAGetEnvironmentList(UInt32 maxCount, UInt32 *actualCount, LAEnvironmentRef environmentList[])
OSStatus LAGetEnvironmentRef(ConstStr63Param targetEnvironmentName, LAEnvironmentRef *environment)
OSStatus LAListAvailableDictionaries(LAEnvironmentRef environ, ItemCount maxCount, ItemCount *actualCount, FSSpec dictionaryList[], Boolean opened[])
OSStatus LADeleteCustomEnvironment(LAEnvironmentRef environment)
OSStatus LAContinuousMorphemeAnalysis(LAContextRef context, ConstUniCharArrayPtr text, UniCharCount textLength, Boolean incrementalText, LAMorphemePath *leadingPath, LAMorphemePath *trailingPath, Boolean *modified)
OSStatus LAGetEnvironmentName(LAEnvironmentRef environment, Str63 environmentName)
OSStatus LAMorphemeAnalysis(LAContextRef context, ConstUniCharArrayPtr text, UniCharCount textLength, LAMorphemePath *leadingPath, LAMorphemePath *trailingPath, ItemCount pathCount, LAMorphemeBundle *result)
OSStatus LACreateCustomEnvironment(LAEnvironmentRef baseEnvironment, ConstStr63Param newEnvironmentName, Boolean persistent, LAEnvironmentRef *newEnvironment)
OSStatus LAOpenDictionary(LAEnvironmentRef environ, const FSSpec *dictionary)
OSStatus LACloseAnalysisContext(LAContextRef context)
AERecord LAMorphemeBundle
Definition: LanguageAnalysis.h:100
UInt32 LALibraryVersion(void)
MorphemePartOfSpeech JapanesePartOfSpeech
Definition: LanguageAnalysis.h:454
OSStatus LACloseDictionary(LAEnvironmentRef environ, const FSSpec *dictionary)
OSErr codes.
Basic Macintosh data types.
unsigned char Boolean
Definition: MacTypes.h:318
TextEncoding-related types and constants, and prototypes for related functions.
Definition: AEDataModel.h:175
Definition: LanguageAnalysis.h:478
Definition: LanguageAnalysis.h:75
Definition: LanguageAnalysis.h:84
Definition: LanguageAnalysis.h:137