我使用的是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和這個圖書館,並真誠感謝洞察力。