我有以下单词列表。如何分隔不规则套用的字符串以获取单词? - Python
因为我的话不是全部由后者划定的。单词列表将包含诸如“USA”之类的词,我不知道该怎么做。 '美国'应该是一个字。不能分开。
myList=[u'USA',u'Chancellor', u'currentRank', u'geolocDepartment', u'populationUrban', u'apparentMagnitude', u'Train', u'artery',
u'education', u'rightChild', u'fuel', u'Synagogue', u'Abbey', u'ResearchProject', u'languageFamily', u'building',
u'SnookerPlayer', u'productionCompany', u'sibling', u'oclc', u'notableStudent', u'totalCargo', u'Ambassador', u'copilote',
u'codeBook', u'VoiceActor', u'NuclearPowerStation', u'ChessPlayer', u'runwayLength', u'horseRidingDiscipline']
如何编辑列表中的元素。
我想获得更改的元素列表如下所示:
updatemyList=[u'USA',u'Chancellor', u'current Rank', u'geoloc Department', u'population Urban', u'apparent Magnitude', u'Train', u'artery',
u'education', u'right Child', u'fuel', u'Synagogue', u'Abbey', u'Research Project', u'language Family', u'building',
u'Snooker Player', u'production Company', u'sibling', u'oclc', u'notable Student', u'total Cargo', u'Ambassador', u'copilote',
u'code Book', u'Voice Actor', u'Nuclear Power Station', u'Chess Player', u'runway Length', u'horse Riding Discipline']
字是能够分离
第二个列表中缺少“u'managerYearsEndYear”这个词。监督? – Ukimiku
谢谢,我会编辑它 – bob90937
再次,与'nltk'无关; P出于好奇,对于你的名单,所有的单词都是由后者划定的?当你有'美国'时会发生什么?如果输出结果是'U'A'或'u'USA'? – alvas