diff --git a/budou/budou.py b/budou/budou.py
index 7576020..de672b4 100644
--- a/budou/budou.py
+++ b/budou/budou.py
@@ -17,7 +17,7 @@
 """Budou: an automatic organizer tool for beautiful line breaking in CJK
 
 Usage:
-  budou [--segmenter=<seg>] [--language=<lang>] [--classname=<class>] [--inlinestyle] <source>
+  budou [--segmenter=<seg>] [--language=<lang>] [--classname=<class>] [--inlinestyle] [--wbr] <source>
   budou -h | --help
   budou -v | --version
 
@@ -36,6 +36,9 @@ Options:
 
   --inlinestyle               Add :code:`display:inline-block` as inline style
                               attribute.
+
+  --wbr                       User WBR tag for serialization instead of
+                              inline-block SPAN tags.
 """
 
 from __future__ import print_function
@@ -62,12 +65,14 @@ def main():
       language=args['--language'],
       classname=args['--classname'],
       inlinestyle=args['--inlinestyle'],
+      wbr=args['--wbr'],
       )
   print(result['html_code'])
   sys.exit()
 
 def parse(source, segmenter='nlapi', language=None, max_length=None,
-          classname=None, attributes=None, inlinestyle=False, **kwargs):
+          classname=None, attributes=None, inlinestyle=False, wbr=False,
+          **kwargs):
   """Parses input source.
 
   Args:
@@ -79,6 +84,7 @@ def parse(source, segmenter='nlapi', language=None, max_length=None,
     attributes (dict, optional): Attributes for output SPAN tags.
     inlinestyle (bool, optional): Add :code:`display:inline-block` as inline
                                   style attribute.
+    wbr (bool, optional): User WBR tag for serialization.
 
   Returns:
     Results in a dict. :code:`chunks` holds a list of chunks
@@ -88,7 +94,7 @@ def parse(source, segmenter='nlapi', language=None, max_length=None,
   parser = get_parser(segmenter, **kwargs)
   return parser.parse(
       source, language=language, max_length=max_length, classname=classname,
-      attributes=attributes, inlinestyle=inlinestyle)
+      attributes=attributes, inlinestyle=inlinestyle, wbr=wbr)
 
 def authenticate(json_path=None):
   """Gets a Natural Language API parser by authenticating the API.
diff --git a/budou/chunk.py b/budou/chunk.py
index 72c1ff3..cf1f909 100644
--- a/budou/chunk.py
+++ b/budou/chunk.py
@@ -21,6 +21,10 @@ import collections
 from xml.etree import ElementTree as ET
 import unicodedata
 import html5lib
+from html5lib import getTreeWalker
+from html5lib.filters import sanitizer
+from html5lib.constants import namespaces
+
 
 class Chunk:
   """A unit for word segmentation.
@@ -271,7 +275,24 @@ class ChunkList(collections.MutableSequence):
         target_chunks.append(chunk)
     self.list = target_chunks
 
-  def html_serialize(self, attributes, max_length=None):
+  def html_serialize(self, attributes, max_length=None, use_wbr=False):
+    """Returns concatenated HTML code with SPAN tag.
+
+    Args:
+      attributes (dict): A map of name-value pairs for attributes of output
+          SPAN tags.
+      max_length (int, optional): Maximum length of span enclosed chunk.
+      use_wbr (bool, optional): Use WBR tag to serialize the output.
+
+    Returns:
+      The organized HTML code. (str)
+    """
+    if use_wbr:
+      return self.wbr_serialize(max_length)
+    else:
+      return self.span_serialize(attributes, max_length)
+
+  def span_serialize(self, attributes, max_length=None):
     """Returns concatenated HTML code with SPAN tag.
 
     Args:
@@ -309,3 +330,46 @@ class ChunkList(collections.MutableSequence):
         html5lib.parseFragment(result), sanitize=True,
         quote_attr_values='always')
     return result
