title: Calculating number of T-units in a given sentence using Python
body: <p>I've been working on a second language development project. I need to calculate the <a href="https://en.wikipedia.org/wiki/L2_Syntactic_Complexity_Analyzer" rel="nofollow noreferrer">t-unit</a> of a given sentence using Python. For example, for the following sentences:</p>
  <pre><code>The man did not like water.
  </code></pre>
  <p>1 t-unit (The man did not like water)</p>
  <pre><code>The man did not like water although he lived by the sea.
  </code></pre>
  <p>1 t-unit (The man did not like water although he lived by the sea)</p>
  <pre><code>The man never liked water and he certainly did not like living in the swamp with her grandparents.
  </code></pre>
  <p>1 t-unit (The man never liked water)
  1 t-unit (he certainly did not like living in the swamp with her grandparents)</p>
  <pre><code>The man did not like water or juice.
  </code></pre>
  <p>1 t-unit (The man did not like water or juice)</p>
  <p>I've checked out nltk, spacy and stanford nlp (stanza) but found out that they don't include such t-unit detection at all.</p>
  <p>I've come across <a href="https://stackoverflow.com/questions/65227103/clause-extraction-long-sentence-segmentation-in-python">this</a> but it is about clause extraction.</p>
  <p>Any idea how I can detect such t-units using Python?</p>