When I trying to install nltk and download the file punket using nltk.download('punkt').
I am getting the following errors. Have tried many alternative codes and changing networks.
error
Please help with this error.
Post applying :-
= df['num_words'] = df['text'].apply(lambda x:len(nltk.word_tokenize(x)))
I am gettring the error:-
**Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:
import nltk
nltk.download('punkt')
For more information see: https://www.nltk.org/data.html
Attempted to load tokenizers/punkt/english.pickle**
I tried some alternative codes like
import nltk
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
nltk.download()
Also tried changing the networks as at some places I found it is saying server issue.
Try to launch the jupyter notebooks session as administrator (open the command or anaconda prompt as administrator).
The last option would be to download the corpus manually. You may find this, helpful in your case.
Related
Nim as a language provides .nimble files to describe its packages (example of a .nimble file). I know that the file is parsed by the nimble package and CLI-tool, as they need the information inside the .nimble file for their tasks.
I want basically all the information in there, dependencies, author, license, description, version, all of it. So in order to not do the same work twice and potentially run into issues should the format change, I would like to use the nimble package itself to parse the .nimble file for me.
I know the correct proc for it, which is getPkgInfoFromFile, but I can't seem to access it with import nimble/nimblepkg/packageparser.
Whenever I use that line I receive an error that there is no such file.
What am I doing wrong?
Further: getPkgInfoFromFile requires an Options instance that it generates when parsing a CLI command. I don't have a CLI command, so I'm not generating such an instance, can I use the proc somehow without one?
Thanks to ringabout I came to the correct solution, but first to the question.
Question 1: How do I access the proc in the first place?
You can access nimble like a package, but the import is not import nimble/nimblepkg/packageparser it is directly import nimblepkg/packageparser.
This requires you to have both nimble' installed as a library as well as the compiler` installed as a library.
So you'll have to install those first:
nimble install nimble
nimble install nim # Originally this was called "compiler", but was renamed to "nim"
Ignore any warnings if they pop up.
Now you can compile the following dummy-example:
#dummy.nim
import nimblepkg/packageparser
echo "Pointer to packageparser proc: ", packageparser.getPkgInfoFromFile.repr
with: nimble -d:ssl --mm:refc -r build (-d:ssl is required for nimble's HTTP-client and --mm:refc is required as nimble appears to not work with orc)
Question 2: Can I run the getPkgInfoFromFile without an Options instance?
Yes-ish. You still need one, but it doesn't have to be a "real" one, you can just instantiate one yourself on the fly.
import nimblepkg/[options, packageinfotypes, packageparser]
proc generateDummyOptions(): Options =
result = initOptions()
result.setNimBin()
result.setNimbleDir()
proc parseNimbleFile*(nimblePath: string): PackageInfo =
let options = generateDummyOptions()
result = getPkgInfoFromFile(nimblePath.NimbleFile, options)
Following this wonderful article, I'm trying to use the IPython REPL for debugging my Flask app. The idea is that you run import IPython; IPython.embed() at a point where you want to take a look around the state of your projects.
I'm developing my app in a Docker container to make it easier to run with other services. I tried inserting this line into a views.py function like so:
#page.route('/', methods=['GET', 'POST'])
def index():
form = SearchForm()
if form.validate_on_submit():
results = request.form.get('search')
import IPython; IPython.embed()
return render_template('page/index.html', form=form, results=results)
else:
flash(form.errors)
return render_template('page/index.html', form=form)
When a valid POST request is made through the form, I see the following output from Docker:
website_1 | IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.
website_1 | In [1]: Do you really want to exit ([y]/n)?
Then I see gunicorn logging the POST and GET requests. It would seem docker automatically shuts down IPython and continues to render_template.
I'm wondering if there is anyway to get this to work as an actual breakpoint as described in the article. I'd love to be able to take a look around my code this way. Thanks in advance for any advice.
ValueError: "MosekSolver cannot Solve because MosekSolver::available() is false, i.e., MosekSolver has not been compiled as part of this binary. Refer to the MosekSolver class overview documentation for how to compile it."
Hi, I got the above error when trying to use the Mosek solver in Drake. It is not clear to me how to enable Mosek in Deepnote with Drake. Do I need to include something in the Dockerfile or the init file? Any tips would be appreciated.
Links I looked at:
https://drake.mit.edu/pydrake/pydrake.solvers.mosek.html
https://drake.mit.edu/bazel.html#mosek
Mosek+Drake does work on Deepnote. The workflow is like this:
Obtain a Mosek license file (from the Mosek website), and upload it to Deepnote.
Set an environment variable to tell Drake where to find the license file. For instance, you can add the following at the top of your notebook:
import os
os["MOSEKLM_LICENSE_FILE"] = "mosek.lic"
Now MosekSolver.available() should be True, and Mosek will even be chosen as the default preferred solver for if you simply call Solve(prog).
Note: Please be very careful not to share the Deepnote notebook with your mosek.lic uploaded.
I send some samples for Sanger sequencing to a commercial facility. I'm able to read the files they send using the command
from Bio import SeqIO
from Bio import Seq
rec = SeqIO.read("isolation-round4/3dr23_Forward.ab1",'abi-trim').seq
But recently, due to a move, we had to send the samples elsewhere for sequencing. Now, if I try to run the same command on the output I get an error:
UnboundLocalError: local variable 'qual' referenced before assignment in
File "C:\Users\Anaconda3\lib\site-packages\Bio\SeqIO\AbiIO.py", line 462, in AbiIterator letter_annotations={"phred_quality": qual}
I would appreciate any help in dealing with this. Here are two files, one that works and one that does not, if you would like to have a look.
Thanks in advance for your help!
Bug should have already been fixed in Biopython 1.77
Update: See https://github.com/biopython/biopython/issues/3221 - turned out to be a new unexpected configuration of the ABI software producing files with no quality scores.
I have an neo4j-admin import script set up with --bad-tolerance=100000 (note, also tried --bad-tolerance 100000) as a flag. My script fails during import during the collect dense nodes step with the following message: unexpected error: Too many bad entries 1001, where last one was: InputRelationship:...
I thought bad tolerance was supposed to address that flag so that it would fail at the (in this case) 100,001st bad entry?
bin/neo4j-admin import is feature wise not yet on par with the good old bin/neo4j-import tool - which is marked deprecated in 3.1.1.
To use --bad-tolerance you need to go back to use bin/neo4j-import.