The typical approach is something like a tree kernel (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Tree_kernel" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Tree_kernel</a>). Looked into them briefly for a work project that never got off the ground, can&#x27;t say too much about using them in practice.