Reikon

Reikon (霊魂), in Shinto, is the equivalent to the soul or spirit in Western culture.

Japanese tradition
When a person dies, it is believed that their reikon will remain in a type of purgatory until they are given proper funeral rites. After which, the reikon will join their ancestors in the afterlife and only returning to the living world every August for the Obon Festival.

Yūrei
When a person dies in an unexpected, violent or traumatic way, the reikon remains amongst the living as a yūrei, or ghost, who must complete an unfinished duty amongst the living or be given a proper ritual to ease its passing into the next world. A yūrei is thought to be produced by violent means such as murder or suicide. These tend to take on a fixed desire emotion such as revenge, love, jealousy, hatred, or sorrow while carrying out their hauntings.