get term depth function