Mac Developer Library

Developer

LatentSemanticMapping.h Reference

Options
Deployment Target:

On This Page
Language:

LatentSemanticMapping.h Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import LatentSemanticMapping

Objective-C

@import LatentSemanticMapping;

Semantic Mapping This framework classifies texts based on latent semantic information.

Included Headers

  • <CoreFoundation/CoreFoundation.h>

  • <CoreServices/CoreServices.h>

  • <Carbon/Carbon.h>

  • <stdio.h>

  • <stdint.h>

Functions

  • Declaration

    Swift

    func LSMMapAddCategory(_ mapref: LSMMap!) -> LSMCategory

    Objective-C

    LSMCategory LSMMapAddCategory ( LSMMapRef mapref );

    Discussion

    Adds another category and returns its category identifier.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapAddText(_ mapref: LSMMap!, _ textref: LSMText!, _ category: LSMCategory) -> OSStatus

    Objective-C

    OSStatus LSMMapAddText ( LSMMapRef mapref, LSMTextRef textref, LSMCategory category );

    Discussion

    Adds a training text to the given category. The textref is no longer needed after this call.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapAddTextWithWeight(_ mapref: LSMMap!, _ textref: LSMText!, _ category: LSMCategory, _ weight: Float) -> OSStatus

    Objective-C

    OSStatus LSMMapAddTextWithWeight ( LSMMapRef mapref, LSMTextRef textref, LSMCategory category, float weight );

    Discussion

    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.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapApplyClusters(_ mapref: LSMMap!, _ clusters: CFArray!) -> OSStatus

    Objective-C

    OSStatus LSMMapApplyClusters ( LSMMapRef mapref, CFArrayRef clusters );

    Discussion

    Group categories or words (tokens) into the specified sets of clusters.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapCompile(_ mapref: LSMMap!) -> OSStatus

    Objective-C

    OSStatus LSMMapCompile ( LSMMapRef mapref );

    Discussion

    Compiles the map into executable form and puts it into mapping mode, preparing it for the classification of texts. This function is computationally expensive.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapCreate(_ alloc: CFAllocator!, _ flags: CFOptionFlags) -> Unmanaged<LSMMap>!

    Objective-C

    LSMMapRef LSMMapCreate ( CFAllocatorRef alloc, CFOptionFlags flags );

    Discussion

    Creates a new LSM map. Call CFRelease to dispose.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapCreateClusters(_ alloc: CFAllocator!, _ mapref: LSMMap!, _ subset: CFArray!, _ numClusters: CFIndex, _ flags: CFOptionFlags) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef LSMMapCreateClusters ( CFAllocatorRef alloc, LSMMapRef mapref, CFArrayRef subset, CFIndex numClusters, CFOptionFlags flags );

    Discussion

    Compute a set of clusters grouping similar categories or words. If subset is non-NULL, only perform clustering on the categories or words listed.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapCreateFromURL(_ alloc: CFAllocator!, _ file: CFURL!, _ flags: CFOptionFlags) -> Unmanaged<LSMMap>!

    Objective-C

    LSMMapRef LSMMapCreateFromURL ( CFAllocatorRef alloc, CFURLRef file, CFOptionFlags flags );

    Discussion

    Loads a map from a given file.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapGetCategoryCount(_ mapref: LSMMap!) -> CFIndex

    Objective-C

    CFIndex LSMMapGetCategoryCount ( LSMMapRef mapref );

    Discussion

    Returns the number of categories in the map.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapGetProperties(_ mapref: LSMMap!) -> Unmanaged<CFDictionary>!

    Objective-C

    CFDictionaryRef LSMMapGetProperties ( LSMMapRef mapref );

    Discussion

    Get a dictionary of properties for the map. LSM retains ownership of this dictionary, do not release it.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID LSMMapGetTypeID ( void );

    Discussion

    Returns the Core Foundation type identifier for LSM maps.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapSetProperties(_ mapref: LSMMap!, _ properties: CFDictionary!)

    Objective-C

    void LSMMapSetProperties ( LSMMapRef mapref, CFDictionaryRef properties );

    Discussion

    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.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapSetStopWords(_ mapref: LSMMap!, _ textref: LSMText!) -> OSStatus

    Objective-C

    OSStatus LSMMapSetStopWords ( LSMMapRef mapref, LSMTextRef textref );

    Discussion

    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.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapStartTraining(_ mapref: LSMMap!) -> OSStatus

    Objective-C

    OSStatus LSMMapStartTraining ( LSMMapRef mapref );

    Discussion

    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.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapWriteToStream(_ mapref: LSMMap!, _ textref: LSMText!, _ stream: CFWriteStream!, _ options: CFOptionFlags) -> OSStatus

    Objective-C

    OSStatus LSMMapWriteToStream ( LSMMapRef mapref, LSMTextRef textref, CFWriteStreamRef stream, CFOptionFlags options );

    Discussion

    Writes information about a map and/or text to a stream in text form

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMMapWriteToURL(_ mapref: LSMMap!, _ file: CFURL!, _ flags: CFOptionFlags) -> OSStatus

    Objective-C

    OSStatus LSMMapWriteToURL ( LSMMapRef mapref, CFURLRef file, CFOptionFlags flags );

    Discussion

    Compiles the map if necessary and then stores it into the given file.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultCopyToken(_ mapref: LSMResult!, _ n: CFIndex) -> Unmanaged<CFData>!

    Objective-C

    CFDataRef LSMResultCopyToken ( LSMResultRef mapref, CFIndex n );

    Discussion

    Returns the token for the n-th best (zero based) result.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultCopyTokenCluster(_ mapref: LSMResult!, _ n: CFIndex) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef LSMResultCopyTokenCluster ( LSMResultRef mapref, CFIndex n );

    Discussion

    Returns the cluster of tokens for the n-th best (zero based) result.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultCopyWord(_ result: LSMResult!, _ n: CFIndex) -> Unmanaged<CFString>!

    Objective-C

    CFStringRef LSMResultCopyWord ( LSMResultRef result, CFIndex n );

    Discussion

    Returns the word for the n-th best (zero based) result.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultCopyWordCluster(_ result: LSMResult!, _ n: CFIndex) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef LSMResultCopyWordCluster ( LSMResultRef result, CFIndex n );

    Discussion

    Returns the cluster of words for the n-th best (zero based) result.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultCreate(_ alloc: CFAllocator!, _ mapref: LSMMap!, _ textref: LSMText!, _ numResults: CFIndex, _ flags: CFOptionFlags) -> Unmanaged<LSMResult>!

    Objective-C

    LSMResultRef LSMResultCreate ( CFAllocatorRef alloc, LSMMapRef mapref, LSMTextRef textref, CFIndex numResults, CFOptionFlags flags );

    Discussion

    Returns, in decreasing order of likelihood, the categories or words that best match when a text is mapped into a map.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultGetCategory(_ result: LSMResult!, _ n: CFIndex) -> LSMCategory

    Objective-C

    LSMCategory LSMResultGetCategory ( LSMResultRef result, CFIndex n );

    Discussion

    Returns the category of the n-th best (zero based) result.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultGetCount(_ result: LSMResult!) -> CFIndex

    Objective-C

    CFIndex LSMResultGetCount ( LSMResultRef result );

    Discussion

    Returns the number of results.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultGetScore(_ result: LSMResult!, _ n: CFIndex) -> Float

    Objective-C

    float LSMResultGetScore ( LSMResultRef result, CFIndex n );

    Discussion

    Returns the likelihood of the n-th best (zero based) result. A nan score often indicates that the category does not contain any token.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMResultGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID LSMResultGetTypeID ( void );

    Discussion

    Returns the Core Foundation type identifier for LSM results.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMTextAddToken(_ textref: LSMText!, _ token: CFData!) -> OSStatus

    Objective-C

    OSStatus LSMTextAddToken ( LSMTextRef textref, CFDataRef token );

    Discussion

    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.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMTextAddWord(_ textref: LSMText!, _ word: CFString!) -> OSStatus

    Objective-C

    OSStatus LSMTextAddWord ( LSMTextRef textref, CFStringRef word );

    Discussion

    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.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMTextAddWords(_ textref: LSMText!, _ words: CFString!, _ locale: CFLocale!, _ flags: CFOptionFlags) -> OSStatus

    Objective-C

    OSStatus LSMTextAddWords ( LSMTextRef textref, CFStringRef words, CFLocaleRef locale, CFOptionFlags flags );

    Discussion

    Breaks a string into words using the locale provided and adds the words to the text.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMTextCreate(_ alloc: CFAllocator!, _ mapref: LSMMap!) -> Unmanaged<LSMText>!

    Objective-C

    LSMTextRef LSMTextCreate ( CFAllocatorRef alloc, LSMMapRef mapref );

    Discussion

    Creates a new text.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Swift

    func LSMTextGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID LSMTextGetTypeID ( void );

    Discussion

    Returns the Core Foundation type identifier for LSM texts.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Swift

    import LatentSemanticMapping

    Availability

    Available in OS X v10.5 and later.

