有没有人找到一种解决方法来获取自定义字典支持,以用于 WPF TextBoxes/RichTextBoxes 上的内置拼写检查?我们一直在用 Reflector 探测拼写,希望找到字典条目的来源,但它看起来很像一个 COM 对象......
我知道它目前不受支持,并且微软正在考虑在未来的版本中支持它,但那是很久以前的事了,我似乎找不到任何有关它的最新消息。
我紧握着木头,在 Connect 上发布了一条建议:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=470233
当我在 TFS VS2010 中的工作项字段(例如 PBI 或 Bug)中输入文本时,我希望能够检查我的拼写(和语法)。我找到了这个插件并安装了它。除了运行安装程序之外我还应该做什么吗?输入工作项目时找不到任何拼写检查按钮。
知道为什么会发生这种情况吗?
安装有什么问题吗?
有没有更好的方法为 TFS 中的工作项添加拼写检查功能?
我发现许多网站提供了如何将自定义拼写检查字典添加到单个文本框的示例,如下所示:
<TextBox SpellCheck.IsEnabled="True" >
<SpellCheck.CustomDictionaries>
<sys:Uri>customdictionary.lex</sys:Uri>
</SpellCheck.CustomDictionaries>
</TextBox>
Run Code Online (Sandbox Code Playgroud)
我已经在我的应用程序中对此进行了测试,效果很好。
然而,我有行业特定的术语,我需要在应用程序中的所有文本框中忽略这些术语,并且将这个自定义词典单独应用于每个文本框似乎是在样式面前吐口水。目前我有一个全局文本框样式来打开拼写检查:
<Style TargetType="{x:Type TextBox}">
<Setter Property="SpellCheck.IsEnabled" Value="True" />
</Style>
Run Code Online (Sandbox Code Playgroud)
我尝试执行类似的操作来添加自定义字典,但它不喜欢它,因为 SpellCheck.CustomDictionaries 是只读的,并且设置器仅采用可写属性。
<Style TargetType="{x:Type TextBox}">
<Setter Property="SpellCheck.IsEnabled" Value="True" />
<Setter Property="SpellCheck.CustomDictionaries">
<Setter.Value>
<sys:Uri>CustomSpellCheckDictionary.lex</sys:Uri>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
我已经进行了大量搜索来寻找这个问题的答案,但所有示例仅显示第一个代码块中引用的特定文本框中的一次性场景。任何帮助表示赞赏。
我不要任何代码。我真的很想自己学习逻辑,但我需要指出正确的方向。伪代码没问题。我基本上需要使用哈希表作为我的主要数据结构来创建拼写检查器。我知道它可能不是这项工作的最佳数据结构,但它是我的任务。拼写正确的单词将来自文本文件。请指导我如何解决这个问题。
我正在考虑这样做的方式:
我猜我需要创建一个接受字符串单词的 ADT 类。
我需要一个主类来读取字典文本文件并获取用户输入的句子。该类然后扫描该字符串,然后通过注意单词之间的空格将每个单词放入一个 ArrayList 中。然后,布尔方法会将 Arraylist 中的每个单词传递给将处理拼写错误的类,并在单词有效或错误时返回。
我相信我需要创建一个类来从单词列表中生成拼写错误并将它们存储到哈希表中?将有一个布尔方法,它接受一个字符串参数,用于检查表中的单词是否有效并返回 true 或 false。
在生成拼写错误时,我必须注意的关键概念是:(以单词“Hello”为例)
我怎样才能改进这种想法?
编辑!这就是我想出的使用 HashSet
/**
* The main program that loads the correct dictionary spellings
* and takes input to be analyzed from user.
* @author Catherine Austria
*/
public class SpellChecker {
private static String stringInput; // input to check;
private static String[] checkThis; // the stringInput turned array of words to check.
public static HashSet dictionary; // the dictionary used
/** …Run Code Online (Sandbox Code Playgroud) 我遇到了错误
Error in checkForRemoteErrors(val) :
one node produced an error: arguments imply differing number of rows: 3, 0
Run Code Online (Sandbox Code Playgroud)
尝试check_spelling在qdap包中使用时。提供的数字 3 和 0 与下面提供的数据相关,但这只是更大的拼写检查字符串的一个小样本,当我将更大的字符串传递给字符串以进行拼写检查和用作字典时,行号会有所不同。当它突然开始工作时,我偶尔会成功,但是一旦我尝试重复该过程,我就会再次遇到相同的错误。
当我使用该check_spelling_interactive()功能时,我也遇到了同样的错误。
我的理解是,我想用作拼写检查和字典的单词都应该在字符向量中。
我已经更新了我的qdap. 在 Windows 7 64、R Studio 版本 0.99.467、R 版本 3.2.1 上运行。
任何帮助将不胜感激,因为我正在为此脱发,而且我没有那么多多余的钱。
library(qdap)
spellcheckstring = "universal motor vlb"
mydictionary = c("brake", "starter", "shock", "pad", "kit", "bore", "toyota", "ford", "pump", "nissan", "gas", "alternator", "switch")
class(spellcheckstring) # character
class(mydictionary) # character
check_spelling(spellcheckstring, dictionary = mydictionary)
Run Code Online (Sandbox Code Playgroud) 我想递归搜索大型代码库(主要是 python、HTML 和 javascript)以查找注释、字符串以及变量/方法/类名称中的拼写错误。对在终端中运行的东西的强烈偏好。
问题是拼写检查器喜欢aspell或scspell几乎只发现误报(例如编程术语,驼峰式术语),而如果它可以帮助我主要找到简单的拼写错误,例如打乱或丢失的字母,例如维护与维护,限制与限制,我会很高兴,部署与部署。
到目前为止我在玩的是:
for f in **/*.py ; do echo $f ; aspell list < $f | uniq -c ; done
Run Code Online (Sandbox Code Playgroud)
但它会找到类似的东西: assertEqual, MyTestCase, lifecycle
就像一个完整的 pilchard,我在 Sublime Text 的默认 en-GB 拼写检查字典中添加了一个拼写错误。
我已经在网上和文档中查过,但似乎没有任何关于字典管理的信息
谁能告诉我怎么去掉?
问候。
我需要 dockerize 一个使用spellchecker. 运行 docker 镜像时出现此错误:
ImportError: No module named 'indexer'
File "/usr/local/lib/python3.5/site-packages/spellchecker/core.py", line 26, in <module>
from indexer import DictionaryIndex
ImportError: No module named 'indexer'
Run Code Online (Sandbox Code Playgroud) 我创建了一个这样的索引:
curl --location --request PUT 'http://127.0.0.1:9200/test/' \
--header 'Content-Type: application/json' \
--data-raw '{
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"properties" : {
"word" : { "type" : "text" }
}
}
}'
Run Code Online (Sandbox Code Playgroud)
当我创建文档时:
curl --location --request POST 'http://127.0.0.1:9200/test/_doc/' \
--header 'Content-Type: application/json' \
--data-raw '{ "word":"organic" }'
Run Code Online (Sandbox Code Playgroud)
最后,用一个故意拼错的词进行搜索:
curl --location --request POST 'http://127.0.0.1:9200/test/_search' \
--header 'Content-Type: application/json' \
--data-raw '{
"suggest": {
"001" : {
"text" : "rganic",
"term" : {
"field" : "word"
}
} …Run Code Online (Sandbox Code Playgroud) Chrome 是否依赖操作系统在桌面上提供拼写检查?此处说明在移动设备上确实如此。但是对于桌面,它只是说明拼写检查默认在本地生成。
spell-checking ×10
dictionary ×2
wpf ×2
aspell ×1
docker ×1
flask ×1
frontend ×1
hashtable ×1
import ×1
java ×1
lint ×1
python ×1
qdap ×1
r ×1
spelling ×1
styles ×1
sublimetext3 ×1
textbox ×1
tfs ×1
web-frontend ×1