[rename] Rename modules with shorter names, related to #187461

authorVincent Michel <vincent.michel@logilab.fr>
changeset343a4304a259
branchdefault
phasepublic
hiddenno
parent revision#102c6331f3f6 [named entities] Split core into preprocessors and filters modules, related to #187461
child revision#e04ca0af1491 [data] Move french lemmas in data module, related to #187461
files modified by this revision
data/__init__.py
data/countries.py
data/countries_iso_3166.txt
data/stopwords.py
data/us_states.py
demo.py
examples/demo.py
named_entities/__init__.py
named_entities/filters.py
named_entities/preprocessors.py
named_entities/sources.py
ner/__init__.py
ner/filters.py
ner/preprocessors.py
ner/sources.py
record_linkage/__init__.py
record_linkage/aligner.py
record_linkage/blocking.py
reference_data/__init__.py
reference_data/countries.py
reference_data/countries_iso_3166.txt
reference_data/stopwords.py
reference_data/us_states.py
rl/__init__.py
rl/aligner.py
rl/blocking.py
test/test_alignment.py
test/test_blocking.py
test/test_dataio.py
test/test_filters.py
test/test_named_entities.py
test/test_ner.py
test/test_preprocessors.py
# HG changeset patch
# User Vincent Michel <vincent.michel@logilab.fr>
# Date 1387464356 0
# Thu Dec 19 14:45:56 2013 +0000
# Node ID 343a4304a259cfb7f936a80ca208a7f0c8ea0863
# Parent 102c6331f3f607c1aa25d9359644426e2e98aadc
[rename] Rename modules with shorter names, related to #187461

