python - 如何从字符串中提取地区名字?
ringa_lee
ringa_lee 2017-04-18 10:32:40
0
3
1101

比如从‘在香港和纽约等地上市中国股票’这个字符串中提取出 美国,华尔街,香港,纽约这些地点名字?
**我是要从一本书当中提取出所有地点名称,所以看看大神们有没有好的建议和方式?
或者用到什么库呢?**

ringa_lee
ringa_lee

ringa_lee

reply all (3)
小葫芦

I crawled a map website, downloaded all the place names in China, organized them into a txt, then opened it in python, converted it into a map list, and then traversed it, and it was ok.

    左手右手慢动作

    I think it is still a bit difficult to implement this, because some place names are unknown, but you can use an array to put some commonly used place names, and then useindexOfto see if they exist, but this method is too troublesome. I hope there will be better ones below. Methods.

      阿神

      You can find some third-party place name libraries. Then match the place names that appear in the book with the class library.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!