-
Notifications
You must be signed in to change notification settings - Fork 39
06_列出所有的地方、位置描述
Droidtown Linguistic. Tech. Co., Ltd edited this page May 14, 2021
·
1 revision
地方、位置描述是指語言中指涉「行政區名稱、地名、位置 (e.g., 這裡、那裡)」的詞彙。
from ArticutAPI import Articut
from pprint import pprint
username = "" #這裡填入您在 https://api.droidtown.co 使用的帳號 email。若使用空字串,則預設使用每小時 2000 字的公用額度。
apikey = "" #這裡填入您在 https://api.droidtown.co 登入後取得的 api Key。若使用空字串,則預設使用每小時 2000 字的公用額度。
articut = Articut(username, apikey)
inputSTR = "你計劃過地球人類補完計劃"
resultDICT = articut.parse(inputSTR)
pprint(result["result_pos"])
locationStemLIST = articut.getLocationStemLIST(resultDICT)
pprint(locationStemLIST)
[[(62, 64, '地球')]]
輸出結果的結構,對應輸入的每一個句子的結構。
[ ##### 最外層的 list 對應「輸入」
[ ##### 第二層的 list 對應「第幾句」。例如第一個 list 表示是輸入的「第一句」
(62, 64, '地球') ##### 第三層的 tuple 其結構為 (詞彙開始索引, 詞彙結束索引, 詞彙)
]
]
Droidtown Linguistic Tech.
Document | Blog | Twitter @DroidtownLing | Facebook @Articut | Website