Rename package into Nazca and change imports
authorVincent Michel <vincent.michel@logilab.fr>
Mon, 26 Nov 2012 11:11:29 +0100
changeset 166 441ae8072c5c
parent 165 f629a9bd4120
child 167 826ef17747ea
Rename package into Nazca and change imports
aligner.py
demo.py
distances.py
doc.rst
matrix.py
minhashing.py
test/test_alignment.py
--- a/aligner.py	Mon Nov 26 11:00:59 2012 +0100
+++ b/aligner.py	Mon Nov 26 11:11:29 2012 +0100
@@ -19,9 +19,9 @@
 from scipy.spatial import KDTree
 from scipy.sparse import lil_matrix
 
-from alignment.minhashing import Minlsh
-from alignment.dataio import write_results
-import alignment.matrix as m
+from nazca.minhashing import Minlsh
+from nazca.dataio import write_results
+import nazca.matrix as m
 
 
 def normalize_set(rset, treatments):
--- a/demo.py	Mon Nov 26 11:00:59 2012 +0100
+++ b/demo.py	Mon Nov 26 11:11:29 2012 +0100
@@ -5,10 +5,10 @@
 
 import urllib
 
-import alignment.distances as ald
-import alignment.normalize as aln
-from alignment.aligner import align, subalign, findneighbours, alignall
-from alignment.dataio import parsefile, sparqlquery, write_results
+import nazca.distances as ald
+import nazca.normalize as aln
+from nazca.aligner import align, subalign, findneighbours, alignall
+from nazca.dataio import parsefile, sparqlquery, write_results
 
 DEMODIR = path.dirname(__file__)
 
@@ -110,25 +110,6 @@
     #    otherwise
     print "Done, see the results in %s" % dpath('demo1_results')
 
-#def parsefile(filepath, transforms):
-#    pass
-#
-#
-#parsefile('fr.txt', {0: int, 1: lambda x: x.decode('utf-8'), 14: float, 12:
-#                     float}, indexes=[0, 2, (14, 12)])
-#
-#
-#def make_index_transformer(indexes, transform_map):
-#    def xxx(row):
-#        data = [transform_map[i](row[i]) for in indexes]
-#        return data
-#    return xxx
-#
-#
-#
-#parsefile('fr.txt', line_transformer=make_index_transformer)
-#
-#
 def demo_2():
     targetset = parsefile(dpath('FR.txt'), indexes=[0, 1, (4, 5)],
                           formatopt={1:lambda x:x.decode('utf-8')})
--- a/distances.py	Mon Nov 26 11:00:59 2012 +0100
+++ b/distances.py	Mon Nov 26 11:11:29 2012 +0100
@@ -20,7 +20,7 @@
 
 from scipy import matrix
 
-from alignment.normalize import tokenize
+from nazca.normalize import tokenize
 
 
 ### UTILITY FUNCTIONS #########################################################
--- a/doc.rst	Mon Nov 26 11:00:59 2012 +0100
+++ b/doc.rst	Mon Nov 26 11:11:29 2012 +0100
@@ -38,7 +38,7 @@
 Now, we have to compute the similarity between each items. For that purpose, the
 `Levenshtein distance <http://en.wikipedia.org/wiki/Levenshtein_distance>`_
 [#]_, which is well accurate to compute the distance between few words, is used.
-Such a function is provided in the ``alignment.distance`` module.
+Such a function is provided in the ``nazca.distance`` module.
 
 .. [#] Also called the *edit distance*, because the distance between two words
        is equal to the number of single-character edits required to change one
@@ -82,7 +82,7 @@
 In such a case, two distance functions are used, the Levenshtein one for the
 name and the city and a temporal one for the birth date [#]_.
 
-.. [#] Provided in the ``alignment.distance`` module.
+.. [#] Provided in the ``nazca.distance`` module.
 
 
 We obtain the three following matrices:
@@ -156,10 +156,10 @@
 
 .. code-block:: python
 
-    from alignment import dataio as aldio #Functions for input and output data
-    from alignment import distance as ald #Functions to compute the distances
-    from alignment import normalize as aln#Functions to normalize data
-    from alignment import aligner as ala  #Functions to align data
+    from nazca import dataio as aldio #Functions for input and output data
+    from nazca import distance as ald #Functions to compute the distances
+    from nazca import normalize as aln#Functions to normalize data
+    from nazca import aligner as ala  #Functions to align data
 
 The Goncourt prize
 ^^^^^^^^^^^^^^^^^^
--- a/matrix.py	Mon Nov 26 11:00:59 2012 +0100
+++ b/matrix.py	Mon Nov 26 11:11:29 2012 +0100
@@ -19,7 +19,7 @@
 
 from scipy import empty
 
-import alignment.distances as ds
+import nazca.distances as ds
 
 METRICS = {'euclidean': ds.euclidean, 'levenshtein': ds.levenshtein,
            'soundex': ds.soundex, 'jaccard': ds.jaccard,
--- a/minhashing.py	Mon Nov 26 11:00:59 2012 +0100
+++ b/minhashing.py	Mon Nov 26 11:11:29 2012 +0100
@@ -23,7 +23,7 @@
 import numpy as np
 from scipy.optimize import bisect
 
-from alignment.normalize import iter_wordgrams
+from nazca.normalize import iter_wordgrams
 
 
 def randomhashfunction(zr):
--- a/test/test_alignment.py	Mon Nov 26 11:00:59 2012 +0100
+++ b/test/test_alignment.py	Mon Nov 26 11:11:29 2012 +0100
@@ -16,29 +16,6 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 
-"""cubicweb-alignment automatic tests
-
-
-uncomment code below if you want to activate automatic test for your cube:
-
-.. sourcecode:: python
-
-    from cubicweb.devtools.testlib import AutomaticWebTest
-
-    class AutomaticWebTest(AutomaticWebTest):
-        '''provides `to_test_etypes` and/or `list_startup_views` implementation
-        to limit test scope
-        '''
-
-        def to_test_etypes(self):
-            '''only test views for entities of the returned types'''
-            return set(('My', 'Cube', 'Entity', 'Types'))
-
-        def list_startup_views(self):
-            '''only test startup views of the returned identifiers'''
-            return ('some', 'startup', 'views')
-"""
-
 import unittest2
 import random
 random.seed(6) ### Make sure tests are repeatable
@@ -47,15 +24,15 @@
 from os import path
 from dateutil import parser as dateparser
 
-from alignment.distances import (levenshtein, soundex, soundexcode,   \
+from nazca.distances import (levenshtein, soundex, soundexcode,   \
                                  jaccard, temporal, euclidean,        \
                                  geographical)
-from alignment.normalize import (lunormalize, loadlemmas, lemmatized, \
+from nazca.normalize import (lunormalize, loadlemmas, lemmatized, \
                                  roundstr, rgxformat, tokenize, simplify)
-import alignment.matrix as am
-from alignment.minhashing import Minlsh
-from alignment.dataio import parsefile, autocasted
-import alignment.aligner as alig
+import nazca.matrix as am
+from nazca.minhashing import Minlsh
+from nazca.dataio import parsefile, autocasted
+import nazca.aligner as alig
 
 
 TESTDIR = path.dirname(__file__)