我正在尝试在jupyter笔记本中使用以下代码获取URL,然后由于 URLError :。我尝试了多种方法来解决它,但仍然面临问题。 示例代码
def fetch_TR9856():
"""
Fetch TR9856 dataset for testing multi-word term relatedness
Returns
-------
data : sklearn.datasets.base.Bunch
dictionary-like object. Keys of interest:
'X': matrix of 2 words per column,
'y': vector with scores,
'topic': vector of topics providing context for each pair of terms
References
----------
Levy, Ran et al., "TR9856: A multi-word term relatedness benchmark", 2015.
Notes
-----
"""
data = pd.read_csv(os.path.join(_fetch_file(
'https://www.research.ibm.com/haifa/dept/vst/files/IBM_Debater_(R)_TR9856.v2.zip',
'similarity', uncompress=True, verbose=0),
'IBM_Debater_(R)_TR9856.v0.2', 'TermRelatednessResults.csv'), encoding="iso-8859-1")
# We basically select all the columns available
X = data[['term1', 'term2']].values
y = data['score'].values
topic = data['topic'].values
return Bunch(X=X.astype("object"), y=y, topic=topic)
#calling the function
tasks = {
"MEN": fetch_MEN(),
"WS353": fetch_WS353(),
"SIMLEX999": fetch_SimLex999(),
"TR_9856": fetch_TR9856()
}
Python版本:3.7.4 Windows 8