sentimark.py 文件源码

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

项目:python-qutescript 作者: hiway 项目源码 文件源码
def generate_html(paragraphs, title_text):
    doc = dominate.document(title='Summary: {}'.format(title_text))

    with doc.head:
        style("""\
            body {
                background-color: #F9F8F1;
                color: #2C232A;
                font-family: sans-serif;
                font-size: 1.2em;
            }

        """)

    with doc:
        div(id='header').add(h1(title_text))
        with div():
            attr(cls='body')
            for para in paragraphs:
                tb = TextBlob(para)
                with p():
                    for sentence in tb.sentences:
                        span(sentence, style="color: {}".format(get_polarity_color(sentence.polarity)))
    return doc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号