我想修改我的文字是這樣的:Python的 - 組順序的數組成員
arr = []
# arr is full of tokenized words from my text
例如:
"Abraham Lincoln Hotel is very beautiful place and i want to go there with
Barbara Palvin. Also there are stores like Adidas ,Nike , Reebok."
編輯:基本上,我想用istitle檢測正確的名稱,並將組()和isAlpha()for for語句如:
for i in arr:
if arr[i].istitle() and arr[i].isAlpha
在示例arr中,直到下一個單詞不是他的第一個單詞字母大寫。
arr[0] + arr[1] + arr[2] = arr[0]
#Abraham Lincoln Hotel
這就是我要與我的新編曲:
['Abraham Lincoln Hotel'] is very beautiful place and i want to go there with
['Barbara Palvin']. ['Also'] there are stores like ['Adidas'], ['Nike'],
['Reebok'].
「也」不是我的問題,將是有益的,當我嘗試,以配合我的數據集。
[發現使用NLTK WordNet的專有名詞]的可能的複製(http://stackoverflow.com/questions/17669952/finding-proper-nouns-using-nltk-wordnet) – Selcuk
我想要一個基本的Python代碼,這總是返回專有名稱,而不分組他們,但無論如何感謝。 –
你不能做一個*基本的Python代碼*來返回專有名稱。這並不容易,你需要使用'NTLK'來實現它。 –