mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Wordnet download fix
This commit is contained in:
parent
26071e863e
commit
41faa7a375
|
@ -52,12 +52,10 @@ install:
|
||||||
build_script:
|
build_script:
|
||||||
# Build the compiled extension
|
# Build the compiled extension
|
||||||
#- "%CMD_IN_ENV% python setup.py build_ext --inplace"
|
#- "%CMD_IN_ENV% python setup.py build_ext --inplace"
|
||||||
- "md corpora\\en"
|
- ps: appveyor\download.ps1
|
||||||
- "cd corpora\\"
|
- "tar -xzf corpora\en\wordnet.tar.gz"
|
||||||
- "wget --no-check-certificate http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz"
|
- "ls \"C:/projects/spacy/include/"
|
||||||
- "tar -xzf WordNet-3.0.tar.gz"
|
- "ls \"C:/projects/spacy/include/"
|
||||||
- "mv WordNet-3.0 wordnet"
|
|
||||||
- "cd ..\\..\\"
|
|
||||||
|
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
|
|
51
appveyor/download.ps1
Normal file
51
appveyor/download.ps1
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# Wordnet download Windows script
|
||||||
|
|
||||||
|
$WORDNET_URL = "http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz"
|
||||||
|
$WORDNET_RELATIVE_PATH = "corpora\en"
|
||||||
|
|
||||||
|
function Download ($filename, $url) {
|
||||||
|
$webclient = New-Object System.Net.WebClient
|
||||||
|
|
||||||
|
$basedir = $pwd.Path + "\"
|
||||||
|
$filepath = $basedir + $filename
|
||||||
|
if (Test-Path $filename) {
|
||||||
|
Write-Host "Reusing" $filepath
|
||||||
|
return $filepath
|
||||||
|
}
|
||||||
|
NET
|
||||||
|
# Download and retry up to 3 times in case of network transient errors.
|
||||||
|
Write-Host "Downloading" $filename "from" $url
|
||||||
|
$retry_attempts = 2
|
||||||
|
for ($i = 0; $i -lt $retry_attempts; $i++) {
|
||||||
|
try {
|
||||||
|
$webclient.DownloadFile($url, $filepath)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
Catch [Exception]{
|
||||||
|
Start-Sleep 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Test-Path $filepath) {
|
||||||
|
Write-Host "File saved at" $filepath
|
||||||
|
} else {
|
||||||
|
# Retry once to get the error message if any at the last try
|
||||||
|
$webclient.DownloadFile($url, $filepath)
|
||||||
|
}
|
||||||
|
return $filepath
|
||||||
|
}
|
||||||
|
|
||||||
|
function InstallWordNet () {
|
||||||
|
if((Test-Path $WORDNET_RELATIVE_PATH) -eq 0)
|
||||||
|
{
|
||||||
|
mkdir $WORDNET_RELATIVE_PATH;
|
||||||
|
}
|
||||||
|
$wordnet_fname = $WORDNET_RELATIVE_PATH + "\wordnet.tar.gz"
|
||||||
|
Download $wordnet_fname $WORDNET_URL
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function main () {
|
||||||
|
InstallWordNet
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
Loading…
Reference in New Issue
Block a user