{"id":6125,"library":"pyobjc-framework-latentsemanticmapping","title":"PyObjC Framework: LatentSemanticMapping","description":"This library provides Python wrappers for Apple's LatentSemanticMapping framework on macOS, enabling Python applications to leverage latent semantic analysis capabilities for tasks like text similarity and natural language processing. It is part of the larger PyObjC project, currently at version 12.1, with releases typically tied to macOS SDK updates and Python version support cycles.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","pyobjc","framework","apple","nlp"],"install":[{"cmd":"pip install pyobjc-framework-latentsemanticmapping","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides the core PyObjC bridge functionality necessary for all framework wrappers.","package":"pyobjc-core"}],"imports":[{"symbol":"LSMLanguageModel","correct":"from LatentSemanticMapping import LSMLanguageModel"},{"symbol":"LSMSentence","correct":"from LatentSemanticMapping import LSMSentence"}],"quickstart":{"code":"from LatentSemanticMapping import LSMSentence\nimport objc\n\n# Instantiate a simple sentence object using the framework\nsentence_string = \"The quick brown fox jumps over the lazy dog.\"\nsentence = LSMSentence.sentenceWithString_(sentence_string)\n\nprint(f\"Created LSMSentence object: {sentence}\")\nprint(f\"Content: {sentence.string()}\")\n\n# You would typically use this with an LSMLanguageModel for semantic analysis\n# (e.g., LSMLanguageModel.languageModelForLocale_options_error_)\n# which requires specific setup (e.g., locale, options, or training data).","lang":"python","description":"This quickstart demonstrates how to import and instantiate a basic object from the LatentSemanticMapping framework using PyObjC."},"warnings":[{"fix":"Upgrade your Python interpreter to a supported version (e.g., Python 3.10+ for PyObjC 12.x) or use an older PyObjC version that supports your Python environment.","message":"PyObjC major versions frequently drop support for older Python versions. For example, v12.0 dropped Python 3.9 support, and v11.0 dropped Python 3.8. Ensure your Python environment meets the `requires_python` constraint for your PyObjC version.","severity":"breaking","affected_versions":"11.0, 12.0+"},{"fix":"Review any code that explicitly manages references to objects returned by `init` methods or that relies on specific reference counts for `self` within `init`-like methods. Adjust memory management logic if necessary.","message":"PyObjC 11.1 aligned its Automatic Reference Counting (ARC) behavior for initializer methods with `clang`'s documentation. Methods in the 'init' family now correctly steal a reference to `self` and return a new reference. This is a fundamental change in reference counting semantics that could affect custom memory management or interaction with Objective-C objects.","severity":"breaking","affected_versions":"11.1+"},{"fix":"Thoroughly test multi-threaded PyObjC applications on Python 3.13. If encountering issues, consider using an earlier Python version or isolating PyObjC calls to a single thread until free-threading support matures.","message":"PyObjC 11.0 introduced experimental support for free-threading (PEP 703) in Python 3.13, requiring significant internal changes related to C Python API usage and borrowed references. While experimental, this could introduce subtle bugs or performance issues in multi-threaded applications using PyObjC with Python 3.13.","severity":"gotcha","affected_versions":"11.0+"},{"fix":"If you override `__new__` in a PyObjC-bridged class, ensure your `__init__` correctly handles object initialization, and be aware that `__init__` will not be called if you rely on PyObjC's default `__new__` for new instances.","message":"PyObjC 10.3 temporarily broke the ability to use `__init__` in Python subclasses when a user-defined `__new__` method was present. This was partially reverted in 10.3.1: `__init__` can now be used if a user-implemented `__new__` exists, but not if relying on PyObjC's default `__new__`.","severity":"gotcha","affected_versions":"10.3, 10.3.1+"},{"fix":"If KVO on Python-defined `NSProxy` subclasses is critical, you may need to implement custom observation mechanisms or reconsider your class design to avoid `NSProxy` for observable objects.","message":"Starting with PyObjC 12.1, Key-Value Observing (KVO) usage is automatically disabled for subclasses of `NSProxy` defined in Python. If your application relies on KVO notifications for changes in properties of such `NSProxy` subclasses, they will no longer be triggered.","severity":"gotcha","affected_versions":"12.1+"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}