senticnet.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:hoot 作者: CatalystOfNostalgia 项目源码 文件源码
def _output(self, url):
        """
        Downloads and returns the output avoiding w3.org error
        """
        response = requests.get(url)
        html = response.text
        html = html.replace('w3.org', 'www.w3.org')

        graph = rdflib.Graph()
        parsed_graph = graph.parse(data=html, format="xml")

        result = []
        stresult = []

        for s, p, o in parsed_graph:
            if type(o) == rdflib.term.Literal:
                result.append(o.toPython())
            else:
                stresult.append(o.toPython())

        return result, stresult
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号