diff --git a/reference_data/__init__.py b/data/__init__.py
diff --git a/reference_data/countries.py b/data/countries.py
diff --git a/reference_data/countries_iso_3166.txt b/data/countries_iso_3166.txt
diff --git a/reference_data/stopwords.py b/data/stopwords.py
diff --git a/reference_data/us_states.py b/data/us_states.py
diff --git a/demo.py b/examples/demo.py
diff --git a/named_entities/__init__.py b/ner/__init__.py
diff --git a/named_entities/filters.py b/ner/filters.py
diff --git a/named_entities/preprocessors.py b/ner/preprocessors.py
@@ -1,10 +1,10 @@
1  # -*- coding: utf-8 -*-
2  """ Preprocessors for Named Entities Recognition.
3  """
4  from nazca.utils.tokenizer import Token
5 -from nazca.reference_data.stopwords import FRENCH_STOPWORDS, ENGLISH_STOPWORDS
6 +from nazca.data.stopwords import FRENCH_STOPWORDS, ENGLISH_STOPWORDS
7 
8  STOPWORDS = {'fr': FRENCH_STOPWORDS,
9               'en': ENGLISH_STOPWORDS}
10 
11 
diff --git a/named_entities/sources.py b/ner/sources.py
diff --git a/record_linkage/__init__.py b/rl/__init__.py
diff --git a/record_linkage/aligner.py b/rl/aligner.py
diff --git a/record_linkage/blocking.py b/rl/blocking.py
diff --git a/test/test_alignment.py b/test/test_alignment.py
@@ -20,12 +20,12 @@
12  import random
13  random.seed(6) ### Make sure tests are repeatable
14  from os import path
15 
16  from nazca.utils.normalize import simplify
17 -import nazca.record_linkage.aligner as alig
18 -import nazca.record_linkage.blocking as blo
19 +import nazca.rl.aligner as alig
20 +import nazca.rl.blocking as blo
21  from nazca.utils.distances import LevenshteinProcessing, GeographicalProcessing
22 
23 
24  TESTDIR = path.dirname(__file__)
25 
diff --git a/test/test_blocking.py b/test/test_blocking.py
@@ -21,15 +21,15 @@
26  import random
27  random.seed(6) ### Make sure tests are repeatable / Minhashing
28 
29  from nazca.utils.distances import (levenshtein, soundex, soundexcode,   \
30                                         jaccard, euclidean, geographical)
31 -from nazca.record_linkage.blocking import (KeyBlocking, SortedNeighborhoodBlocking,
32 -                                           MergeBlocking,
33 -                                           NGramBlocking, PipelineBlocking,
34 -                                           SoundexBlocking, KmeansBlocking,
35 -                                           MinHashingBlocking, KdTreeBlocking)
36 +from nazca.rl.blocking import (KeyBlocking, SortedNeighborhoodBlocking,
37 +                               MergeBlocking,
38 +                               NGramBlocking, PipelineBlocking,
39 +                               SoundexBlocking, KmeansBlocking,
40 +                               MinHashingBlocking, KdTreeBlocking)
41  from nazca.utils.normalize import SimplifyNormalizer, loadlemmas
42 
43 
44  TESTDIR = path.dirname(__file__)
45 
diff --git a/test/test_dataio.py b/test/test_dataio.py
@@ -23,12 +23,12 @@
46  from tempfile import mkdtemp
47 
48  from nazca.utils.dataio import (HTMLPrettyPrint, ValidXHTMLPrettyPrint,
49                                  sparqlquery, rqlquery, parsefile,
50                                  autocast, split_file)
51 -from nazca.named_entities import NerProcess
52 -from nazca.named_entities.sources import NerSourceLexicon
53 +from nazca.ner import NerProcess
54 +from nazca.ner.sources import NerSourceLexicon
55 
56  TESTDIR = path.dirname(__file__)
57 
58  @contextmanager
59  def tempdir():
diff --git a/test/test_filters.py b/test/test_filters.py
@@ -15,12 +15,15 @@
60  #
61  # You should have received a copy of the GNU Lesser General Public License along
62  # with this program. If not, see <http://www.gnu.org/licenses/>.
63  import unittest2
64 
65 -from nazca.named_entities import named_entities as core, filters
66 -from nazca.named_entities.sources import NerSourceLexicon
67 +from nazca.ner import NerProcess
68 +from nazca.ner.filters import (NerOccurenceFilter,
69 +                               NerReplacementRulesFilter,
70 +                               NerDisambiguationWordParts)
71 +from nazca.ner.sources import NerSourceLexicon
72  from nazca.utils.tokenizer import Token, Sentence
73 
74 
75  class FilterTest(unittest2.TestCase):
76      """ Test of filters """
@@ -29,12 +32,12 @@
77          """ Test occurence filter """
78          text = 'Hello everyone, this is   me speaking. And me.'
79          source1 = NerSourceLexicon({'everyone': 'http://example.com/everyone',
80                                      'me': 'http://example.com/me'})
81          source2 = NerSourceLexicon({'me': 'http://example2.com/me'})
82 -        _filter = filters.NerOccurenceFilter(min_occ=2)
83 -        ner = core.NerProcess((source1, source2), filters=(_filter,))
84 +        _filter = NerOccurenceFilter(min_occ=2)
85 +        ner = NerProcess((source1, source2), filters=(_filter,))
86          named_entities = ner.process_text(text)
87          self.assertEqual(named_entities,
88                           [('http://example.com/me', None,
89                             Token(word='me', start=26, end=28,
90                                             sentence=Sentence(indice=0, start=0, end=38))),
@@ -52,12 +55,12 @@
91          """ Test occurence filter """
92          text = 'Hello everyone, this is   me speaking. And me.'
93          source1 = NerSourceLexicon({'everyone': 'http://example.com/everyone',
94                                      'me': 'http://example.com/me'})
95          source2 = NerSourceLexicon({'me': 'http://example2.com/me'})
96 -        _filter = filters.NerOccurenceFilter(max_occ=1)
97 -        ner = core.NerProcess((source1, source2), filters=(_filter,))
98 +        _filter = NerOccurenceFilter(max_occ=1)
99 +        ner = NerProcess((source1, source2), filters=(_filter,))
100          named_entities = ner.process_text(text)
101          self.assertEqual(named_entities,
102                           [('http://example.com/everyone', None,
103                             Token(word='everyone', start=6, end=14,
104                                             sentence=Sentence(indice=0, start=0, end=38))),])
@@ -65,12 +68,12 @@
105      def test_disambiguation_word_length(self):
106          """ Test occurence filter """
107          text = 'Hello toto tutu. And toto.'
108          source = NerSourceLexicon({'toto tutu': 'http://example.com/toto_tutu',
109                                     'toto': 'http://example.com/toto'})
110 -        _filter = filters.NerDisambiguationWordParts()
111 -        ner = core.NerProcess((source,), filters=(_filter,))
112 +        _filter = NerDisambiguationWordParts()
113 +        ner = NerProcess((source,), filters=(_filter,))
114          named_entities = ner.process_text(text)
115          self.assertEqual(named_entities,
116                           [('http://example.com/toto_tutu', None,
117                             Token(word='toto tutu', start=6, end=15,
118                                   sentence=Sentence(indice=0, start=0, end=16))),
@@ -82,12 +85,12 @@
119          """ Test rules filter """
120          text = 'Hello toto tutu. And toto.'
121          source = NerSourceLexicon({'toto tutu': 'http://example.com/toto_tutu',
122                                     'toto': 'http://example.com/toto'})
123          rules = {'http://example.com/toto': 'http://example.com/tata'}
124 -        _filter = filters.NerReplacementRulesFilter(rules)
125 -        ner = core.NerProcess((source,), filters=(_filter,))
126 +        _filter = NerReplacementRulesFilter(rules)
127 +        ner = NerProcess((source,), filters=(_filter,))
128          named_entities = ner.process_text(text)
129          self.assertEqual(named_entities,
130                           [('http://example.com/toto_tutu', None,
131                             Token(word='toto tutu', start=6, end=15,
132                                   sentence=Sentence(indice=0, start=0, end=16))),
diff --git a/test/test_named_entities.py b/test/test_ner.py
@@ -15,16 +15,16 @@
133  #
134  # You should have received a copy of the GNU Lesser General Public License along
135  # with this program. If not, see <http://www.gnu.org/licenses/>.
136  import unittest2
137 
138 -from nazca.named_entities.sources import (NerSourceLexicon,
139 +from nazca.ner.sources import (NerSourceLexicon,
140                                            NerSourceSparql,
141                                            NerSourceRql)
142 -from nazca.named_entities import NerProcess
143 +from nazca.ner import NerProcess
144  from nazca.utils.tokenizer import Token, Sentence
145 -from nazca.named_entities.preprocessors import NerStopwordsFilterPreprocessor
146 +from nazca.ner.preprocessors import NerStopwordsFilterPreprocessor
147 
148 
149  class NerTest(unittest2.TestCase):
150      """ Test of Ner """
151 
diff --git a/test/test_preprocessors.py b/test/test_preprocessors.py
@@ -16,11 +16,11 @@
152  # You should have received a copy of the GNU Lesser General Public License along
153  # with this program. If not, see <http://www.gnu.org/licenses/>.
154  import unittest2
155 
156  from nazca.utils import tokenizer
157 -from nazca.named_entities import preprocessors
158 +from nazca.ner import preprocessors
159 
160 
161  class PreprocessorTest(unittest2.TestCase):
162      """ Test of preprocessors """
163