+
+  def wbr_serialize(self):
+    """Returns concatenated HTML code with WBR tag. This is still experimental.
+
+    Returns:
+      The organized HTML code. (str)
+    """
+    doc = ET.Element('span')
+    doc.attrib['style'] = 'word-break: keep-all'
+    for chunk in self:
+      if (chunk.has_cjk() and doc.text):
+        ele = ET.Element('wbr')
+        doc.append(ele)
+        doc.getchildren()[-1].tail = chunk.word
+      else:
+        # add word without span tag for non-CJK text (e.g. English)
+        # by appending it after the last element
+        if doc.getchildren():
+          if doc.getchildren()[-1].tail is None:
+            doc.getchildren()[-1].tail = chunk.word
+          else:
+            doc.getchildren()[-1].tail += chunk.word
+        else:
+          if doc.text is None:
+            doc.text = chunk.word
+          else:
+            doc.text += chunk.word
+    content = ET.tostring(doc, encoding='utf-8').decode('utf-8')
+    dom = html5lib.parseFragment(content)
+    treewalker = getTreeWalker('etree')
+    stream = treewalker(dom)
+    serializer = html5lib.serializer.HTMLSerializer(
+            quote_attr_values='always')
+    allowed_elements = set(sanitizer.allowed_elements)
+    allowed_elements.add((namespaces['html'], 'wbr'))
+    allowed_css_properties = set(sanitizer.allowed_css_properties)
+    allowed_css_properties.add('word-break')
+    result = serializer.render(sanitizer.Filter(
+        stream, allowed_elements=allowed_elements,
+        allowed_css_properties=allowed_css_properties,
+        ))
+    return result
+
diff --git a/budou/nlapisegmenter.py b/budou/nlapisegmenter.py
index de0bd78..93c98bf 100644
--- a/budou/nlapisegmenter.py
+++ b/budou/nlapisegmenter.py
@@ -171,7 +171,7 @@ class NLAPISegmenter(Segmenter):
       ValueError: If :code:`language` is given and it is not included in
                   :code:`supported_languages`.
     """
-    if language and not language in self.supported_languages:
+    if language and language not in self.supported_languages:
       raise ValueError(
           'Language {} is not supported by NLAPI segmenter'.format(language))
 
diff --git a/budou/parser.py b/budou/parser.py
index a8fa147..753f372 100644
--- a/budou/parser.py
+++ b/budou/parser.py
@@ -57,7 +57,7 @@ class Parser:
     self.segmenter = None
 
   def parse(self, source, language=None, classname=None, max_length=None,
-            attributes=None, inlinestyle=False):
+            attributes=None, inlinestyle=False, wbr=False):
     """Parses the source sentence to output organized HTML code.
 
     Args:
@@ -67,6 +67,7 @@ class Parser:
       attributes (dict, optional): Attributes for output SPAN tags.
       inlinestyle (bool, optional): Add :code:`display:inline-block` as inline
                                     style attribute.
+      wbr (bool, optional): User WBR tag for serialization.
 
     Returns:
       A dictionary containing :code:`chunks` (:obj:`budou.chunk.ChunkList`)
@@ -75,7 +76,8 @@ class Parser:
     attributes = parse_attributes(attributes, classname, inlinestyle)
     source = preprocess(source)
     chunks = self.segmenter.segment(source, language)
-    html_code = chunks.html_serialize(attributes, max_length=max_length)
+    html_code = chunks.html_serialize(
+            attributes, max_length=max_length, use_wbr=wbr)
     return {
         'chunks': chunks,
         'html_code': html_code,
diff --git a/poc.py b/poc.py
new file mode 100644
index 0000000..a167f67
--- /dev/null
+++ b/poc.py
@@ -0,0 +1,11 @@
+import html5lib
+from html5lib import getTreeWalker
+from html5lib.filters import sanitizer
+from html5lib.constants import namespaces, prefixes
+content = '<span>This is <wbr> not a cat</span>'
+dom = html5lib.parseFragment(content)
+treewalker = getTreeWalker('etree')
+serializer = html5lib.serializer.HTMLSerializer()
+stream = treewalker(dom)
+output = serializer.render(sanitizer.Filter(stream, allowed_elements=set([(namespaces['html'], 'span')])))
+print(output)

Span, Zero-width space, or wbr elements?
I just learned this nice work.   It is particularly useful for dyslexia people.

In a meeting of the Japanese DAISY project for textbooks, we discussed how hints for line breaking should be represented.  The use of span elements was suggested.  But people do not want to use span elements for this purpose, because DAISY textbooks already too heavily use span elements for multi-media synchronization.  Thus, Keio Advanced Publishing Laboratory is inclined to adopt the zero-width space or wbr elements.  [Florian's personal draft](https://specs.rivoal.net/css-space-expansion/) is based on this assumption.  See https://github.com/w3c/jlreq/issues/17


diff --git a/tests/test_chunk.py b/tests/test_chunk.py
index 0163f9a..5754101 100644
--- a/tests/test_chunk.py
+++ b/tests/test_chunk.py
@@ -114,7 +114,7 @@ class TestChunkList(unittest.TestCase):
         [u'これが', '\n', 'Android'], [chunk.word for chunk in chunks],
         'Trailing spaces in CJK chunk should be converted to breaklines.')
 
-  def test_html_serialize(self):
+  def test_span_serialize(self):
     chunks = ChunkList(Chunk('Hello'), Chunk.space(), Chunk(u'今天'),
         Chunk(u'天气'), Chunk(u'很好'))
     attributes = {
@@ -127,7 +127,7 @@ class TestChunkList(unittest.TestCase):
         u'<span class="foo">天气</span>'
         u'<span class="foo">很好</span>'
         '</span>')
-    result = chunks.html_serialize(attributes, None)
+    result = chunks.span_serialize(attributes, None)
     self.assertEqual(
         result, expected,
         'The chunks should be compiled to a HTML code.')
@@ -140,7 +140,7 @@ class TestChunkList(unittest.TestCase):
     expected = ('<span>'
         'Hey&lt;&lt;script&gt;alert(1)&lt;/script&gt;&gt;guys'
         '</span>')
-    result = chunks.html_serialize(attributes, None)
+    result = chunks.span_serialize(attributes, None)
     self.assertEqual(
         result, expected, 'HTML tags included in a chunk should be encoded.')
 
@@ -155,7 +155,7 @@ class TestChunkList(unittest.TestCase):
         u'インフルエンザに'
         u'<span class="foo">かかった。</span>'
         '</span>')
