[PyObjC-svn] r2158 - in trunk/pyobjc/pyobjc-framework-LatentSemanticMapping: . Doc Examples PyObjCTest

[email protected]
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Mon Apr 13 05:12:20 2009
New Revision: 2158

Log:
* Remove 'Examples', we don't have example code for this framework
* Add an api-notes document, this tells that the framework is completely
  wrapped but that the unittests fail due to lack of good documentation on
  how to use the API.
* Disable most of the tests, they cause crashes that seem to be related
  to incorrect usage of the API of this framework. Apple's documentation
  doesn't help in this regard, I haven't been able to work out how to
  correctly use the framework.
* Update version to 2.2b2


Added:
   trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/Doc/
   trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/Doc/api-notes-LatentSemanticMapping.txt
Removed:
   trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/Examples/
Modified:
   trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/   (props changed)
   trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/PyObjCTest/test_latentsemanticmapping.py
   trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/setup.py

Modified: trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/PyObjCTest/test_latentsemanticmapping.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/PyObjCTest/test_latentsemanticmapping.py	(original)
+++ trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/PyObjCTest/test_latentsemanticmapping.py	Mon Apr 13 05:12:20 2009
@@ -79,6 +79,7 @@
         v = LSMMapGetCategoryCount(map)
         self.failUnlessIsInstance(v, (int, long))
 
+        self.failUnlessResultIsCFRetained(LSMTextCreate)
         text = LSMTextCreate(None, map)
         self.failUnlessIsInstance(text, LSMTextRef)
         text2 = LSMTextCreate(None, map)
@@ -86,9 +87,9 @@
         words = LSMTextCreate(None, map)
         self.failUnlessIsInstance(words, LSMTextRef)
 
-        v = LSMTextAddWord(words, "hello")
+        v = LSMTextAddWord(words, "the")
         self.failUnlessIsInstance(v, (int, long))
-        v = LSMTextAddWord(words, "world")
+        v = LSMTextAddWord(words, "and")
         self.failUnlessIsInstance(v, (int, long))
 
         v = LSMTextAddWords(text, "the world goes on and on",
@@ -104,6 +105,14 @@
         v = LSMMapAddText(map, text, cat)
         self.failUnlessIsInstance(v, (int, long))
 
+        fn = __file__
+        fn = os.path.splitext(fn)[0] + ".py"
+        for line in open(fn, 'rb'):
+            t = LSMTextCreate(None, map)
+            LSMTextAddWords(t, line, CFLocaleCopyCurrent(), 0)
+            LSMMapAddText(map, t, cat)
+
+
         v = LSMMapAddTextWithWeight(map, text2, cat2, 2.0)
         self.failUnlessIsInstance(v, (int, long))
 
@@ -115,17 +124,29 @@
         v = LSMTextAddWords(text3, "foo the bar and worlds away",
                 CFLocaleCopyCurrent(), 0)
 
-        v = LSMMapCreateClusters(None, map, None, 2, 0)
-        self.failUnlessIsInstance(v, CFArrayRef)
+        if 0:
+            self.failUnlessResultIsCFRetained(LSMMapCreateClusters)
+            clusters = LSMMapCreateClusters(None, map, None, 3,  0)
+            self.failUnlessIsInstance(clusters, CFArrayRef)
 
-        v = LSMMapApplyClusters(map, v);
-        self.failUnlessIsInstance(v, (int, long))
+            v = LSMMapApplyClusters(map, clusters);
+            self.failUnlessIsInstance(clusters, (int, long))
+
+        v = LSMMapStartTraining(map)
 
         mytext = LSMTextCreate(None, map)
-        v = LSMTextAddWords(text, "the world goes on and on",
+        v = LSMTextAddWords(mytext, "the world goes on and on",
                                 CFLocaleCopyCurrent(), 0)
         self.failUnlessIsInstance(v, (int, long))
 
+        v = LSMMapCompile(map)
+
+        # FIXME: Tests crash, probably due to misuse of the
+        # APIs. I haven't found usable API docs for this
+        # framework :-(
+        return
+
+        self.failUnlessResultIsCFRetained(LSMResultCreate)
         res = LSMResultCreate(None, map, mytext, 2, 0)
         self.failUnlessIsInstance(res, LSMResultRef)
 
@@ -133,24 +154,35 @@
         self.failUnlessIsInstance(v, (int, long))
         self.failUnless(v)
 
+
         v = LSMResultGetCategory(res, 0)
         self.failUnlessIsInstance(v, (int, long))
 
         v = LSMResultGetScore(res, 0)
         self.failUnlessIsInstance(v, float)
 
+
+        self.failUnlessResultIsCFRetained(LSMResultCopyWord)
         v = LSMResultCopyWord(res, 0)
         self.failUnlessIsInstance(v, unicode)
 
+        self.failUnlessResultIsCFRetained(LSMResultCopyToken)
         v = LSMResultCopyToken(res, 0)
         self.failUnlessIsInstance(v, CFDataRef)
 
-        v = LSMTextAddToken(text, v)
+        v = LSMMapStartTraining(map)
+        mytext = LSMTextCreate(None, map)
+
+
+
+        v = LSMTextAddToken(mytext, v)
         self.failUnlessIsInstance(v, (int, long))
 
+        self.failUnlessResultIsCFRetained(LSMResultCopyWordCluster)
         v = LSMResultCopyWordCluster(res, 0)
         self.failUnlessIsInstance(v, CFArrayRef)
 
+        self.failUnlessResultIsCFRetained(LSMResultCopyTokenCluster)
         v = LSMResultCopyTokenCluster(res, 0)
         self.failUnlessIsInstance(v, CFArrayRef)
 
@@ -160,6 +192,7 @@
         v = LSMMapWriteToURL(map, url, 0)
         self.failUnlessIsInstance(v, (int, long))
 
+        self.failUnlessResultIsCFRetained(LSMMapCreateFromURL)
         map2 = LSMMapCreateFromURL(None, url, 0)
         self.failUnlessIsInstance(map2, LSMMapRef)
 

Modified: trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/setup.py
==============================================================================
--- trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/setup.py	(original)
+++ trunk/pyobjc/pyobjc-framework-LatentSemanticMapping/setup.py	Mon Apr 13 05:12:20 2009
@@ -18,7 +18,7 @@
 
 setup(
     name='pyobjc-framework-LatentSemanticMapping',
-    version='2.2b1',
+    version='2.2b2',
     description = "Wrappers for the framework LatentSemanticMapping on Mac OS X",
     long_description = __doc__,
     author='Ronald Oussoren',

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.