Posts

Showing posts with the label nltk

NLTK Named Entity Recognition with Custom Data

Image
Clash Royale CLAN TAG #URR8PPP NLTK Named Entity Recognition with Custom Data I'm trying to extract named entities from my text using NLTK. I find that NLTK NER is not very accurate for my purpose and I want to add some more tags of my own as well. I've been trying to find a way to train my own NER, but I don't seem to be able to find the right resources. I have a couple of questions regarding NLTK- I would really appreciate help in this regard 4 Answers 4 Are you committed to using NLTK/Python? I ran into the same problems as you, and had much better results using Stanford's named-entity recognizer: http://nlp.stanford.edu/software/CRF-NER.shtml. The process for training the classifier using your own data is very well-documented in the FAQ. If you really need to use NLTK, I'd hit up the mailing list for some advice from other users: http://groups.google.com/group/nltk-users. ...

Numpy not recognizing a proper dtype

Image
Clash 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, p...