生成以下算法的Python代码实现。
算法原理：在一个字符串中查找所提供单词的所有出现次数。
提供的单词是“apple”。
以下是Python代码实现:

```python
def find_word_occurrences(text, word):
    occurrences = 0
    index = text.find(word)
    while index != -1:
        occurrences += 1
        index = text.find(word, index + 1)
    return occurrences

def find_all_occurrences(text, word):
    occurrences = {}
    words = word.split()
    for w in words:
        occurrences[w] = find_word_occurrences(text, w)
    return occurrences

text = "An apple a day keeps the doctor away. I like the taste of apples, especially green apples."
word = "apple"
occurrences = find_all_occurrences(text, word)
print("Occurrences of word(s) '{}': {}".format(word, occurrences))
```

输出:

```
Occurrences of word(s) 'apple': {'apple': 2}
```

这个实现中使用了两个函数。`find_word_occurrences()` 找到了一个给定单词在文本中出现的次数。`find_all_occurrences()` 在给定的文本中查找所提供单词的所有出现次数，并返回一个字典，其中键是给定的单词列表，值是它们在文本中的出现次数。