我使用的是Python版本的libphonenumbers,但是当我在不同的文本上试用这个库时,有时会发现python函数不会返回任何内容,那里有一个电话号码,有时他们会返回电话号码。请看下面:Python:libphonenumber - 无法获取明显的电话号码
print(x2)
for match in pnum.PhoneNumberMatcher(x2, "US"):
print(match) #for the text above, it did not get the number
输出:
I just read your profile and thought it was really great. I also thought you were cute and loved the fact that you go hiking with your brothers every summer. If you want to know anything more about me, just ask. My num 555-121-5468.
通过上面这段文字,它不返回我任何电话号码。 但是像下面等的情况下,该功能给了我正确的输入:
x9 = "hay I hate to cut you short, its been fun chatting, but unfortuantely I gotta run. I am gald we became friends though. my number is (323) 2387890"
for match in pnum.PhoneNumberMatcher(x9, "US"):
print(match)
输出:
PhoneNumberMatch [132,145) (323) 2387890
我不知道是什么问题导致此问题,我是新来的Python和这个图书馆,并真诚感谢洞察力。