Is there any way in Python to check if a string contains a real-world location?

时间:2018-04-18 18:16:44

标签: python location

Most likely if there is any library that analyzes the String and then returns any possible location that is in there?

For example: "foo foobar foot New York foo" would, obviously, return "New York".

1 个答案:

答案 0 :(得分:0)

您可以创建一个包含您要搜索的位置的列表,然后迭代该列表,使用getTotal_hrs()将该位置与字符串进行比较。

in

然而,您必须事先找出您正在寻找的位置。您可能还希望将mystring格式化为小写。