Data Types

See the Overview for header-level documentation.

  • Declaration

    Objective-C

    typedef uint32_t LSMCategory;

    Discussion

    An integral type representing a category.

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Objective-C

    typedef struct __LSMMap * LSMMapRef;

    Discussion

    An opaque Core Foundation type representing an LSM map (mutable).

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Objective-C

    typedef struct __LSMResult * LSMResultRef;

    Discussion

    An opaque Core Foundation type representing the result of a lookup (immutable).

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Objective-C

    typedef struct __LSMResult * LSMResultRef;

    Discussion

    An opaque Core Foundation type representing the result of a lookup (immutable).

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Availability

    Available in OS X v10.5 and later.

  • Declaration

    Objective-C

    typedef struct __LSMText * LSMTextRef;

    Discussion

    An opaque Core Foundation type representing an input text (mutable).

    Import Statement

    Objective-C

    @import LatentSemanticMapping;

    Availability

    Available in OS X v10.5 and later.

Constants

See the Overview for header-level documentation.

  • Declaration

    Objective-C

    #define kLSMAlgorithmDense CFSTR("LSMAlgorithmDense") #define kLSMAlgorithmKey CFSTR("LSMAlgorithm") #define kLSMAlgorithmSparse CFSTR("LSMAlgorithmSparse") #define kLSMDimensionKey CFSTR("LSMDimension") #define kLSMIterationsKey CFSTR("LSMIterations") #define kLSMPrecisionDouble CFSTR("LSMPrecisionDouble") #define kLSMPrecisionFloat CFSTR("LSMPrecisionFloat") #define kLSMPrecisionKey CFSTR("LSMPrecision") #define kLSMSweepAgeKey CFSTR("LSMSweepAge") #define kLSMSweepCutoffKey CFSTR("LSMSweepCutoff")

    Constants

    • kLSMAlgorithmDense

      kLSMAlgorithmDense

      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.

      Available in OS X v10.5 and later.

    • kLSMAlgorithmKey

      kLSMAlgorithmKey

      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.

      Available in OS X v10.5 and later.

    • kLSMAlgorithmSparse

      kLSMAlgorithmSparse

      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.

      Available in OS X v10.5 and later.

    • kLSMDimensionKey

      kLSMDimensionKey

      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.

      Available in OS X v10.5 and later.

    • kLSMIterationsKey

      kLSMIterationsKey

      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.

      Available in OS X v10.5 and later.

    • kLSMPrecisionDouble

      kLSMPrecisionDouble

      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.

      Available in OS X v10.5 and later.

    • kLSMPrecisionFloat

      kLSMPrecisionFloat

      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.

      Available in OS X v10.5 and later.

    • kLSMPrecisionKey

      kLSMPrecisionKey

      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.

      Available in OS X v10.5 and later.

    • kLSMSweepAgeKey

      kLSMSweepAgeKey

      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.

      Available in OS X v10.5 and later.

    • kLSMSweepCutoffKey

      kLSMSweepCutoffKey

      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.

      Available in OS X v10.5 and later.

  • Declaration

    Objective-C

    enum { kLSMMapOutOfState = -6640, kLSMMapNoSuchCategory = -6641, kLSMMapWriteError = -6642, kLSMMapBadPath = -6643, kLSMMapBadCluster = -6644, kLSMMapOverflow = -6645 };

    Constants

    • kLSMMapOutOfState

      kLSMMapOutOfState

      This call cannot be issued in this map state

      Available in OS X v10.5 and later.

    • kLSMMapNoSuchCategory

      kLSMMapNoSuchCategory

      Invalid category specified

      Available in OS X v10.5 and later.

    • kLSMMapWriteError

      kLSMMapWriteError

      An error occurred writing the map

      Available in OS X v10.5 and later.

    • kLSMMapBadPath

      kLSMMapBadPath

      The URL you specified does not exist

      Available in OS X v10.5 and later.

    • kLSMMapBadCluster

      kLSMMapBadCluster

      The clusters you specified are invalid

      Available in OS X v10.5 and later.

    • kLSMMapOverflow

      kLSMMapOverflow

      Cannot add more data to map

      Available in OS X v10.7 and later.

    Discussion

    Errors returned from LSM routines

  • Declaration

    Objective-C

    enum { kLSMMapPairs = 1, kLSMMapTriplets = 2, kLSMMapHashText = 256 };

    Constants

    • kLSMMapPairs

      kLSMMapPairs

      Use pairs in addition to single words.

      Available in OS X v10.5 and later.

    • kLSMMapTriplets

      kLSMMapTriplets

      Use triplets and pairs in addition to single words.

      Available in OS X v10.5 and later.

    • kLSMMapHashText

      kLSMMapHashText

      Transform the text so it's not trivially human readable. Disables creation of language models.

      Available in OS X v10.5 and later.

    Discussion

    Options that can be specified for LSMMapCreate. These options can improve mapping accuracy, at a potentially significant increase in memory use.

  • Declaration

    Objective-C

    enum { kLSMTextPreserveCase = 1, kLSMTextPreserveAcronyms = 2, kLSMTextApplySpamHeuristics = 4 };

    Constants

    • kLSMTextPreserveAcronyms

      kLSMTextPreserveAcronyms

      Don't map all uppercase words to lowercase.

      Available in OS X v10.5 and later.

    • kLSMTextPreserveCase

      kLSMTextPreserveCase

      Don't change any words to lowercase.

      Available in OS X v10.5 and later.

    • kLSMTextApplySpamHeuristics

      kLSMTextApplySpamHeuristics

      Try to find words in hostile text.

      Available in OS X v10.5 and later.

    Discussion

    Options you can specify for LSMTextAddWords.

  • Declaration

    Objective-C

    enum { kLSMResultBestWords = 1, };

    Constants

    • kLSMResultBestWords

      kLSMResultBestWords

      Find the words, rather than categories, that best match.

      Available in OS X v10.5 and later.

    Discussion

    Options for LSMResultCreate.

  • Declaration

    Objective-C

    enum { kLSMMapDiscardCounts = 1, kLSMMapLoadMutable = 2, };

    Constants

    • kLSMMapDiscardCounts

      kLSMMapDiscardCounts

      Don'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.

      Available in OS X v10.5 and later.

    • kLSMMapLoadMutable

      kLSMMapLoadMutable

      Load map as mutable in training state.

      Available in OS X v10.5 and later.

    • kLSMMapHashText

      kLSMMapHashText

      (Defined above) If specified on storing, will hash the map if it hasn't been hashed yet.

      Available in OS X v10.5 and later.

    Discussion

    Options for LSMMap{CreateFrom,WriteTo}URL.