Skip to main content

No project description provided

Project description

chardiff_html

Python package for visualizing char diff by colorized html

Install

pip install chardiff_html

Usage

This package outputs HTML string displays char diffs, so you can use this on Jupyter notebook or Streamlit

Jupyter Exmaple

from chardiff_html import chardiff_jupyter
chardiff_jupyter('hoge', 'hag')

Image from Gyazo

Streamlit Example

import streamlit as st
from chardiff_html import chardiff_html

"### Input"
str1 = st.text_area("Original Sentence", "hoge")
str2 = st.text_area("New Sentence", "hag")
diff = chardiff_html(str1, str2)
# >>> print(diff)
# 'h<span style="color: red; background-color: mistyrose">o</span><span style="color: green; background-color: #e0ffe5">a</span>g<span style="color: red; background-color: mistyrose">e</span>'

"### Diffs"
st.markdown(
    diff, unsafe_allow_html=True,
)

Image from Gyazo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chardiff_html-0.1.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

chardiff_html-0.1.1-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page