Wordnet download fix

This commit is contained in:
maxirmx 2015-10-13 12:03:57 +03:00
parent 26071e863e
commit 41faa7a375
2 changed files with 55 additions and 6 deletions

View File

@ -52,12 +52,10 @@ install:
build_script:
# Build the compiled extension
#- "%CMD_IN_ENV% python setup.py build_ext --inplace"
- "md corpora\\en"
- "cd corpora\\"
- "wget --no-check-certificate http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz"
- "tar -xzf WordNet-3.0.tar.gz"
- "mv WordNet-3.0 wordnet"
- "cd ..\\..\\"
- ps: appveyor\download.ps1
- "tar -xzf corpora\en\wordnet.tar.gz"
- "ls \"C:/projects/spacy/include/"
- "ls \"C:/projects/spacy/include/"
test_script:

51
appveyor/download.ps1 Normal file
View 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