| OLD | NEW |
| 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. | 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. |
| 2 // limitations under the License. | 2 // limitations under the License. |
| 3 // See the License for the specific language governing permissions and | 3 // See the License for the specific language governing permissions and |
| 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 5 // distributed under the License is distributed on an "AS-IS" BASIS, | 5 // distributed under the License is distributed on an "AS-IS" BASIS, |
| 6 // Unless required by applicable law or agreed to in writing, software | 6 // Unless required by applicable law or agreed to in writing, software |
| 7 // | 7 // |
| 8 // http://www.apache.org/licenses/LICENSE-2.0 | 8 // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 // | 9 // |
| 10 // You may obtain a copy of the License at | 10 // You may obtain a copy of the License at |
| 11 // you may not use this file except in compliance with the License. | 11 // you may not use this file except in compliance with the License. |
| 12 // Licensed under the Apache License, Version 2.0 (the "License"); | 12 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 13 // | 13 // |
| 14 goog.provide('i18n.input.chrome.inputview.Covariance'); | 14 goog.provide('i18n.input.chrome.inputview.Covariance'); |
| 15 | 15 |
| 16 goog.require('i18n.input.chrome.inputview.elements.ElementType'); | 16 goog.require('goog.object'); |
| 17 goog.require('i18n.input.chrome.ElementType'); |
| 17 | 18 |
| 18 | 19 |
| 19 goog.scope(function() { | 20 goog.scope(function() { |
| 20 var ElementType = i18n.input.chrome.inputview.elements.ElementType; | 21 var ElementType = i18n.input.chrome.ElementType; |
| 21 | 22 |
| 22 | 23 |
| 23 | 24 |
| 24 /** | 25 /** |
| 25 * The covariance used for gaussian model. | 26 * The covariance used for gaussian model. |
| 26 * | 27 * |
| 27 * @constructor | 28 * @constructor |
| 28 */ | 29 */ |
| 29 i18n.input.chrome.inputview.Covariance = function() { | 30 i18n.input.chrome.inputview.Covariance = function() { |
| 30 /** @private {number} */ | 31 /** @private {number} */ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 | 48 |
| 48 /** | 49 /** |
| 49 * The key type. | 50 * The key type. |
| 50 * | 51 * |
| 51 * @type {!Object.<ElementType, number>} | 52 * @type {!Object.<ElementType, number>} |
| 52 */ | 53 */ |
| 53 Covariance.ElementTypeMap = goog.object.create( | 54 Covariance.ElementTypeMap = goog.object.create( |
| 54 ElementType.CHARACTER_KEY, 0, | 55 ElementType.CHARACTER_KEY, 0, |
| 55 ElementType.COMPACT_KEY, 1 | 56 ElementType.COMPACT_KEY, 1 |
| 56 ); | 57 ); |
| 57 | 58 |
| 58 | 59 |
| 59 /** | 60 /** |
| 60 * The value. | 61 * The value. |
| 61 * Key: the break down value. | 62 * Key: the break down value. |
| 62 * Value: A list - first is the covariance for full keyboard, second is for | 63 * Value: A list - first is the covariance for full keyboard, second is for |
| 63 * compact. | 64 * compact. |
| 64 * | 65 * |
| 65 * @private {!Object.<!Array.<number>>} | 66 * @private {!Object.<!Array.<number>>} |
| 66 */ | 67 */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 94 if (isA11y) { | 95 if (isA11y) { |
| 95 this.breakDown_ |= Covariance.BreakDown.A11Y; | 96 this.breakDown_ |= Covariance.BreakDown.A11Y; |
| 96 } | 97 } |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 | 100 |
| 100 /** | 101 /** |
| 101 * Gets the covariance value. | 102 * Gets the covariance value. |
| 102 * | 103 * |
| 103 * @param {ElementType} type . | 104 * @param {ElementType} type . |
| 105 * @return {number} The value. |
| 104 */ | 106 */ |
| 105 Covariance.prototype.getValue = function(type) { | 107 Covariance.prototype.getValue = function(type) { |
| 106 var index = Covariance.ElementTypeMap[type]; | 108 var index = Covariance.ElementTypeMap[type]; |
| 107 return Covariance.VALUE_[this.breakDown_][index]; | 109 return Covariance.VALUE_[this.breakDown_][index]; |
| 108 }; | 110 }; |
| 109 | 111 |
| 110 }); // goog.scope | 112 }); // goog.scope |
| 111 | 113 |
| OLD | NEW |