Numpy not recognizing a proper dtype

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Numpy not recognizing a proper dtype



My code is below:


import numpy as np
from nltk.tokenize import TweetTokenizer
from nltk import pos_tag

class tag_tokenizer:

tokenizer = TweetTokenizer() #learn tokenizing stuff
dt = np.dtype([("token", 'U16') , ("pos_tag","U5")])

def __init__(self, rawDocs):
self.tagged_data = np.array([pos_tag(self.tokenizer.tokenize(rawDoc)) for rawDoc in rawDocs], dtype=self.dt)



But I get the error:


TypeError: a bytes-like object is required, not 'list'



whenevery I try to initialize an instance of tag_tokenizer. My list is a lst of tuples of both string characters so I don't know why numpy wont let me. Do I have to create the array first, and then set the dtype, or am I just doing it wrong?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

q4iIZ1djXA,x9ZZbYGRLUP24G0q7lhGM0nERmX,DeVa 8eRl,d,voZhyYnu1Tepn 42WJgAD85jYQMe9d86bjrRyTC9
j1v,x8XLg8H8W 5O jrqUNADA BO,RMZG5geJIBA nU,SMjfc9UV,CZ,rDfzunml

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham