def __init__(self, dbpath="./Geonames_dump.sql", min_popln=0, min_length=1): self.gazetteer = GeoNames(dbpath) self.min_popln = min_popln self.min_length = min_length
def __init__(self, db, nerKeyMap=None, spacy=False): self.gazetteer = GeoNames(db, confMethod='Uniform', escore=False) DEFAULT_NER_MAP = { 'LOCATION': 'LOCATION', 'ORGANIZATION': 'ORGANIZATION', 'NATIONALITY': 'NATIONALITY', 'OTHER': 'OTHER', 'PERSON': 'PERSON' } if nerKeyMap is None: nerKeyMap = DEFAULT_NER_MAP else: for key in DEFAULT_NER_MAP: if key not in nerKeyMap: nerKeyMap[key] = DEFAULT_NER_MAP[key] if spacy is True: nerKeyMap['GPE'] = 'LOCATION' nerKeyMap['NORP'] = 'NATIONALITY' nerKeyMap['ORG'] = 'ORGANIZATION' nerKeyMap['LOC'] = 'LOCATION' self.nerKeyMap = nerKeyMap self.weightage = { "LOCATION": 1.0, "NATIONALITY": 0.75, "ORGANIZATION": 0.5, "OTHER": 0.0, "PERSON": 0.0 }
def __init__(self, db, min_popln=0, min_length=1): self.gazetteer = GeoNames(db) self.min_popln = min_popln self.min_length = min_length self.weightage = { "LOCATION": 1.0, "NATIONALITY": 0.75, "ORGANIZATION": 0.5, "OTHER": 0.2 }
def __init__(self, dbpath="./Geonames_dump.sql", min_popln=0, coverageLength=10): """ Description """ self.coverageLength = coverageLength self.gazetteer = GeoNames("./Geonames_dump.sql") self.min_popln = min_popln
def __init__(self, db, min_popln=0, min_length=1, model="./geoModels/rf_geo.pkl"): self.gazetteer = GeoNames(db) self.min_popln = min_popln self.min_length = min_length self.weightage = { "LOCATION": 1.0, "NATIONALITY": 0.75, "ORGANIZATION": 0.5, "OTHER": 0.0 } with open(model, "rb") as inf: self.model = pickle.load(inf)