<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def detect_infinitive_phrase(sentence):
 """Given a string, return true if it is an infinitive phrase fragment"""


    # eliminate sentences without to
    if not 'to' in sentence.lower():
        return False

    doc = nlp(sentence)
    prev_word = None
    for w in doc:
        # if statement will execute exactly once
        if prev_word == 'to':
            if w.dep_ == 'ROOT' and w.tag_.startswith('VB'): 
                return True # this is quite likely to be an infinitive phrase
            else:
                return False
        prev_word = w.text.lower()