tokens: expected a list of strings, got a string
Package:
nltk
10091
Exception Class:
TypeError
Raise code
if lang not in ["eng", "rus"]:
raise NotImplementedError(
"Currently, NLTK pos_tag only supports English and Russian "
"(i.e. lang='eng' or lang='rus')"
)
# Throws Error if tokens is of string type
elif isinstance(tokens, str):
raise TypeError("tokens: expected a list of strings, got a string")
else:
tagged_tokens = tagger.tag(tokens)
if tagset: # Maps to the specified tagset.
if lang == "eng":
tagged_tokens = [
(token, map_tag("en-ptb", tagset, tag))
Links to the raise (1)
https://github.com/nltk/nltk/blob/52228dfcbff8ec3446fd87a3ee0d8cea05db5adf/nltk/tag/__init__.py#L118NO FIXES YET
Just press the button and we will add solution
to this exception as soon as possible
* As many users press the button, the faster we create a fix
Add a possible fix
Please authorize to post fix