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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file chardiff_html-0.1.1.tar.gz.

File metadata

  • Download URL: chardiff_html-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.6 Darwin/19.6.0

File hashes

Hashes for chardiff_html-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d1e2522e741ca7f5e64fda198055aef5120f7cf7f48576a2c4aac66812d10d85
MD5 041a03a3adbe5d6013e12c9532c16d8f
BLAKE2b-256 c69741964c08a32dd9f0f57726980d2687eb91c637407fc7434eb76d9a515113

See more details on using hashes here.

File details

Details for the file chardiff_html-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: chardiff_html-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.6 Darwin/19.6.0

File hashes

Hashes for chardiff_html-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7efc74329325d9cc7def5eac2ea24536d98dbe131b18dfa54993d7989259f5c
MD5 334aab2a6b2b9f37e8137e658c1fe310
BLAKE2b-256 3cad9c0222f420b592d6d8a20819e72d7046e4195f4f84141b5510946f7707be

See more details on using hashes here.

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