本文介绍了使用命令行拼写检查文件,非交互式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大文本文件,包含许多缺少/坏拼写的英语单词。我正在寻找一种方法使用Linux中的命令行拼写检查器来编辑此文件。我找到了一些方法来做到这一点,但根据我的搜索,所有的工作在一个互动的方式。我的意思是,看到一个错误/拼写错误的单词,他们建议一些更正的用户,他/她应该选择其中之一。由于我的文件相当大,并且包含许多错误的单词,我不能以这种方式编辑它。我正在寻找一种方法告诉拼写检查器,使用第一个候选人替换所有错误的单词。
有什么办法吗?

解决方案

/ div>

如果你不需要它来替换每个错误的单词,但只是以非交互的方式指出错误并打印建议,你可以使用ispell:

  $ ispell -a< file.txt | grep ^ \& > errors.txt 

我不知道任何标准的Linux实用程序,从命令行,虽然上面的评论中的emacs建议接近。


I have a large text file, containing many miss/bad-spelled English words. I'm looking for a way to edit this file using a command-line spell checker in Linux. I found some ways to do this, But according to my searches all of them work in an interactive manner. I mean, seeing a miss/bad-spelled word, they suggest some corrections to the user and he/she should choose one of them. Since my file is rather large, and contains many wrong words, I can't edit it in this manner. I am looking for a way to tell the spell-checker that replace all the wrong words using the first candidate.Is there any way to do this? does (a/hun)spell have any option for doing so?

Regards.

解决方案

If you don't need it to replace every wrong word, but simply point out the errors and print suggestions in a non-interactive manner, you can use ispell:

$ ispell -a < file.txt | grep ^\& > errors.txt

I'm unfortunately not aware of any standard Linux utility that does what you're requesting from the command line, although the emacs suggestion in the comments above comes close.

这篇关于使用命令行拼写检查文件,非交互式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 21:44