41
41
42
42
from textblob .blob import _initialize_models
43
43
from textblob .decorators import cached_property , requires_nltk_corpus
44
- from textblob .translate import Translator
45
44
from textblob .utils import lowerstrip
46
45
47
46
from textblob_de .base import BaseBlob as _BaseBlob
@@ -63,13 +62,11 @@ class Word(unicode):
63
62
64
63
"""A simple word representation.
65
64
66
- Includes methods for inflection, translation, and WordNet
65
+ Includes methods for inflection and WordNet
67
66
integration.
68
67
69
68
"""
70
69
71
- translator = Translator ()
72
-
73
70
def __new__ (cls , string , pos_tag = None ):
74
71
"""Return a new instance of the class.
75
72
@@ -97,25 +94,6 @@ def pluralize(self):
97
94
"""Return the plural version of the word as a string."""
98
95
return Word (_pluralize (self .string ))
99
96
100
- def translate (self , from_lang = None , to = "de" ):
101
- """Translate the word to another language using Google's Translate API.
102
-
103
- .. versionadded:: 0.5.0 (``textblob``)
104
-
105
- """
106
- if from_lang is None :
107
- from_lang = self .translator .detect (self .string )
108
- return self .translator .translate (self .string ,
109
- from_lang = from_lang , to_lang = to )
110
-
111
- def detect_language (self ):
112
- """Detect the word's language using Google's Translate API.
113
-
114
- .. versionadded:: 0.5.0 (``textblob``)
115
-
116
- """
117
- return self .translator .detect (self .string )
118
-
119
97
def spellcheck (self ):
120
98
"""Return a list of (word, confidence) tuples of spelling corrections.
121
99
@@ -497,16 +475,6 @@ def np_counts(self):
497
475
counts [phrase ] += 1
498
476
return counts
499
477
500
- def translate (self , from_lang = None , to = "de" ):
501
- """Translate the blob to another language."""
502
- if from_lang is None :
503
- from_lang = self .translator .detect (self .string )
504
- return self .__class__ (
505
- self .translator .translate (
506
- self .raw ,
507
- from_lang = from_lang ,
508
- to_lang = to ))
509
-
510
478
def correct (self ):
511
479
"""Attempt to correct the spelling of a blob.
512
480
0 commit comments