本文整理汇总了Java中com.swabunga.spell.event.StringWordTokenizer类的典型用法代码示例。如果您正苦于以下问题:Java StringWordTokenizer类的具体用法?Java StringWordTokenizer怎么用?Java StringWordTokenizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringWordTokenizer类属于com.swabunga.spell.event包,在下文中一共展示了StringWordTokenizer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMisspelledWords
import com.swabunga.spell.event.StringWordTokenizer; //导入依赖的package包/类
/**
* get a list of misspelled words from the text
* @param text
*/
public List<String> getMisspelledWords(String text) {
StringWordTokenizer texTok = new StringWordTokenizer(text,
new TeXWordFinder());
spellChecker.checkSpelling(texTok);
return misspelledWords;
}
开发者ID:ikhamlic,项目名称:esct-messenger-bot,代码行数:11,代码来源:JazzySpellChecker.java
示例2: check
import com.swabunga.spell.event.StringWordTokenizer; //导入依赖的package包/类
public void check(IDocument document, IRegion[] regions, SpellingContext context,
ISpellingProblemCollector collector, IProgressMonitor monitor) {
if (ignore == null) {
ignore = new HashSet<String>();
}
IProject project = getProject(document);
String lang = DEFAULT_LANG;
if (project != null) {
lang = TexlipseProperties.getProjectProperty(project, TexlipseProperties.LANGUAGE_PROPERTY);
}
//Get spellchecker for the correct language
SpellChecker spellCheck = getSpellChecker(lang);
if (spellCheck == null) return;
if (collector instanceof TeXSpellingProblemCollector) {
((TeXSpellingProblemCollector) collector).setRegions(regions);
}
try {
spellCheck.addSpellCheckListener(this);
for (final IRegion r : regions) {
errors = new LinkedList<SpellCheckEvent>();
int roffset = r.getOffset();
//Create a new wordfinder and initialize it
TexlipseWordFinder wf = new TexlipseWordFinder();
wf.setIgnoreComments(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_COMMENTS));
wf.setIgnoreMath(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_MATH));
spellCheck.checkSpelling(new StringWordTokenizer(
document.get(roffset, r.getLength()), wf));
for (SpellCheckEvent error : errors) {
SpellingProblem p = new TexSpellingProblem(error, roffset, lang);
collector.accept(p);
}
}
spellCheck.removeSpellCheckListener(this);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
开发者ID:eclipse,项目名称:texlipse,代码行数:46,代码来源:TexSpellingEngine.java
示例3: validate
import com.swabunga.spell.event.StringWordTokenizer; //导入依赖的package包/类
/**
* WARN in case of spellcheck error using property locale.
*/
public int validate(Property property, List<L10nReportItem> reportItems) {
Locale locale = property.getLocale();
if (locale == null) {
// Case of root bundle
locale = Locale.ENGLISH;
}
SpellChecker spellChecker = spellCheckerLocaleRepository.getSpellChecker(locale);
if (spellChecker != null) {
ListSpellCheckErrorListener listener = new ListSpellCheckErrorListener(spellChecker);
spellChecker.addSpellCheckListener(listener);
String message = property.getMessage();
spellChecker.checkSpelling(new StringWordTokenizer(message));
Collection<SpellCheckError> errors = listener.getSpellCheckErrors();
// The message with errors replaced by suggestions
String correction = message;
// Start from last errors, so that error position remains valid
SpellCheckError[] errs = errors.toArray(new SpellCheckError[errors.size()]);
for (int i = errs.length - 1; i >= 0; i--) {
SpellCheckError error = errs[i];
if (error.getSuggestion() != null) {
int pos = error.getPosition();
correction = StringUtils.overlay(correction, error.getSuggestion(), pos, pos + error.getError().length());
}
}
if (errors.size() > 0) {
StringBuffer sb = new StringBuffer();
sb.append("Spellcheck error on word(s): ").append(errors.toString()).append(" and locale <").append(locale).append(">.");
if (correction != null) {
sb.append(" Suggested correction: [").append(correction).append("]");
}
L10nReportItem reportItem = new L10nReportItem(Type.SPELLCHECK, sb.toString(), property, null);
reportItems.add(reportItem);
logger.log(reportItem);
}
spellChecker.removeSpellCheckListener(listener);
}
return 0;
}
开发者ID:rquinio,项目名称:l10n-maven-plugin,代码行数:50,代码来源:SpellCheckValidator.java
示例4: spellCorrect
import com.swabunga.spell.event.StringWordTokenizer; //导入依赖的package包/类
public String spellCorrect(String text) {
StringWordTokenizer swt = new StringWordTokenizer(text);
spellChecker.checkSpelling(swt);
return swt.getContext();
}
开发者ID:jatecs,项目名称:jatecs,代码行数:6,代码来源:SpellCheck.java
示例5: checkWords
import com.swabunga.spell.event.StringWordTokenizer; //导入依赖的package包/类
public void checkWords(String bodyText) {
mMisspelledWords.clear();
mSuggestions.clear();
mOriginalText = bodyText;
jazzySpellCheck.checkSpelling(new StringWordTokenizer(bodyText)); // *asynchronous
}
开发者ID:scheah,项目名称:eulexia,代码行数:7,代码来源:SpellCheck.java
示例6: misspelled
import com.swabunga.spell.event.StringWordTokenizer; //导入依赖的package包/类
public static int misspelled(String text) throws IOException {
new FeatureGenerator();
return spellChecker.checkSpelling(new StringWordTokenizer(text));
}
开发者ID:ajaybhat,项目名称:Essay-Grading-System,代码行数:5,代码来源:FeatureGenerator.java
示例7: checkSpelling
import com.swabunga.spell.event.StringWordTokenizer; //导入依赖的package包/类
public void checkSpelling(String string) {
if (spellCheck != null) {
this.errors.clear();
this.spellCheck.checkSpelling(new StringWordTokenizer(string));
}
}
开发者ID:killjoy1221,项目名称:TabbyChat-2,代码行数:7,代码来源:Spellcheck.java
注:本文中的com.swabunga.spell.event.StringWordTokenizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论