Why does the MacOS Keyboard with Predictive Completion produce 心情舒暢? I recently read a post here on CSE regarding the use of multiple input methods. I use MacOSX 10.9 so I began experimenting with an interesting aspect of the operating system called predictive completion. I added a Cangjie input source to my system and typed the letter P and selected the first option (心), the OS then offered (情) as the next first option, followed by 舒暢.
Can someone please explain the framework used by MacOSX to produce predictive Chinese grammar?
I am more interested in whether choosing the top choices along any given thread will produce reliable grammatical structures rather than the technology behind it. Although, if known, I would appreciate an understanding of the logic behind this option as well (on initial inspection, the completions do not appear to come from the dictionary).
Please let me know if I need to clarify this further.

(System Preferences &gt; Keyboard &gt; Input Sources)
This has very little to do with grammar. It is more likely making logical word associations. I have no idea what Cangjie is or how it works － but if you take out an iPhone or iPad or any iDevice and type in xin you can repeat the process that you just did in MacOS, i.e.: 心--&gt;情--&gt;舒暢 (these being the top recommended choices).
Wikipedia talks about this here:

Word prediction
Word prediction (simplified Chinese: 联想; traditional Chinese: 聯想;
pinyin: liánxiǎng; literally &quot;association&quot;) is a feature of an input
method that attempts to guess the next series of characters that the
user is attempting to enter. This feature is often used to refer to
two different mechanisms that have similar functions.
One of these mechanisms is akin to an auto-complete function for user
input. While the user is typing the appropriate pinyin, the input
method would take the input and look up all possible word phrases that
might match the user input even though the input is incomplete. For
example, when the user enters &quot;shang&quot;, the input method would show
&quot;上海&quot; (Shanghai) as a word candidate under this feature.
The second possible mechanism is the prediction of the user's next
input after the user completes entering a set of words. For example,
in the above example, after user selects &quot;上海&quot; (Shanghai) from the word
candidate list, the input method's pinyin buffer would be empty. Under
this mechanism, the input method would display a list of words that
often follows the word Shanghai, such as &quot;人&quot; (people), &quot;市&quot; (city), &quot;的&quot;
(an auxiliary word).

edit: this kind of 'word prediction' is a key feature of all Chinese IMEs.