code: def set_by_text(self, text, pos=0, left=0):
      depth = 0
      right = left
      for i in range(pos + 1, len(text)):
          char = text[i]
          # update the depth
          if char == "(":
              depth += 1
              if depth == 1:
                  subtree = PTBTree()
                  subtree.parent = self
                  subtree.set_by_text(text, i, right)
                  right = subtree.span[1]
                  self.span = (left, right)
                  self.subtrees.append(subtree)
          elif char == ")":
              depth -= 1
              if len(self.subtrees) == 0:
                  pos = i
                  for j in range(i, 0, -1):
                      if text[j] == " ":
                          pos = j
                          break
                  self.word = text[pos + 1 : i]
                  self.span = (left, left + 1)
  
          # we've reached the end of the category that is the root of this subtree
          if depth == 0 and char == " " and self.label == "":
              self.label = text[pos + 1 : i]
          # we've reached the end of the scope for this bracket
          if depth < 0:
              break
  
      # Fix some issues with variation in output, and one error in the treebank
      # for a word with a punctuation POS
      self.standardise_node()
  
imports: import logging
  import os
  import pickle
  from collections import Counter
  import numpy
  import torch
  from torch.utils import data
label_desc: Use image node_id 3 for calling the PTBTree obj's underlying member method code with example usage: obj.set_by_text(text, pos, left) without return types