doc = nlp(doc)
proced = self.doc_to_guess(doc)
if not proced:
print("Nothing came back from doc_to_guess...")
for loc in proced:
if loc["country_conf"] >= self.country_threshold: // shrug
res = self.query_geonames_country(loc["word"], loc["country_predicted"])
elif loc["country_conf"] < self.country_threshold:
After Change
// Pick the best place
X, meta = self.features_for_rank(loc, res)
all_tasks, sorted_meta, sorted_X = self.format_for_prodigy(X, meta, loc["word"], return_feature_subset=True)
fl_pad = np.pad(sorted_X, ((0, 4 - sorted_X.shape[0]), (0, 0)), "constant")
fl_unwrap = fl_pad.flatten()
prediction = self.rank_model.predict(np.asmatrix(fl_unwrap))
place_confidence = prediction.max()
loc["geo"] = sorted_meta[prediction.argmax()]
loc["place_confidence"] = place_confidence
if not verbose:
proced = self.clean_proced(proced)