嗨,我只想把文本翻译成英语。我正在使用anaconda,它在cmd python foo.py上翻译,但它在anaconda设置上给出了错误。 from googletrans import Translator
translator=Translator()
translator.translate("jumps over") 上面写着 AttributeError: 'NoneType' object has no attribute 'group'
##EDIT
I tryed but same Error occured
from g
需要从列表中删除标点符号,然后将其保存在同一个列表中。
代码:
sentences = ["Hi! How are you doing?","Hope everything is fine.","Have an amazing day!"]
type(list1)
sentences = sentences.translate(str.maketrans('', '', string.punctuation))
错误:
AttributeError Traceb
code: df['review'].head()
index review
output: 0 These flannel wipes are OK, but in my opinion
我想从dataframe的列中删除标点符号,并创建一个新列。
code: import string
def remove_punctuations(text):
return text.translate(None,string.punctuation)
df["new_column"
所以这就是我要尝试的: # running Translate API
from googleapiclient.discovery import build
service = build('translate', 'v3', developerKey=APIKEY)
# use the service
inputs = ['is it really this easy?', 'amazing technology', 'wow']
print(service)
outputs = service.trans
当我尝试在序列models tutorial 中执行"translate.py“时,我得到了以下错误。有谁能帮帮我。
错误:
Preparing WMT data in /tmp
Traceback (most recent call last):
File "translate.py", line 302, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line
我刚刚将Rasa Core更新为0.11.12版本,我仍然收到了错误消息:
"AttributeError: 'Tracker' object has no attribute 'latest_input_channel'"
"AttributeError: 'Tracker' object has no attribute 'get_latest_input_channel'"
"AttributeError: 'Tracker' object has no attri
这应该非常简单:我过去经常使用pickle。这次怎么了?
import pickle
with open('data/cifar-10-batches-py/data_batch_1','rb') as f:
dat = pickle.load(f)
AttributeError: 'function' object has no attribute 'load'
下面的操作也会失败(如果load被注释掉)
with open ('data/cifar-10-batches-py/small_batch'
我试图通过删除标点符号、数字和
等。
我编写了这段代码,最初尝试删除标点符号:
import string
with open("uniquewords_list.txt") as f:
L = sorted(word.strip(",") for line in f for word in line.split())
out = L.translate(string.maketrans("",""), string.punctuation)
with
我有一个数据框架,它有一个需要清理的文本列。
这是列信息
def进程的目的是删除标点符号,转换为小写,删除停止词和词干.
text = text.translate(str.maketrans('', '', string.punctuation)) #remove punctuation
text = [word for word in text.split() if word.lower() not in stopwords.words('english')] #remove stopwords
words =
我正在尝试从Python上的MySQL中的表中检索数据。但我收到了 AttributeError: 'function' object has no attribute 'execute' 我的代码是: import mysql.connector as sqltor
mycon=sqltor.connect(host="localhost",user="root",passwd=" ",database="revision")
if mycon.is_connected():
print
我试图从A类中嵌套的B类调用值,并在C类中使用它。我得到了AttributeError:
class A():
class B():
a = 1
class C():
b = 2
c = B.a + b
AttributeError: class B has no attribute 'a'
我还试图从'A‘调用,Pycharm识别它,但是python仍然得到AttributeError:
class A(object):
class B(object):
a = 1
cl
我刚从Fedora 30升级到Fedora 32。我所有的python东西都停止工作了。第一个问题是
import gtk
我读到我应该把它换成
from gi.repository import Gtk as gtk
from gi.repository import Gdk
但是很多很多的模块都不存在。例如:
AttributeError: 'gi.repository.Gtk' object has no attribute 'combo_box_new_text'
AttributeError: 'gi.repository.Gtk' o
我正在运行github站点的代码,它有以下错误(最后一行):
File "D:\Anaconda3\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 152, in viewMatrix
tr.translate(-center.x(), -center.y(), -center.z())
AttributeError: 'int' object has no attribute 'x'
我发现这个错误与pyqtgraph库有关,我没有更改它们的文件,只是在spy
在测试了这些代码之后,我得到了以下错误:
'EC2' object has no attribute 'instances': AttributeError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 11, in lambda_handler
instances=ec2.instances.filter(Filters=filters)
AttributeError: 'EC2' object has no attrib
我正在尝试从我的Word2Vec模型中提取单词/嵌入矩阵(作为每个单词向量的行,将word作为中心字)和上下文矩阵(作为每个单词向量的行,将word作为上下文单词)。
我尝试过使用model.wv.syn0和/或model.syn0获取嵌入矩阵,使用model.wv.syn1和/或model.syn1获取上下文矩阵,但我总是得到相同的错误:
AttributeError: 'KeyedVectors' object has no attribute 'syn0'
AttributeError: 'Word2Vec' object has no
我有一个简短的问题,我很好奇,如果我能为某些AttributeError设置例外,我找不到任何答案。
例如,我有这样的错误:
AttributeError: 'product.product' object has no attribute 'order_line'
我想只为这一个AttributeError设置异常,所以如果发生另一个AttributeError,我会看到错误消息。
我试过这样做:
except AttributeError == 'product.product' object has no attribute 'or
我有波兰语的熊猫数据框专栏,想要翻译成英语,但我得到了错误。代码如下:
from googletrans import Translator
translator = Translator()
df['text_en'] = df2['text_pl'].apply(translator.translate, src='pl', dest='en')
以下错误:
63
64 # this will be the same as python code after stripping out a res
我想打印10,但我得到了错误:AttributeError: 'function' object has no attribute 'x'
怎么修?谢谢
def function1():
def x():
a=10
return a
def function2():
y = function1.x()
return y
function2()
我需要将以下代码从PyQt5 (在那里工作)转换为PyQt6:
self.setWindowFlags(Qt.FramelessWindowHint)
这是一个错误:
AttributeError: type object 'Qt' has no attribute 'FramelessWindowHint'
我已经试过了:
self.setWindowFlags(Qt.WindowFlags.FramelessWindowHint)
上面写着:
AttributeError: type object 'Qt' has no attribute