I want to extract a certain number of words surrounding a given word in a long string(paragraph) in Python 2.7
问题 I am trying to extract a selected number of words surrounding a given word. I will give example to make it clear: string = "Education shall be directed to the full development of the human personality and to the strengthening of respect for human rights and fundamental freedoms." 1) The selected word is development and I need to get the 6 words surrounding it, and get : [to, the, full, of, the, human] 2) But if the selected word is in the beginning or in second position I still need to get 6