以下拼写高级服务器端组件的设置是可选的。这些设置应添加到服务器端组件所需的配置中描述的application.conf文件中。

spelling(可选)

拼写服务具有以下可配置设置:

  • hunspell-dictionaries-path

  • custom-dictionaries-path

  • dynamic-custom-dictionaries

  • num-incorrect-words-in-suggestions-request-limit

hunspell-dictionaries-path(可选)

ephox.spelling.hunspell-dictionaries-path设置用于定义 Hunspell 字典的位置。如果未提供此设置,则不支持 Hunspell 字典。

要求:

Tiny 建议将 Hunspell 字典存储在类似于application.conf文件的位置。例如,如果application.conf位于名为/opt/ephox的目录中,则 Hunspell 字典应存储在子目录/opt/ephox/hunspell-dictionaries中。

示例:

ephox {
  spelling {
    hunspell-dictionaries-path: "/opt/ephox/hunspell-dictionaries"
  }
}

custom-dictionaries-path(可选)

有关创建自定义字典的信息,请参阅:添加自定义字典 - 创建自定义字典文件。

ephox.spelling.custom-dictionaries-path元素用于定义自定义字典的位置。如果未提供此设置,则不会加载任何自定义字典。

要求:

  • 包含自定义字典的目录必须作为卷挂载到容器中。

  • 该目录不应包含子目录或非字典文件。

Tiny 建议将自定义字典存储在类似于application.conf文件的位置。例如,如果application.conf位于名为/opt/ephox的目录中,则字典文件可以存储在子目录/opt/ephox/dictionaries中。

示例:

ephox {
  spelling {
    custom-dictionaries-path = "/opt/ephox/dictionaries"
  }
}

dynamic-custom-dictionaries(可选)

添加ephox.spelling.dynamic-custom-dictionaries元素并将其设置为true,指示拼写服务定期检查custom-dictionaries-path是否有更改,并相应地更新自定义字典。这允许在不重启拼写服务的情况下更新自定义字典。默认值为false。

示例:

ephox {
  spelling {
    custom-dictionaries-path = "/opt/ephox/dictionaries"
    dynamic-custom-dictionaries = true
  }
}

num-incorrect-words-in-suggestions-request-limit(可选)

添加num-incorrect-words-in-suggestions-request-limit元素并将其设置为一个数字,指示拼写服务拒绝任何针对/2/建议的请求,其中不正确单词的数量超过指定的限制。默认情况下没有限制。

示例:

ephox {
  spelling {
    num-incorrect-words-in-suggestions-request-limit = 100
  }
}