- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用语言工具创建用于拼写检查的字典?我不是 Java 程序员,这是我第一次看到 LT。
最佳答案
您好,这是我使用语言工具创建拼写检查字典的经验!希望你喜欢它。
第 1 部分:如何创建字典
你需要:
• 包含字典的 .txt 文件
• 一个.info 文件,指定有关如何设置LT 输出文件的信息(它已存在于LT 目录中)。
• LanguageTool 独立版本
• Java 8
在本节结束时,您将拥有:
• .dict 文件,即 LT 可读格式的带有字典的文件
@Override
public List<Rule> getRelevantRules(ResourceBundle messages) throws IOException {
return Arrays.asList(
new CommaWhitespaceRule(messages),
new DoublePunctuationRule(messages),
new GenericUnpairedBracketsRule(messages,
Arrays.asList("[", "(", "{" /*"«", "‘"*/),
Arrays.asList("]", ")", "}"
/*"»", French dialog can contain multiple sentences. */
/*"’" used in "d’arm" and many other words */)),
new MorfologikYourLanguageSpellerRule(messages, this),
new UppercaseSentenceStartRule(messages, this),
new MultipleWhitespaceRule(messages, this),
new SentenceWhitespaceRule(messages),
// specific to French:
new CompoundRule(messages),
new QuestionWhitespaceRule(messages)
);
}
/* LanguageTool, a natural language style checker
* Copyright (C) 2012 Marcin Miłkowski (http://www.languagetool.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*/
package org.languagetool.rules.fr;
import java.io.IOException;
import java.util.ResourceBundle;
import org.languagetool.Language;
import org.languagetool.rules.spelling.morfologik.MorfologikSpellerRule;
public final class MorfologikYourLanguageSpellerRule extends MorfologikSpellerRule {
public static final String RULE_ID = "MORFOLOGIK_RULE_CODEOFYOURLANGUAGE"; /* for ex. Fr_FR for French */
private static final String RESOURCE_FILENAME = "PATH TO YOUR .DICT FILE";
public MorfologikFrenchSpellerRule(ResourceBundle messages,
Language language) throws IOException {
super(messages, language);
}
@Override
public String getFileName() {
return RESOURCE_FILENAME;
}
@Override
public String getId() {
return RULE_ID;
}
}
关于java - 在 LanguageTool 中,如何创建字典并将其用于拼写检查?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37412145/
我想通过用语言环境拼写数字来本地化数字,最后使用了 ICU4J。我在许多地区都取得了成功,但似乎没有在格鲁吉亚、土耳其或阿拉伯语等地区完成。 ULocale locale = new ULocale(
我正在研究具有端点的 swagger API 规范: /authorizations 我也想为这个端点定义一个替代拼写(授权)。这可能吗?或者我是否需要为每个拼写定义一个单独的路由? /authori
我正在研究具有端点的 swagger API 规范: /authorizations 我也想为这个端点定义一个替代拼写(授权)。这可能吗?或者我是否需要为每个拼写定义一个单独的路由? /authori
我使用 Yahoo BOSS 的时间很短。这是一个简单的搜索 API,但拼写建议支持确实不那么强大。周围的人是否有任何关于在 BOSS 上获得更好的拼写建议的想法。 最佳答案 不幸的是,甚至在几年后,
问题如下:我正在编写一个强力解密器来破解一些 super secret 代码(这是一场竞赛,而不是犯罪),结果证明这是不可能的:树中的节点太多需要被搜查。为了克服这个问题,我认为检查中间“解决方案”以
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this qu
我是一名优秀的程序员,十分优秀!