diff --git a/ner.py b/ner.py index 4ce7fcd..1152370 100644 --- a/ner.py +++ b/ner.py @@ -20,9 +20,11 @@ def load_models(self, loc=None): loc = os.path.join(os.path.expanduser('~'), '.ner_model') self.model = load_model(os.path.join(loc,"model.h5")) # loading word2Idx + np.load.__defaults__=(None, True, True, 'ASCII') self.word2Idx = np.load(os.path.join(loc,"word2Idx.npy")).item() # loading idx2Label self.idx2Label = np.load(os.path.join(loc,"idx2Label.npy")).item() + np.load.__defaults__=(None, False, True, 'ASCII') def getCasing(self,word, caseLookup): casing = 'other' @@ -93,4 +95,4 @@ def predict(self,Sentence): pred = self.model.predict([tokens, casing,char], verbose=False)[0] pred = pred.argmax(axis=-1) pred = [self.idx2Label[x].strip() for x in pred] - return list(zip(words,pred)) \ No newline at end of file + return list(zip(words,pred))