|
Mac Dev Center
Mac OS X Reference Library Data Management: Strings, Text, & Fonts Latent Semantic Mapping Reference
|
LatentSemanticMapping.h |
| Includes: | <CoreFoundation/CoreFoundation.h> <CoreServices/CoreServices.h> <Carbon/Carbon.h> <stdio.h> <stdint.h> |
Semantic Mapping This framework classifies texts based on latent semantic information.
LSMMapAddCategory |
LSMCategory LSMMapAddCategory( LSMMapRef mapref);
Adds another category and returns its category identifier.
LSMMapAddText |
OSStatus LSMMapAddText( LSMMapRef mapref, LSMTextRef textref, LSMCategory category);
Adds a training text to the given category. The textref is no longer needed after this call.
LSMMapAddTextWithWeight |
OSStatus LSMMapAddTextWithWeight( LSMMapRef mapref, LSMTextRef textref, LSMCategory category, float weight);
Adds a training text to the given category with a weight different from 1. The weight may be negative, but global counts will be pinned to 0. The textref is no longer needed after this call.
LSMMapApplyClusters |
OSStatus LSMMapApplyClusters( LSMMapRef mapref, CFArrayRef clusters);
Group categories or words (tokens) into the specified sets of clusters.
LSMMapCompile |
OSStatus LSMMapCompile( LSMMapRef mapref);
Compiles the map into executable form and puts it into mapping mode, preparing it for the classification of texts. This function is computationally expensive.
LSMMapCreate |
LSMMapRef LSMMapCreate( CFAllocatorRef alloc, CFOptionFlags flags);
Creates a new LSM map. Call CFRelease to dispose.
LSMMapCreateClusters |
CFArrayRef LSMMapCreateClusters( CFAllocatorRef alloc, LSMMapRef mapref, CFArrayRef subset, CFIndex numClusters, CFOptionFlags flags);
Compute a set of clusters grouping similar categories or words. If subset is non-NULL, only perform clustering on the categories or words listed.
LSMMapCreateFromURL |
LSMMapRef LSMMapCreateFromURL( CFAllocatorRef alloc, CFURLRef file, CFOptionFlags flags);
Loads a map from a given file.
LSMMapGetCategoryCount |
CFIndex LSMMapGetCategoryCount( LSMMapRef mapref);
Returns the number of categories in the map.
LSMMapGetProperties |
CFDictionaryRef LSMMapGetProperties( LSMMapRef mapref);
Get a dictionary of properties for the map. LSM retains ownership of this dictionary, do not release it.
LSMMapGetTypeID |
CFTypeID LSMMapGetTypeID( void);
Returns the Core Foundation type identifier for LSM maps.
LSMMapSetProperties |
void LSMMapSetProperties( LSMMapRef mapref, CFDictionaryRef properties);
Set a dictionary of properties for the map. LSM makes its own copy of the properties, there's no need to retain them past this call.
LSMMapSetStopWords |
OSStatus LSMMapSetStopWords( LSMMapRef mapref, LSMTextRef textref);
The specified words will be omitted from all classification efforts. Needs to be called before any other texts are created. The textref is no longer needed after this call.
LSMMapStartTraining |
OSStatus LSMMapStartTraining( LSMMapRef mapref);
Puts the map into training mode, preparing it for the addition of more categories and/or texts. This function will be somewhat expensive, as it requires substantial data structure reorganization.
LSMMapWriteToStream |
OSStatus LSMMapWriteToStream( LSMMapRef mapref, LSMTextRef textref, CFWriteStreamRef stream, CFOptionFlags options);
Writes information about a map and/or text to a stream in text form
LSMMapWriteToURL |
OSStatus LSMMapWriteToURL( LSMMapRef mapref, CFURLRef file, CFOptionFlags flags);
Compiles the map if necessary and then stores it into the given file.
LSMResultCopyToken |
CFDataRef LSMResultCopyToken( LSMResultRef mapref, CFIndex n);
Returns the token for the n-th best (zero based) result.
LSMResultCopyTokenCluster |
CFArrayRef LSMResultCopyTokenCluster( LSMResultRef mapref, CFIndex n);
Returns the cluster of tokens for the n-th best (zero based) result.
LSMResultCopyWord |
CFStringRef LSMResultCopyWord( LSMResultRef result, CFIndex n);
Returns the word for the n-th best (zero based) result.
LSMResultCopyWordCluster |
CFArrayRef LSMResultCopyWordCluster( LSMResultRef result, CFIndex n);
Returns the cluster of words for the n-th best (zero based) result.
LSMResultCreate |
LSMResultRef LSMResultCreate( CFAllocatorRef alloc, LSMMapRef mapref, LSMTextRef textref, CFIndex numResults, CFOptionFlags flags);
Returns, in decreasing order of likelihood, the categories or words that best match when a text is mapped into a map.
LSMResultGetCategory |
LSMCategory LSMResultGetCategory( LSMResultRef result, CFIndex n);
Returns the category of the n-th best (zero based) result.
LSMResultGetCount |
CFIndex LSMResultGetCount( LSMResultRef result);
Returns the number of results.
LSMResultGetScore |
float LSMResultGetScore( LSMResultRef result, CFIndex n);
Returns the likelihood of the n-th best (zero based) result.
LSMResultGetTypeID |
CFTypeID LSMResultGetTypeID( void);
Returns the Core Foundation type identifier for LSM results.
LSMTextAddToken |
OSStatus LSMTextAddToken( LSMTextRef textref, CFDataRef token);
Adds an arbitrary binary token to the text. The order of tokens is significant if the map uses pairs or triplets, and the count of tokens is always significant.
LSMTextAddWord |
OSStatus LSMTextAddWord( LSMTextRef textref, CFStringRef word);
Adds a word to the text. The order of words is significant if the map uses pairs or triplets, and the count of words is always significant.
LSMTextAddWords |
OSStatus LSMTextAddWords( LSMTextRef textref, CFStringRef words, CFLocaleRef locale, CFOptionFlags flags);
Breaks a string into words using the locale provided and adds the words to the text.
LSMTextCreate |
LSMTextRef LSMTextCreate( CFAllocatorRef alloc, LSMMapRef mapref);
Creates a new text.
LSMTextGetTypeID |
CFTypeID LSMTextGetTypeID( void);
Returns the Core Foundation type identifier for LSM texts.
LSMCategory |
typedef uint32_t LSMCategory;
An integral type representing a category.
LSMMapRef |
typedef struct __LSMMap * LSMMapRef;
An opaque Core Foundation type representing an LSM map (mutable).
LSMResult |
typedef struct __LSMResult * LSMResultRef;
An opaque Core Foundation type representing the result of a lookup (immutable).
LSMResultRef |
typedef struct __LSMResult * LSMResultRef;
An opaque Core Foundation type representing the result of a lookup (immutable).
LSMTextRef |
typedef struct __LSMText * LSMTextRef;
An opaque Core Foundation type representing an input text (mutable).
Error codes |
enum { kLSMMapOutOfState = -6640, kLSMMapNoSuchCategory = -6641, kLSMMapWriteError = -6642, kLSMMapBadPath = -6643, kLSMMapBadCluster = -6644 };
kLSMMapOutOfStateThis call cannot be issued in this map state
kLSMMapNoSuchCategoryInvalid category specified
kLSMMapWriteErrorAn error occurred writing the map
kLSMMapBadPathThe URL you specified does not exist
kLSMMapBadClusterThe clusters you specified are invalid
Errors returned from LSM routines
Map Flags |
enum { kLSMMapPairs = 1, kLSMMapTriplets = 2, kLSMMapHashText = 256 };
kLSMMapPairsUse pairs in addition to single words.
kLSMMapTripletsUse triplets and pairs in addition to single words.
kLSMMapHashTextTransform the text so it's not trivially human readable. Disables creation of language models.
Options that can be specified for LSMMapCreate. These options can improve mapping accuracy, at a potentially significant increase in memory use.
Parsing Flags |
enum { kLSMTextPreserveCase = 1, kLSMTextPreserveAcronyms = 2, kLSMTextApplySpamHeuristics = 4 };
kLSMTextPreserveAcronymsDon't map all uppercase words to lowercase.
kLSMTextPreserveCaseDon't change any words to lowercase.
kLSMTextApplySpamHeuristicsTry to find words in hostile text.
Options you can specify for LSMTextAddWords.
Result Flags |
enum { kLSMResultBestWords = 1, };
kLSMResultBestWordsFind the words, rather than categories, that best match.
Options for LSMResultCreate.
Storage Flags |
enum { kLSMMapDiscardCounts = 1, kLSMMapLoadMutable = 2 };
kLSMMapDiscardCountsDon't keep counts. If specified on loading, the map needs to be reloaded without this option before calling LSMStartTraining. If specified on storing, the stored map can't be retrained at all. This option can save a lot of memory and/or disk space.
kLSMMapLoadMutableLoad map as mutable in training state.
kLSMMapHashText(Defined above) If specified on storing, will hash the map if it hasn't been hashed yet.
Options for LSMMap{CreateFrom,WriteTo}URL.
kLSMAlgorithmDense |
#define kLSMAlgorithmDense CFSTR("LSMAlgorithmDense")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMAlgorithmKey |
#define kLSMAlgorithmKey CFSTR("LSMAlgorithm")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMAlgorithmSparse |
#define kLSMAlgorithmSparse CFSTR("LSMAlgorithmSparse")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMDimensionKey |
#define kLSMDimensionKey CFSTR("LSMDimension")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMIterationsKey |
#define kLSMIterationsKey CFSTR("LSMIterations")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMPrecisionDouble |
#define kLSMPrecisionDouble CFSTR("LSMPrecisionDouble")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMPrecisionFloat |
#define kLSMPrecisionFloat CFSTR("LSMPrecisionFloat")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMPrecisionKey |
#define kLSMPrecisionKey CFSTR("LSMPrecision")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMSweepAgeKey |
#define kLSMSweepAgeKey CFSTR("LSMSweepAge")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
kLSMSweepCutoffKey |
#define kLSMSweepCutoffKey CFSTR("LSMSweepCutoff")
A CFDictionary of arbitrary properties may be associated. with an LSM map. The following keys currently are interpreted by LSM, and all other keys starting with LSM... are reserved.
Last Updated: 2009-04-17