-    result = chunks.html_serialize(attributes, 6)
+    result = chunks.span_serialize(attributes, 6)
     self.assertEqual(
         result, expected,
         'Chunks that exceed the max length should not be enclosed by a span.')
@@ -163,5 +163,15 @@ class TestChunkList(unittest.TestCase):
   # TODO (tushuhei) Check if TypeError is raised when any instance but Chunk
   # is given to the list.
 
+  def test_wbr_serialize(self):
+    chunks = ChunkList(Chunk(u'今日は'), Chunk(u'ご飯を'), Chunk(u'食べます。'))
+    result = chunks.wbr_serialize()
+    expected = (
+        '<span style="word-break: keep-all;">'
+        u'今日は<wbr></wbr>ご飯を<wbr></wbr>食べます。'
+        '</span>')
+    self.assertEqual(
+        result, expected, 'Chunks should be separated by WBR tags.')
+
 if __name__ == '__main__':
   unittest.main()

pip install -e .
parse_log_pytest
requirements.txt
sphinx pytest
apt-get update apt-get install -y gcc
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
-e git+https://github.com/google/budou.git@0bb774c1b0bf79aebb5b60917811157c49db6827#egg=budou
cachetools==4.2.4
certifi==2021.5.30
chardet==5.0.0
charset-normalizer==2.0.12
docopt==0.6.2
docutils==0.18.1
future==1.0.0
google-api-core==2.8.2
google-api-python-client==2.52.0
google-auth==2.22.0
google-auth-httplib2==0.2.0
googleapis-common-protos==1.56.3
html5lib==1.0.1
httplib2==0.22.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
packaging==21.3
pluggy==1.0.0
protobuf==3.19.6
py==1.11.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytz==2025.2
requests==2.27.1
rsa==4.9
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tinysegmenter3==0.1.0
tomli==1.2.3
typing_extensions==4.1.1
uritemplate==4.1.1
urllib3==1.26.20
webencodings==0.5.1
zipp==3.6.0

name: budou
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - cachetools==4.2.4
      - chardet==5.0.0
      - charset-normalizer==2.0.12
      - docopt==0.6.2
      - docutils==0.18.1
      - future==1.0.0
      - google-api-core==2.8.2
      - google-api-python-client==2.52.0
      - google-auth==2.22.0
      - google-auth-httplib2==0.2.0
      - googleapis-common-protos==1.56.3
      - html5lib==1.0.1
      - httplib2==0.22.0
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - packaging==21.3
      - pluggy==1.0.0
      - protobuf==3.19.6
      - py==1.11.0
      - pyasn1==0.5.1
      - pyasn1-modules==0.3.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytz==2025.2
      - requests==2.27.1
      - rsa==4.9
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tinysegmenter3==0.1.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - uritemplate==4.1.1
      - urllib3==1.26.20
      - webencodings==0.5.1
      - zipp==3.6.0
prefix: /opt/conda/envs/budou

tests/test_chunk.py::TestChunkList::test_span_serialize tests/test_chunk.py::TestChunkList::test_wbr_serialize
tests/test_chunk.py::TestChunk::test_has_cjk tests/test_chunk.py::TestChunk::test_is_open_punct tests/test_chunk.py::TestChunk::test_is_punt tests/test_chunk.py::TestChunkList::test_concatenate_inner tests/test_chunk.py::TestChunkList::test_get_overlaps tests/test_chunk.py::TestChunkList::test_insert_breaklines tests/test_chunk.py::TestChunkList::test_swap
budou/parser.py budou/budou.py poc.py budou/nlapisegmenter.py budou/chunk.py
budou/parser.py budou/budou.py poc.py budou/nlapisegmenter.py budou/chunk.py