code: def inline_parse(text, verbose=False):
      
      if isinstance(text, str):
          text = text.decode('utf-8')
  
      parsed = parse(text, verbose=verbose)
  
      shift = 0
      for quantity in parsed:
          index = quantity.span[1] + shift
          to_add = u' {' + unicode(quantity) + u'}'
          text = text[0:index] + to_add + text[index:]
          shift += len(to_add)
  
      return text
docs: Extract all quantities from unstructured text.