コード例 #1
0
ファイル: geocode.py プロジェクト: sauravcsvt/geocoding
 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
コード例 #2
0
    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
        }
コード例 #3
0
ファイル: geocode.py プロジェクト: astorfi/geocoding
 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
     }
コード例 #4
0
ファイル: geocode.py プロジェクト: sauravcsvt/geocoding
 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
コード例 #5
0
 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)