Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Linux to help you spell

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use Linux to help you spell, the article is very detailed, has a certain reference value, interested friends must read it!

Linux provides a variety of tools for data analysis and automation, and it also helps us solve a problem that we have been struggling with all the time-spelling! Whether you're trying to spell out a word when writing a weekly report, or trying to find out your spelling mistakes with the help of the computer's "eyes" before submitting your business plan. Now let's see how it helps you.

Look

Look is one of the tools. If you know the beginning of a word, you can use this command to get a list of words that begin with these letters. Unless an alternative etymology is provided, look will use the content in / usr/share/dict/words to identify words for you. This file has hundreds of thousands of words and can meet the needs of most of the English words we use every day, but it may not contain more obscure words that some people in our computer field tend to use, such as zettabyte.

The syntax of the look command is very simple. Enter look word, which will iterate through all the words in the word file and find a match.

$look amelioameliorableameliorablenessameliorantameliorateamelioratedamelioratesamelioratingameliorationameliorationsameliorativameliorativeameliorativelyamelioratoramelioratory

If you encounter words that are not included in the word list in the system, you will not be able to get any output.

$look zetta$

If you don't see the words you want to appear, don't despair. You can add words to your word file, even quote a completely different list of words, find one online, or simply create one yourself. You don't even have to put the added words in the correct alphabetical order; just add them to the end of the file. However, you must do this as the root user. For example (pay attention to > >! ):

# echo "zettabyte" > > / usr/share/dict/words

When using different word lists, such as "jargon" in this example, you only need to add the name of the file. If you do not use the default file, use the full path.

$look nybble / usr/share/dict/jargonnybblenybbles

The look command is case-insensitive, so you don't have to worry about whether the word you're looking for should be capitalized.

$look zetZETAZetazetazetacismZetanazetasZeteszeteticZetharZethusZetlandZetta

Of course, not all word lists are the same. Some Linux distributions provide much more content in the word file. There may be a hundred thousand or more words in your file.

In one of my Linux systems:

$wc-l / usr/share/dict/words102402 / usr/share/dict/words

In another system:

$wc-l / usr/share/dict/words479828 / usr/share/dict/words

Keep in mind that the look command only works by looking at the beginning of a word, but if you don't want to look at the beginning of a word, you can use other options.

Grep

Our beloved grep command, like other tools, can select words from a word file. If you are looking for words that begin or end with certain letters, it is natural to use the grep command. It can match words by the beginning, end, or middle part of the word. The word files in the system can be easily used in the grep command as with the look command. However, the disadvantage of * * is that you need to specify files, which is not the same as look.

Add ^ before the beginning of the word:

$grep ^ terra / usr/share/dict/wordsterraceterrace'sterracedterracesterracingterrainterrain'sterrainsterrapinterrapin'sterrapinsterrariaterrariumterrarium'sterrariums

Add $at the end of the word:

$grep bytes$ / usr/share/dict/wordsbytesgigabyteskilobytesmegabytesterabytes

When using grep, you need to consider case, but the grep command also provides some options.

$grep ^ [Zz] et / usr/share/dict/wordsZetazetazetacismZetanazetasZeteszeteticZetharZethusZetlandZettazettabyte

Adding soft links to word files makes this search more convenient:

$ln-s / usr/share/dict/words words$ grep ^ [Zz] et wordsZetazetazetacismZetanazetasZeteszeteticZetharZethusZetlandZettazettabytyeaspell

The aspell command provides a different approach. It provides a way to check the spelling of any file or text you provide to it. You can pipe the text to it, and it will tell you which words look misspelled. If all the words are spelled correctly, there will be no output.

$echo Did I mispell that? | aspell listmispell$ echo I can hardly wait to try out aspell | aspell listaspell$ echo Did I misspell anything? | aspell list$

The list parameter tells aspell to provide a list of misspelled words for standard input words.

You can also use aspell to locate and correct words in text files. If it finds a misspelled word, it will provide you with a list of similar (but correctly spelled) words to replace the word, or you can add the word to your personal thesaurus (~ / .aspell.en.pws) and ignore the spelling mistake, or abort the process completely (keeping the file as it was before processing).

$aspell-c mytext

Once aspell finds a misspelling of a word, it will provide a list of options for incorrect "mispell":

1) mi spell 6) misplay2) mi-spell 7) spell3) misspell 8) misapply4) Ispell 9) Aspell5) misspells 0) dispeli) Ignore I) Ignore allr ) Replace R) Replace alla) Add l) Add Lowerb) Abort x) Exit

Note that alternative words and spellings are numbered, while other options are represented by alphabetic options. You can choose one of the alternative spellings or enter the replacement yourself. The "Abort" option will leave the file unchanged, even if you have selected a replacement for some words. The words you choose to add will be inserted into the local words file (for example, ~ / .aspell.en.pws).

List of other words

Tired of English? The aspell command can be used in other languages, as long as you add a list of words in the relevant languages. For example, to add a French thesaurus to the Debian system, you can do this:

$sudo apt install aspell-fr

This new thesaurus file is installed as / usr/share/dict/French. To use it, you simply tell aspell that you want to use a list of replacement words:

$aspell-- lang=fr-c mytext

In this case, when aspell reads the word "one", you may see the following:

1) once 6) orn é 2) onde 7) ne3) ond é 8) n é 4) onze 9) on5) orne 0) c ô nei) Ignore I) Ignore allr) Replace R) Replace alla) Add l) Add Lowerb) Abort x) Exit

You can also get a thesaurus of other languages from the GNU website.

The above is all the contents of the article "how to use Linux to help you spell". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report