code: def words_and_tags_from_wsj_tree(tree_string):
      """Generates linearized trees and tokens from the wsj tree format.
  
      It uses the linearized algorithm described in https://arxiv.org/abs/1412.7449.
  
      Args:
        tree_string: tree in wsj format
  
      Returns:
        tuple: (words, linearized tree)
      """
      stack, tags, words = [], [], []
      for tok in tree_string.strip().split():
          if tok[0] == "(":
              symbol = tok[1:]
              tags.append(symbol)
              stack.append(symbol)
          else:
              assert tok[-1] == ")"
              stack.pop()  # Pop the POS-tag.
              while tok[-2] == ")":
                  tags.append("/" + stack.pop())
                  tok = tok[:-1]
              words.append(tok[:-1])
      return str.join(" ", words), str.join(" ", tags[1:-1])
  
file_path: tensor2tensor/tensor2tensor/data_generators/wsj_parsing.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import flags
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: words_and_tags_from_wsj_tree(tree_string) and returns: str,  str