我在 Dataframe 中有一个带有命名实体值的元组,如何将每个实体的值分组到包含元组的列上并将其可视化。
s = pd.Series("At noon, Trump became the 45th president of the United States, taking the oath of office with Chief Justice John Roberts. Trump was also sworn in using two Bibles, a Bible his mother gifted him and the historic Lincoln Bible.")
print(hero.named_entities(s)[0])
哪个输出
[('noon', 'TIME', 3, 7), ('Trump', 'PERSON', 9, 14), ('45th', 'ORDINAL', 26, 30), ('the United States', 'GPE', 44, 61), ('John Roberts', 'PERSON', 108, 120), ('two', 'CARDINAL', 152, 155), ('Bibles', 'PRODUCT', 156, 162), ('Bible', 'WORK_OF_ART', 166, 171), ('Lincoln Bible', 'PERSON', 211, 224)]