Yes, but not limited to nltk. One way to use syntactic distance is the Part Of Speech (POS Tagging) tag, which maps each sentence word to a specific tag: https://en.wikipedia.org/wiki/Part-of-speech_tagging
For example, it displays your suggestions:
Text1: noun noun noun
Text2: noun noun noun
Then you can measure the distance of these two sentences.
And for semantics, you need a semantic network of words and find synonyms for each word in a sentence, then try to find the intersection of the synonyms of words in each sentence
source share