我正在尝试提取网络词典条目的语音拼写。 具体来说,这本词典AVL-DNV
有没有办法在Python中使用语音语言并从网络中提取语音拼写? 我的目标是提取这样的东西 [peɾɔ́l]。
要从 HTML 文档中提取内容,您可以使用 beautifulsoup。例如:
import warnings
import requests
from bs4 import BeautifulSoup
warnings.filterwarnings("ignore")
url = "https://www.avl.gva.es/lexicval/?paraula=perol"
soup = BeautifulSoup(requests.get(url).content, "html.parser")
ph = [tag.text for tag in soup.select(".trfonetica")]
print(ph[-1])
打印:
[peɾɔ́l]