【发布时间】:2018-11-15 07:00:41
【问题描述】:
假设我已成功获取此文本,然后我为它们分配名称 textToModify:
textToModify = "
abcde abcde
Title: Director, lorem company
Phone: 123.647.4555
Mobile: 123.123.1234 E-mail: try1@umich.edu Assistant: my name Assistant Phone: 667.889.9910
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Linkedin: www.linkedin.com/in/lorem-ipsum/
Twitter: www.twitter.com/ipsum
"
现在我想从这个文本中提取标题、姓名、电话号码、linkedin、twitter 和其他重要信息。有没有这样的图书馆可以这样做,或者您有什么想法吗?假设这个文本的格式是随机的,但是单词 title 总是紧挨着 title 本身,单词 phone 总是紧挨着 phone 等等。
我最初的想法:
nltk 库将不起作用,因为它基本上分配带有标识符的单词,问题是,此文本不是按单词分隔,而是按字符分隔,例如,如果您访问 textToModify[20],它只会返回一个字符。
我的另一个想法是,如果我访问链接,然后对它们进行截图,然后在 python 中使用(如果存在)图片到文本库,然后从那里开始
谢谢!
【问题讨论】:
-
这听起来像是X-Y problem。与其寻求解决问题的帮助,不如编辑您的问题并询问实际问题。你想做什么?
标签: python python-3.x selenium nltk