All Projects → houbb → Word Checker

houbb / Word Checker

Licence: apache-2.0
🇨🇳🇬🇧Chinese and English word spelling corrector.(中文易错别字检测,中文拼写检测纠正。英文单词拼写校验工具)

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Word Checker

rgpipe
lesspipe for ripgrep for common new filetypes using few dependencies
Stars: ✭ 21 (-56.25%)
Mutual labels:  word
Docx
a ruby library/gem for interacting with .docx files
Stars: ✭ 288 (+500%)
Mutual labels:  word
Ngram2vec
Four word embedding models implemented in Python. Supporting arbitrary context features
Stars: ✭ 703 (+1364.58%)
Mutual labels:  word
lingose-notation
The best mnemonics and notational system of English words.
Stars: ✭ 17 (-64.58%)
Mutual labels:  word
Unioffice
Pure go library for creating and processing Office Word (.docx), Excel (.xlsx) and Powerpoint (.pptx) documents
Stars: ✭ 3,111 (+6381.25%)
Mutual labels:  word
Lmdb Embeddings
Fast word vectors with little memory usage in Python
Stars: ✭ 404 (+741.67%)
Mutual labels:  word
craXcel-cli
Command line application to unlock Microsoft Office password protected files.
Stars: ✭ 44 (-8.33%)
Mutual labels:  word
Desktopeditors
An office suite that combines text, spreadsheet and presentation editors allowing to create, view and edit local documents
Stars: ✭ 1,008 (+2000%)
Mutual labels:  word
Vuewordcloud
Generates a cloud out of the words.
Stars: ✭ 284 (+491.67%)
Mutual labels:  word
Vicword
一个纯php分词
Stars: ✭ 516 (+975%)
Mutual labels:  word
gscloudplugin
浏览器打印PDF。 浏览器打印HTML。 浏览器打印图片。 浏览器打印Word。浏览器打印Excel。浏览器打印PPT。浏览器打印自定义绘图。浏览器打印微软报表。 使用静默方式打印。蓝牙打印。读写串口数据。读取电子秤重量
Stars: ✭ 18 (-62.5%)
Mutual labels:  word
GemBox.Document.Examples
Read, write, convert and print document files (DOCX, DOC, PDF, HTML, XPS, RTF, and TXT) in a simple and efficient way.
Stars: ✭ 53 (+10.42%)
Mutual labels:  word
Officer
👮 officer: office documents from R
Stars: ✭ 405 (+743.75%)
Mutual labels:  word
Twelveish
🕛 Twelveish - Android Wear/Wear OS Watch Face
Stars: ✭ 29 (-39.58%)
Mutual labels:  word
Docconv
Converts PDF, DOC, DOCX, XML, HTML, RTF, etc to plain text
Stars: ✭ 735 (+1431.25%)
Mutual labels:  word
docxmustache
laravel 8.x docx template manipulation class, based on mustache templating language
Stars: ✭ 34 (-29.17%)
Mutual labels:  word
Sensitive
敏感词查找,验证,过滤和替换 🤓 FindAll, Validate, Filter and Replace words.
Stars: ✭ 292 (+508.33%)
Mutual labels:  word
Word2html
a quick and dirty script to convert a Word (docx) document to html.
Stars: ✭ 44 (-8.33%)
Mutual labels:  word
Gotenberg Go Client
Go client for the Gotenberg API
Stars: ✭ 35 (-27.08%)
Mutual labels:  word
Fiduswriter
Fidus Writer is an online collaborative editor for academics.
Stars: ✭ 405 (+743.75%)
Mutual labels:  word

项目简介

本项目用于单词拼写检查。

目前支持英文单词拼写检测,后期将引入中文拼写检测。

Maven Central Build Status Coverage Status Open Source Love

特性说明

支持英文的单词纠错

  • 可以迅速判断当前单词是否拼写错误

  • 可以返回最佳匹配结果

  • 可以返回纠正匹配列表,支持指定返回列表的大小

  • 错误提示支持 i18n

  • 支持大小写、全角半角格式化处理

  • 支持自定义词库

v0.0.5 最新变更

  • 支持基本的中文拼写检测

变更日志

快速开始

JDK 版本

Jdk 1.7+

maven 引入

<dependency>
     <groupId>com.github.houbb</groupId>
     <artifactId>word-checker</artifactId>
    <version>0.0.5</version>
