OLD | NEW |
1 Name: Compact Language Detection 2 | 1 Name: Compact Language Detection 2 |
2 Short Name: cld_2 | 2 Short Name: cld_2 |
3 URL: https://code.google.com/p/cld2/ | 3 URL: https://code.google.com/p/cld2/ |
4 Version: 0 | 4 Version: 0 |
5 License: Apache 2.0 | 5 License: Apache 2.0 |
6 Security Critical: yes | 6 Security Critical: yes |
7 | 7 |
8 Description: | 8 Description: |
9 The CLD is used to determine the language of text. In Chromium, this is used | 9 The CLD is used to determine the language of text. In Chromium, this is used |
10 to determine if Chrome should offer Translate UX to the user. | 10 to determine if Chrome should offer Translate UX to the user. |
(...skipping 24 matching lines...) Expand all Loading... |
35 and less accurate) can be dynamically downloaded or chosen depending | 35 and less accurate) can be dynamically downloaded or chosen depending |
36 on runtime choices. | 36 on runtime choices. |
37 | 37 |
38 Cons: | 38 Cons: |
39 * Data files must be generated and checked into source control by hand. | 39 * Data files must be generated and checked into source control by hand. |
40 * At runtime a data file must be opened and its headers parsed before CLD2 | 40 * At runtime a data file must be opened and its headers parsed before CLD2 |
41 can be used in any given process (this time should be negligible in most | 41 can be used in any given process (this time should be negligible in most |
42 circumstances). This will prevent language detection from working until | 42 circumstances). This will prevent language detection from working until |
43 a data file has been loaded. | 43 a data file has been loaded. |
44 | 44 |
45 To enable dynamic mode, set 'cld_dynamic' to '1' in ../../build/common.gypi. | 45 To enable dynamic mode in CLD2 itself, you must define "CLD2_DYNAMIC_MODE". |
| 46 In Chromium, this is controlled by the 'cld2_data_source' variable in |
| 47 ../../build/common.gypi. |
46 | 48 |
47 For more information on the changes required to use dynamic mode, see: | |
48 https://codereview.chromium.org/187393005 | |
49 | 49 |
| 50 Building a CLD2 Dynamic Mode Data File |
| 51 ====================================== |
| 52 Note: The cld_2_dynamic_data_tool target is not currently supported on Android. |
| 53 The binaries that it generates are platform-independent, but to build |
| 54 the target itself you'll need a desktop environment. |
| 55 |
| 56 1. Configure your desired table size by setting the value of "cld2_table_size" |
| 57 in ../../build/common.gypi. |
| 58 2. Build the "cld_2_dynamic_data_tool" target. This will generate the tool: |
| 59 ${BUILD_DIR}/cld_2_dynamic_data_tool |
| 60 3. Run the tool with "--dump <file>" to generate a data file, e.g.: |
| 61 ${BUILD_DIR}/cld_2_dynamic_data_tool --dump /tmp/cld2_data.bin |
| 62 4. (Optional) Verify that the file was correctly written: |
| 63 ${BUILD_DIR}/cld_2_dynamic_data_tool --verify /tmp/cld2_data.bin |
| 64 |
| 65 The data file is suitable for use on all platforms. |
OLD | NEW |