Skip to content

Commit

Permalink
Use absolute imports, for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Sep 15, 2013
1 parent 03ed73d commit 0c50a8b
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 36 deletions.
30 changes: 15 additions & 15 deletions text/blob.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# -*- coding: utf-8 -*-

'''Wrappers for various units of text.'''
from __future__ import unicode_literals
from __future__ import unicode_literals, absolute_import
import sys
import json
import string as pystring
from collections import defaultdict

from .packages import nltk
from .decorators import cached_property
from .utils import lowerstrip, PUNCTUATION_REGEX
from .inflect import singularize as _singularize, pluralize as _pluralize
from .mixins import BlobComparableMixin
from .compat import unicode, basestring, python_2_unicode_compatible, u
from .np_extractors import BaseNPExtractor, FastNPExtractor
from .taggers import BaseTagger, PatternTagger
from .tokenizers import BaseTokenizer, WordTokenizer, SentenceTokenizer
from .sentiments import BaseSentimentAnalyzer, PatternAnalyzer
from .parsers import BaseParser, PatternParser
from .translate import Translator
from .en import suggest
from .exceptions import MissingCorpusException
from text.packages import nltk
from text.decorators import cached_property
from text.utils import lowerstrip, PUNCTUATION_REGEX
from text.inflect import singularize as _singularize, pluralize as _pluralize
from text.mixins import BlobComparableMixin
from text.compat import unicode, basestring, python_2_unicode_compatible, u
from text.np_extractors import BaseNPExtractor, FastNPExtractor
from text.taggers import BaseTagger, PatternTagger
from text.tokenizers import BaseTokenizer, WordTokenizer, SentenceTokenizer
from text.sentiments import BaseSentimentAnalyzer, PatternAnalyzer
from text.parsers import BaseParser, PatternParser
from text.translate import Translator
from text.en import suggest
from text.exceptions import MissingCorpusException


class Word(unicode):
Expand Down
9 changes: 5 additions & 4 deletions text/classifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
.. versionadded:: 0.6.0
'''
from .packages import nltk
from .tokenizers import WordTokenizer
from .compat import basestring, u
from .decorators import cached_property
from __future__ import absolute_import
from text.packages import nltk
from text.tokenizers import WordTokenizer
from text.compat import basestring, u
from text.decorators import cached_property
import formats

##### Basic feature extractors #####
Expand Down
2 changes: 1 addition & 1 deletion text/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def u(s):
izip = zip
import csv

# ======= Compatibility layer for __str__ and __repr__ ==========
# ======= Compatibility layer for __str__ and __repr__ from NLTK ==========

import unicodedata
import functools
Expand Down
4 changes: 2 additions & 2 deletions text/mixins.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from .compat import basestring
from __future__ import absolute_import
from text.compat import basestring

class ComparableMixin(object):

Expand Down
8 changes: 4 additions & 4 deletions text/np_extractors.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals
from .packages import nltk
from __future__ import unicode_literals, absolute_import
from text.packages import nltk

from .taggers import PatternTagger
from .exceptions import MissingCorpusException
from text.taggers import PatternTagger
from text.exceptions import MissingCorpusException

class BaseNPExtractor(object):

Expand Down
10 changes: 5 additions & 5 deletions text/sentiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
.. versionadded:: 0.5.0
"""

from .packages import nltk
from .en import sentiment as pattern_sentiment
from .tokenizers import WordTokenizer
from .exceptions import MissingCorpusException
from __future__ import absolute_import
from text.packages import nltk
from text.en import sentiment as pattern_sentiment
from text.tokenizers import WordTokenizer
from text.exceptions import MissingCorpusException

DISCRETE = 'ds'
CONTINUOUS = 'co'
Expand Down
8 changes: 4 additions & 4 deletions text/tokenizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
.. versionadded:: 0.4.0
'''

from .packages import nltk
from .utils import strip_punc
from .exceptions import MissingCorpusException
from __future__ import absolute_import
from text.packages import nltk
from text.utils import strip_punc
from text.exceptions import MissingCorpusException


class BaseTokenizer(nltk.tokenize.api.TokenizerI):
Expand Down
3 changes: 2 additions & 1 deletion text/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
Adapted from Terry Yin's google-translate-python.
Language detection added by Steven Loria.
'''
from __future__ import absolute_import
import re
from .compat import PY2, request, urlquote
from text.compat import PY2, request, urlquote


class Translator(object):
Expand Down

0 comments on commit 0c50a8b

Please sign in to comment.