</dependency>

gradle 引入

compile group: 'com.github.houbb', name: 'word-checker', version: '0.0.5'

测试案例

会根据输入,自动返回最佳纠正结果。

final String speling = "speling";
Assert.assertEquals("spelling", EnWordCheckers.correct(speling));

核心 api 介绍

核心 api 在 EnWordCheckers 工具类下。

功能 方法 参数 返回值 备注
判断单词拼写是否正确 isCorrect(string) 待检测的单词 boolean
返回最佳纠正结果 correct(string) 待检测的单词 String 如果没有找到可以纠正的单词,则返回其本身
判断单词拼写是否正确 correctList(string) 待检测的单词 List 返回所有匹配的纠正列表
判断单词拼写是否正确 correctList(string, int limit) 待检测的单词, 返回列表的大小 返回指定大小的的纠正列表 列表大小 <= limit

测试例子

参见 EnWordCheckerTest.java

是否拼写正确

final String hello = "hello";
final String speling = "speling";
Assert.assertTrue(EnWordCheckers.isCorrect(hello));
Assert.assertFalse(EnWordCheckers.isCorrect(speling));

返回最佳匹配结果

final String hello = "hello";
final String speling = "speling";
Assert.assertEquals("hello", EnWordCheckers.correct(hello));
Assert.assertEquals("spelling", EnWordCheckers.correct(speling));

默认纠正匹配列表

final String word = "goo";
List<String> stringList = EnWordCheckers.correctList(word);
Assert.assertEquals("[go, good, too, god, got, oo, goot, foo]", stringList.toString());

指定纠正匹配列表大小

final String word = "goo";
final int limit = 2;
List<String> stringList = EnWordCheckers.correctList(word, limit);
Assert.assertEquals("[go, good]", stringList.toString());

中文拼写纠正

核心 api

为降低学习成本,核心 api 和 ZhWordCheckers 中,和英文拼写检测保持一致。

是否拼写正确

final String right = "正确";
final String error = "万变不离其中";

Assert.assertTrue(ZhWordCheckers.isCorrect(right));
Assert.assertFalse(ZhWordCheckers.isCorrect(error));

返回最佳匹配结果

final String right = "正确";
final String error = "万变不离其中";

Assert.assertEquals("正确", ZhWordCheckers.correct(right));
Assert.assertEquals("万变不离其宗", ZhWordCheckers.correct(error));

默认纠正匹配列表

final String word = "万变不离其中";

List<String> stringList = ZhWordCheckers.correctList(word);
Assert.assertEquals("[万变不离其宗]", stringList.toString());

指定纠正匹配列表大小

final String word = "万变不离其中";
final int limit = 1;

List<String> stringList = ZhWordCheckers.correctList(word, limit);
Assert.assertEquals("[万变不离其宗]", stringList.toString());

格式化处理

有时候用户的输入是各式各样的,本工具支持对于格式化的处理。

大小写

大写会被统一格式化为小写。

final String word = "stRing";

Assert.assertTrue(EnWordCheckers.isCorrect(word));

全角半角

全角会被统一格式化为半角。

final String word = "string";

Assert.assertTrue(EnWordCheckers.isCorrect(word));

自定义词库

自定义词库

你可以在项目资源目录创建文件 resources/data/define_word_checker_en.txt

内容如下:

my-long-long-define-word,2
my-long-long-define-word-two

不同的词独立一行。

每一行第一列代表单词,第二列代表出现的次数,二者用逗号 , 隔开。

次数越大,在纠正的时候返回优先级就越高,默认值为 1。

用户自定义的词库优先级高于系统内置词库。

测试代码

我们在指定了对应的单词之后,拼写检测的时候就会生效。

final String word = "my-long-long-define-word";
final String word2 = "my-long-long-define-word-two";

Assert.assertTrue(EnWordCheckers.isCorrect(word));
Assert.assertTrue(EnWordCheckers.isCorrect(word2));

后期 Road-Map

  • 支持英文分词,处理整个英文句子

  • 支持中文分词拼写检测

  • 引入中文纠错算法,同音字和形近字处理。

  • 支持中英文混合拼写检测

技术鸣谢

Words 提供的原始英语单词数据。

文档参考

ENABLE word list

spell-correct

spellchecking

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].