예제 #1
0
                eventDICT["time"].append([t[-1] for t in tm])
        else:
            pass

        #將結果傳給 getLocationStemLIST() 取出地名
        siteLIST = []
        locationLIST = atclv2.getLocationStemLIST(resultDICT)
        if locationLIST != None:
            siteLIST.extend(locationLIST)
            for location in locationLIST:
                eventDICT["site"].append([l[-1] for l in location])
        else:
            pass

        #將結果傳給 getAddTWLIST() 取出台灣地址
        addressLIST = atclv2.getAddTWLIST(resultDICT)
        if addressLIST != None:
            siteLIST.extend(addressLIST)
            for address in range(0, len(addressLIST)):
                if addressLIST[address] == []:
                    pass
                else:
                    eventDICT["site"][address].extend(
                        [a[-1] for a in addressLIST[address]])

        #將結果傳給 getOpenDataPlaceLIST() 取出開放資料平台中的景點
        placeLIST = atclv2.getOpenDataPlaceLIST(resultDICT)
        if placeLIST != None:
            siteLIST.extend(placeLIST)
            for place in range(0, len(placeLIST)):
                eventDICT["site"][place].extend(
예제 #2
0
    return resultDICT


if __name__ == "__main__":
    inputSTR = inputSTR = """位於台南的50年老房子,
              地址是台南市東區長榮路3段30巷3號。
              這裡承載著曾經是學生宿舍的使命。
              我們繼續把這樣的溫度傳遞,
              讓往來的人都把這裡當做家,
              用緩慢的步調體驗台南的在地生活。""".replace(" ", "").replace("\n", "")
    resultDICT = main(inputSTR)

    #pprint(resultDICT)

    #取得完整地址
    addTWLIST = articut.getAddTWLIST(resultDICT)
    #pprint(addTWLIST)

    addSTR = [a for a in addTWLIST if a != []][0][0][2]
    #pprint(addSTR)

    #套用 SPACE (Doc:https://api.droidtown.co/document/#Space)
    url = "https://api.droidtown.co/Space/API/"
    payload = {
        "username": "",
        "api_key": "",
        "type": "geocoding",
        "site": addSTR
    }

    response = post(url, json=payload)