Skip to content

Commit

Permalink
Add a switch to control which CLD2 tables are used at build time.
Browse files Browse the repository at this point in the history
Mobile platforms have traditionally opted for smaller binaries. These options allow mobile
platforms some flexibility in trading language detection accuracy for binary size.

BUG=

Review URL: https://codereview.chromium.org/203073007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257949 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
andrewhayden@chromium.org committed Mar 19, 2014
1 parent 4474426 commit 61753f2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
9 changes: 9 additions & 0 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,14 @@
# 2: Use only CLD2.
'cld_version%': 2,

# For CLD2, the size of the tables that should be included in the build
# Only evaluated if cld_version == 2.
# See third_party/cld_2/cld_2.gyp for more information.
# 0: Small tables, lower accuracy
# 1: Medium tables, medium accuracy
# 2: Large tables, high accuracy
'cld2_table_size%': 2,

# Enable spell checker.
'enable_spellcheck%': 1,

Expand Down Expand Up @@ -978,6 +986,7 @@
'enable_spellcheck%': '<(enable_spellcheck)',
'enable_google_now%': '<(enable_google_now)',
'cld_version%': '<(cld_version)',
'cld2_table_size%': '<(cld2_table_size)',
'enable_captive_portal_detection%': '<(enable_captive_portal_detection)',
'disable_ftp_support%': '<(disable_ftp_support)',
'enable_task_manager%': '<(enable_task_manager)',
Expand Down
25 changes: 21 additions & 4 deletions third_party/cld_2/cld_2.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Note to maintainers: In the January 2014 release (*_0122*), there are some
# options for building:
# Pick one quadgram file (cld2_generated_quadchrome*.cc):
# 0122_16 = 160K entries, smallest size, lowest accuracy
# 0122_19 = 192K entries, medium size, medium accuracy
# 0122_2 = 256K entries, largest size, highest accuracy
# 0122_16 = 160K entries, smallest size, lowest accuracy (set cld2_table_size=0)
# 0122_19 = 192K entries, medium size, medium accuracy (set cld2_table_size=1)
# 0122_2 = 256K entries, largest size, highest accuracy (set cld2_table_size=2)
#
# For the CJK bigram file (cld_generated_cjk_delta_bi*.cc), always use
# cld_generated_cjk_delta_bi_4.cc, as this is intended for use with Chromium.
Expand All @@ -27,7 +27,6 @@
'src/internal/cld2_generated_cjk_compatible.cc',
'src/internal/cld2_generated_deltaoctachrome0122.cc',
'src/internal/cld2_generated_distinctoctachrome0122.cc',
'src/internal/cld2_generated_quadchrome0122_2.cc',
'src/internal/cld2tablesummary.h',
'src/internal/cld_generated_cjk_delta_bi_4.cc',
'src/internal/cld_generated_cjk_uni_prop_80.cc',
Expand Down Expand Up @@ -77,6 +76,24 @@
['OS=="win"', {
'msvs_disabled_warnings': [4267],
}],
['cld2_table_size==0', {
# Small table sizes
'sources+': [
'src/internal/cld2_generated_quadchrome0122_16.cc',
],
}],
['cld2_table_size==1', {
# Medium table sizes
'sources+': [
'src/internal/cld2_generated_quadchrome0122_19.cc',
],
}],
['cld2_table_size==2', {
# Large table sizes
'sources+': [
'src/internal/cld2_generated_quadchrome0122_2.cc',
],
}],
],
},
],
Expand Down

0 comments on commit 61753f2

Please sign in to comment.