hunspell: add word to dictionary from command line

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












5















From hunspell man page:



...
When in the -a mode, hunspell will also accept lines of single
words prefixed with any of '*', '&', '@', '+', '-', '~', '#',
'!', '%', '`', or '^'. A line starting with '*' tells hunspell
to insert the word into the user's dictionary (similar to the I
command).
...


I tried something like: echo "* my_word" | hunspell -a but the word is not in my dictionary as parsing sample file again shows it as misspelled word



How does this work, how can I add custom word?

Or with Aspell, or any "common" program that writes to compatible dictionaries read by Hunspell/Aspell?










share|improve this question




























    5















    From hunspell man page:



    ...
    When in the -a mode, hunspell will also accept lines of single
    words prefixed with any of '*', '&', '@', '+', '-', '~', '#',
    '!', '%', '`', or '^'. A line starting with '*' tells hunspell
    to insert the word into the user's dictionary (similar to the I
    command).
    ...


    I tried something like: echo "* my_word" | hunspell -a but the word is not in my dictionary as parsing sample file again shows it as misspelled word



    How does this work, how can I add custom word?

    Or with Aspell, or any "common" program that writes to compatible dictionaries read by Hunspell/Aspell?










    share|improve this question


























      5












      5








      5








      From hunspell man page:



      ...
      When in the -a mode, hunspell will also accept lines of single
      words prefixed with any of '*', '&', '@', '+', '-', '~', '#',
      '!', '%', '`', or '^'. A line starting with '*' tells hunspell
      to insert the word into the user's dictionary (similar to the I
      command).
      ...


      I tried something like: echo "* my_word" | hunspell -a but the word is not in my dictionary as parsing sample file again shows it as misspelled word



      How does this work, how can I add custom word?

      Or with Aspell, or any "common" program that writes to compatible dictionaries read by Hunspell/Aspell?










      share|improve this question
















      From hunspell man page:



      ...
      When in the -a mode, hunspell will also accept lines of single
      words prefixed with any of '*', '&', '@', '+', '-', '~', '#',
      '!', '%', '`', or '^'. A line starting with '*' tells hunspell
      to insert the word into the user's dictionary (similar to the I
      command).
      ...


      I tried something like: echo "* my_word" | hunspell -a but the word is not in my dictionary as parsing sample file again shows it as misspelled word



      How does this work, how can I add custom word?

      Or with Aspell, or any "common" program that writes to compatible dictionaries read by Hunspell/Aspell?







      spell-checking hunspell






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 11 at 23:10









      Jonas Stein

      1,17121136




      1,17121136










      asked Apr 10 '12 at 0:26









      zetahzetah

      69241019




      69241019




















          2 Answers
          2






          active

          oldest

          votes


















          5














          I think instead of (similar to the I command) it should be (similar to the A command):



          A

          Accept the word for the rest of this hunspell session.


          Let's check the man page again:



          The -a option is intended to be used from other programs through a pipe.
          In this mode, hunspell prints a one-line version identification message,
          and then begins reading lines of input.


          So, when in -a mode, hunspell session ends after reading and processing the last line of input. Furthermore,



          When in the -a mode, hunspell will also accept lines of single words prefixed
          with any of
          '*', '&', '@', '+', '-', '~', '#', '!', '%', ''', or '^'. A line
          starting with '*' tells hunspell to insert the word into the user's dictionary

          (similar to the I command)[........] A line prefixed with '#' will cause the
          personal dictionary to be saved
          .


          Prefixing a single word line with * (note there should be no space between word and prefix) will add that word to the user's dictionary but only for the current hunspell session, since, as per the man page, only a line prefixed with # will cause the personal dictionary to be saved (the on-disk file, that is). Hence running



          echo "*goosfraba" | hunspell -a


          does absolutely nothing. hunspell adds goosfraba to the dictionary for this session then exits (no other lines to process). You have to add a second line prefixed with # in order to save the recently added word(s):



          echo -e "*goosfraban#" | hunspell -a


          Let's see:



          ::spell-checking goosfraba:



          echo -e "goosfraba" | hunspell -a
          @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
          & goosfraba 1 0: goofball


          & = Word is not in the dictionary, there is one near miss: goofball.



          ::adding goosfraba to the dictionary then spell-checking during the same hunspell session (two lines):



          echo -e "*goosfrabangoosfraba" | hunspell -a
          @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
          *


          * = Word is in the dictionary.



          ::spell-checking goosfraba again (new hunspell session):



          echo -e "goosfraba" | hunspell -a
          @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
          & goosfraba 1 0: goofball


          & = Again, word is not in the dictionary (nothing was saved during the previous session)



          ::adding goosfraba to the dictionary and saving during the same hunspell session (two lines):



          echo -e "*goosfraban#" | hunspell -a
          @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)


          ::spell-checking goosfraba again (new hunspell session):



          echo "goosfraba" | hunspell -a
          @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
          *


          * = Word is in the dictionary.






          share|improve this answer






























            2














            I found out that easiest solution is to use Aspell and create custom file in home folder, named .aspell.lang.pws, with contents like:



            personal_ws-1.1 en 0
            my_word


            for language "en", which seems like great way to share "portable dictionary", BTW






            share|improve this answer






















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f36103%2fhunspell-add-word-to-dictionary-from-command-line%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              5














              I think instead of (similar to the I command) it should be (similar to the A command):



              A

              Accept the word for the rest of this hunspell session.


              Let's check the man page again:



              The -a option is intended to be used from other programs through a pipe.
              In this mode, hunspell prints a one-line version identification message,
              and then begins reading lines of input.


              So, when in -a mode, hunspell session ends after reading and processing the last line of input. Furthermore,



              When in the -a mode, hunspell will also accept lines of single words prefixed
              with any of
              '*', '&', '@', '+', '-', '~', '#', '!', '%', ''', or '^'. A line
              starting with '*' tells hunspell to insert the word into the user's dictionary

              (similar to the I command)[........] A line prefixed with '#' will cause the
              personal dictionary to be saved
              .


              Prefixing a single word line with * (note there should be no space between word and prefix) will add that word to the user's dictionary but only for the current hunspell session, since, as per the man page, only a line prefixed with # will cause the personal dictionary to be saved (the on-disk file, that is). Hence running



              echo "*goosfraba" | hunspell -a


              does absolutely nothing. hunspell adds goosfraba to the dictionary for this session then exits (no other lines to process). You have to add a second line prefixed with # in order to save the recently added word(s):



              echo -e "*goosfraban#" | hunspell -a


              Let's see:



              ::spell-checking goosfraba:



              echo -e "goosfraba" | hunspell -a
              @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
              & goosfraba 1 0: goofball


              & = Word is not in the dictionary, there is one near miss: goofball.



              ::adding goosfraba to the dictionary then spell-checking during the same hunspell session (two lines):



              echo -e "*goosfrabangoosfraba" | hunspell -a
              @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
              *


              * = Word is in the dictionary.



              ::spell-checking goosfraba again (new hunspell session):



              echo -e "goosfraba" | hunspell -a
              @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
              & goosfraba 1 0: goofball


              & = Again, word is not in the dictionary (nothing was saved during the previous session)



              ::adding goosfraba to the dictionary and saving during the same hunspell session (two lines):



              echo -e "*goosfraban#" | hunspell -a
              @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)


              ::spell-checking goosfraba again (new hunspell session):



              echo "goosfraba" | hunspell -a
              @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
              *


              * = Word is in the dictionary.






              share|improve this answer



























                5














                I think instead of (similar to the I command) it should be (similar to the A command):



                A

                Accept the word for the rest of this hunspell session.


                Let's check the man page again:



                The -a option is intended to be used from other programs through a pipe.
                In this mode, hunspell prints a one-line version identification message,
                and then begins reading lines of input.


                So, when in -a mode, hunspell session ends after reading and processing the last line of input. Furthermore,



                When in the -a mode, hunspell will also accept lines of single words prefixed
                with any of
                '*', '&', '@', '+', '-', '~', '#', '!', '%', ''', or '^'. A line
                starting with '*' tells hunspell to insert the word into the user's dictionary

                (similar to the I command)[........] A line prefixed with '#' will cause the
                personal dictionary to be saved
                .


                Prefixing a single word line with * (note there should be no space between word and prefix) will add that word to the user's dictionary but only for the current hunspell session, since, as per the man page, only a line prefixed with # will cause the personal dictionary to be saved (the on-disk file, that is). Hence running



                echo "*goosfraba" | hunspell -a


                does absolutely nothing. hunspell adds goosfraba to the dictionary for this session then exits (no other lines to process). You have to add a second line prefixed with # in order to save the recently added word(s):



                echo -e "*goosfraban#" | hunspell -a


                Let's see:



                ::spell-checking goosfraba:



                echo -e "goosfraba" | hunspell -a
                @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                & goosfraba 1 0: goofball


                & = Word is not in the dictionary, there is one near miss: goofball.



                ::adding goosfraba to the dictionary then spell-checking during the same hunspell session (two lines):



                echo -e "*goosfrabangoosfraba" | hunspell -a
                @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                *


                * = Word is in the dictionary.



                ::spell-checking goosfraba again (new hunspell session):



                echo -e "goosfraba" | hunspell -a
                @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                & goosfraba 1 0: goofball


                & = Again, word is not in the dictionary (nothing was saved during the previous session)



                ::adding goosfraba to the dictionary and saving during the same hunspell session (two lines):



                echo -e "*goosfraban#" | hunspell -a
                @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)


                ::spell-checking goosfraba again (new hunspell session):



                echo "goosfraba" | hunspell -a
                @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                *


                * = Word is in the dictionary.






                share|improve this answer

























                  5












                  5








                  5







                  I think instead of (similar to the I command) it should be (similar to the A command):



                  A

                  Accept the word for the rest of this hunspell session.


                  Let's check the man page again:



                  The -a option is intended to be used from other programs through a pipe.
                  In this mode, hunspell prints a one-line version identification message,
                  and then begins reading lines of input.


                  So, when in -a mode, hunspell session ends after reading and processing the last line of input. Furthermore,



                  When in the -a mode, hunspell will also accept lines of single words prefixed
                  with any of
                  '*', '&', '@', '+', '-', '~', '#', '!', '%', ''', or '^'. A line
                  starting with '*' tells hunspell to insert the word into the user's dictionary

                  (similar to the I command)[........] A line prefixed with '#' will cause the
                  personal dictionary to be saved
                  .


                  Prefixing a single word line with * (note there should be no space between word and prefix) will add that word to the user's dictionary but only for the current hunspell session, since, as per the man page, only a line prefixed with # will cause the personal dictionary to be saved (the on-disk file, that is). Hence running



                  echo "*goosfraba" | hunspell -a


                  does absolutely nothing. hunspell adds goosfraba to the dictionary for this session then exits (no other lines to process). You have to add a second line prefixed with # in order to save the recently added word(s):



                  echo -e "*goosfraban#" | hunspell -a


                  Let's see:



                  ::spell-checking goosfraba:



                  echo -e "goosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  & goosfraba 1 0: goofball


                  & = Word is not in the dictionary, there is one near miss: goofball.



                  ::adding goosfraba to the dictionary then spell-checking during the same hunspell session (two lines):



                  echo -e "*goosfrabangoosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  *


                  * = Word is in the dictionary.



                  ::spell-checking goosfraba again (new hunspell session):



                  echo -e "goosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  & goosfraba 1 0: goofball


                  & = Again, word is not in the dictionary (nothing was saved during the previous session)



                  ::adding goosfraba to the dictionary and saving during the same hunspell session (two lines):



                  echo -e "*goosfraban#" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)


                  ::spell-checking goosfraba again (new hunspell session):



                  echo "goosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  *


                  * = Word is in the dictionary.






                  share|improve this answer













                  I think instead of (similar to the I command) it should be (similar to the A command):



                  A

                  Accept the word for the rest of this hunspell session.


                  Let's check the man page again:



                  The -a option is intended to be used from other programs through a pipe.
                  In this mode, hunspell prints a one-line version identification message,
                  and then begins reading lines of input.


                  So, when in -a mode, hunspell session ends after reading and processing the last line of input. Furthermore,



                  When in the -a mode, hunspell will also accept lines of single words prefixed
                  with any of
                  '*', '&', '@', '+', '-', '~', '#', '!', '%', ''', or '^'. A line
                  starting with '*' tells hunspell to insert the word into the user's dictionary

                  (similar to the I command)[........] A line prefixed with '#' will cause the
                  personal dictionary to be saved
                  .


                  Prefixing a single word line with * (note there should be no space between word and prefix) will add that word to the user's dictionary but only for the current hunspell session, since, as per the man page, only a line prefixed with # will cause the personal dictionary to be saved (the on-disk file, that is). Hence running



                  echo "*goosfraba" | hunspell -a


                  does absolutely nothing. hunspell adds goosfraba to the dictionary for this session then exits (no other lines to process). You have to add a second line prefixed with # in order to save the recently added word(s):



                  echo -e "*goosfraban#" | hunspell -a


                  Let's see:



                  ::spell-checking goosfraba:



                  echo -e "goosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  & goosfraba 1 0: goofball


                  & = Word is not in the dictionary, there is one near miss: goofball.



                  ::adding goosfraba to the dictionary then spell-checking during the same hunspell session (two lines):



                  echo -e "*goosfrabangoosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  *


                  * = Word is in the dictionary.



                  ::spell-checking goosfraba again (new hunspell session):



                  echo -e "goosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  & goosfraba 1 0: goofball


                  & = Again, word is not in the dictionary (nothing was saved during the previous session)



                  ::adding goosfraba to the dictionary and saving during the same hunspell session (two lines):



                  echo -e "*goosfraban#" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)


                  ::spell-checking goosfraba again (new hunspell session):



                  echo "goosfraba" | hunspell -a
                  @(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
                  *


                  * = Word is in the dictionary.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 19 '13 at 0:32









                  don_crisstidon_crissti

                  50.5k15134162




                  50.5k15134162























                      2














                      I found out that easiest solution is to use Aspell and create custom file in home folder, named .aspell.lang.pws, with contents like:



                      personal_ws-1.1 en 0
                      my_word


                      for language "en", which seems like great way to share "portable dictionary", BTW






                      share|improve this answer



























                        2














                        I found out that easiest solution is to use Aspell and create custom file in home folder, named .aspell.lang.pws, with contents like:



                        personal_ws-1.1 en 0
                        my_word


                        for language "en", which seems like great way to share "portable dictionary", BTW






                        share|improve this answer

























                          2












                          2








                          2







                          I found out that easiest solution is to use Aspell and create custom file in home folder, named .aspell.lang.pws, with contents like:



                          personal_ws-1.1 en 0
                          my_word


                          for language "en", which seems like great way to share "portable dictionary", BTW






                          share|improve this answer













                          I found out that easiest solution is to use Aspell and create custom file in home folder, named .aspell.lang.pws, with contents like:



                          personal_ws-1.1 en 0
                          my_word


                          for language "en", which seems like great way to share "portable dictionary", BTW







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Apr 10 '12 at 2:31









                          zetahzetah

                          69241019




                          69241019



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f36103%2fhunspell-add-word-to-dictionary-from-command-line%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown






                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Displaying single band from multi-band raster using QGIS

                              How many registers does an x86_64 CPU actually have?