• Login
Community
  • Login

Show a list of same words before replacement

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
24 Posts 5 Posters 4.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    carypt
    last edited by Jan 15, 2021, 10:45 PM

    @Alan-Kilborn ooh , thank you for sharing your python-script , this is the stuff i expect npp to do by default . yes , thank you , litrature researchers want to know these facts , dont they ?

    A 1 Reply Last reply Jan 16, 2021, 12:12 AM Reply Quote 0
    • A
      Alan Kilborn @carypt
      last edited by Jan 16, 2021, 12:12 AM

      @carypt said in Show a list of same words before replacement:

      this is the stuff i expect npp to do by default

      WHY would you expect this??

      1 Reply Last reply Reply Quote 0
      • C
        carypt
        last edited by carypt Jan 17, 2021, 12:59 PM Jan 17, 2021, 12:58 PM

        @Alan-Kilborn why would i ? because everywhere when it comes into tricky needs , people get directed to npp , because you can do “everything” with it . fine , yes , if you can code a bit as it seems , or by help of others . this text-analysing , quenching , reformatting , experimenting stuff i do expect npp to be able . finding rhymes , wrap everything around , giving negatives of characters , or tempered chords of syllables , counting rythm , finding copypasted phrases in dissertaions , plagiarism . finding sentence lenght , word historam (sic !) , sentence structure analysis . book eating stuff . playing with words .

        A 1 Reply Last reply Jan 17, 2021, 1:08 PM Reply Quote 0
        • A
          Alan Kilborn @carypt
          last edited by Jan 17, 2021, 1:08 PM

          @carypt

          No. With a period after the “no”.

          Word-histogramming (as I showed with the script) and the other things you so interestingly described are more functions of word-processing software or grammar-analyzing software, or, to the point, special-purpose software.

          A text editor is, by definition, a fairly general purpose tool.
          N++ provides some advanced capability, but it centers around general-purpose needs. Examples include sorting lines, removing duplicate lines…

          “…finding rhymes, negatives of characters, tempered chords, rhythm (which I can spell correctly), plagarism, structure analysis…” – all very special purpose.

          historam (sic!)

          I know what sic means, but I certainly don’t know what you’re implying with its usage here.

          1 Reply Last reply Reply Quote 1
          • C
            carypt
            last edited by Jan 17, 2021, 1:15 PM

            @Alan-Kilborn ok , meh

            1 Reply Last reply Reply Quote 0
            • C
              carypt
              last edited by Jan 17, 2021, 1:29 PM

              @Alan-Kilborn but … ty for guiding me to “text-mining”. )

              1 Reply Last reply Reply Quote 0
              • P
                Patrik Spacek
                last edited by Jan 19, 2021, 8:59 PM

                Thanks guys for all those suggestions, but i am not a coder… and apps like “word frequency counter” show lots of errors if I paste text with 9000 lines…

                I dont know python or any coding…could you create a .bat file or some small app runner where i can paste my file or text and just run it?

                Some simple version of app that I dont have to code and so on?
                BTW this kind of addition must be added to notepad++ in general :/.

                Thanks

                P A 2 Replies Last reply Jan 19, 2021, 9:12 PM Reply Quote 0
                • P
                  PeterJones @Patrik Spacek
                  last edited by PeterJones Jan 19, 2021, 9:12 PM Jan 19, 2021, 9:12 PM

                  @Patrik-Spacek said in Show a list of same words before replacement:

                  could you create a .bat file or some small app runner where i can paste my file or text and just run it?
                  Some simple version of app that I dont have to code and so on?

                  No need.

                  Thanks guys for all those suggestions, but i am not a coder…
                  I dont know python or any coding…

                  Fortunately, you don’t have to know a whit of python, because @Alan-Kilborn already gave you the code that will work to accomplish this solution in Notepad++:

                  1. Go to Plugins > Plugins Admin, and install the PythonScript plugin.
                  2. Restart Notepad++ as necessary
                  3. Plugins > Python Script > New Script, give it the name WordCount.py or similar
                  4. Copy/paste the script that Alan posted earlier
                  5. Plugins > Python Script > Scripts > WordCount.py will run the script for you, and use Paste / Ctrl+V to paste the count data wherever you want it (a new file, whatever)

                  Once you know it works,

                  1. Plugins > Python Script > Configuration…
                  2. Select WordCount.py in the UserScripts
                  3. Click the left Add to add that script to Menu Items list
                  4. Make sure Initialisation is et to ATSTARTUP
                  5. Click OK
                  6. Exit Notepad++ and restart
                  7. Settings > Shortcut Mapper > Plugin Commands
                  8. Filter for WordCount
                  9. Select that line, click Modify, and set the keyboard shortcut you desire, and close the dialogs.

                  From now on, that keyboard shortcut will run the histogram (or you can go to Plugins > Python Script > WordCount), and it will put the word count in your clipboard buffer. Then all you have to do is paste the result somewhere.

                  No programming required for you, because Alan already did the work.

                  P 1 Reply Last reply Jan 19, 2021, 9:49 PM Reply Quote 1
                  • A
                    Alan Kilborn @Patrik Spacek
                    last edited by Alan Kilborn Jan 19, 2021, 9:22 PM Jan 19, 2021, 9:20 PM

                    @Patrik-Spacek said in Show a list of same words before replacement:

                    this kind of addition must be added to notepad++ in general

                    You seem to think like @carypt
                    Kindly refer to my previous post which started out with No. With a period after the…

                    @PeterJones

                    Some people are just paralyzed with fear about something like you describe. :-)

                    1 Reply Last reply Reply Quote 0
                    • P
                      Patrik Spacek @PeterJones
                      last edited by Jan 19, 2021, 9:49 PM

                      @PeterJones thanks Peter,

                      nothing is happening…

                      ea6f6976-7a92-4534-8dd8-c8161e7e079a-image.png

                      P 1 Reply Last reply Jan 19, 2021, 9:50 PM Reply Quote 0
                      • P
                        PeterJones @Patrik Spacek
                        last edited by Jan 19, 2021, 9:50 PM

                        @Patrik-Spacek

                        As I said,

                        From now on, that keyboard shortcut will run the histogram (or you can go to Plugins > Python Script > WordCount), and it will put the word count in your clipboard buffer. Then all you have to do is paste the result somewhere.

                        Did you paste somewhere after running the script?

                        P 1 Reply Last reply Jan 19, 2021, 9:58 PM Reply Quote 0
                        • P
                          Patrik Spacek @PeterJones
                          last edited by Patrik Spacek Jan 19, 2021, 10:01 PM Jan 19, 2021, 9:58 PM

                          @PeterJones ouch, i missed that paste to somewhere… yes, its working!

                          what about add command that opens a new doc in notepad++ and paste it right away?
                          also set in count order from highest to lowest?

                          @Alan-Kilborn

                          A 1 Reply Last reply Jan 19, 2021, 10:05 PM Reply Quote 0
                          • A
                            Alan Kilborn @Patrik Spacek
                            last edited by Jan 19, 2021, 10:05 PM

                            @Patrik-Spacek said in Show a list of same words before replacement:

                            what about add command that opens a new doc in notepad++

                            notepad.new()

                            and paste it right away?

                            editor.paste()

                            You may not be as far from programming as you think, if you try your hand at adding the above (hint: at the end of the script) :-)

                            P 1 Reply Last reply Jan 19, 2021, 10:10 PM Reply Quote 2
                            • P
                              Patrik Spacek @Alan Kilborn
                              last edited by Jan 19, 2021, 10:10 PM

                              @Alan-Kilborn that worked!

                              what about the order from highest count?
                              also, the text has numbers 000 connected to some words, is it possible to exclude them?

                              7073dbfd-a357-445f-9946-fd41e1132ca5-image.png

                              A 1 Reply Last reply Jan 20, 2021, 1:33 AM Reply Quote 0
                              • A
                                Alan Kilborn @Patrik Spacek
                                last edited by Jan 20, 2021, 1:33 AM

                                @Patrik-Spacek

                                It appears you are running this against a file that truly isn’t text.
                                That wasn’t in my original plans for it.
                                I don’t know that I really want to support that (with changes) and all that it could mean.
                                But of course you are free to figure out how to do it.

                                I have concerns about a lot of things, but these lines in your output are especially concerning:

                                =18
                                 =2
                                "=1
                                

                                These should not occur (unless there is something “unseen” going on, because my search expression in the script requested that “word characters only” be searched for.

                                1 Reply Last reply Reply Quote 0
                                • P
                                  Patrik Spacek
                                  last edited by Jan 20, 2021, 7:04 PM

                                  Thats fine, but somebody definitely should create a nice advanced addition to notepad++, its very useful.

                                  My friend already coded all I need (in 20mins) and works perfectly, its compiled separately, but works great. (not in python)

                                  A 1 Reply Last reply Jan 20, 2021, 7:16 PM Reply Quote 0
                                  • A
                                    Alan Kilborn @Patrik Spacek
                                    last edited by Jan 20, 2021, 7:16 PM

                                    @Patrik-Spacek said in Show a list of same words before replacement:

                                    a nice advanced addition to notepad++

                                    Sounds like a job for a plugin.
                                    But just for that simple function, a little script serves well.
                                    But if a potential plugin added a bunch of analysis features, of which a histogram is just one…well, that would be valuable.

                                    My friend already coded all I need (in 20mins) and works perfectly, its compiled separately, but works great. (not in python)

                                    Sounds like overkill, but when one has to sponge off of a friend’s good will, you get what you get.

                                    1 Reply Last reply Reply Quote 0
                                    • T Terry R referenced this topic on Dec 29, 2021, 5:49 AM
                                    • G guy038 referenced this topic on Oct 9, 2023, 9:41 PM
                                    17 out of 24
                                    • First post
                                      17/24
                                      Last post
                                    The Community of users of the Notepad++ text editor.
                                    Powered by NodeBB | Contributors