Community
    • Login

    Show a list of same words before replacement

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    24 Posts 5 Posters 4.4k 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.
    • Alan KilbornA
      Alan Kilborn @guy038
      last edited by

      @guy038

      By the way, it may pay dividends to become familiar with the format function’s formatting codes – I’ll be using that same syntax as a user-input parameter for my upcoming script posting for “replacing using an incrementing count value”.

      Reference (but no, nothing new there YET!)

      1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @guy038
        last edited by

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

        I don’t understand ! For instance, with the previous search regex

        I found out the problem.
        I neglected to follow this part of the original instruction:

        Move the caret at beginning of the list

        After doing that, the regex replacement works fine for me. Sorry for the confusion.

        1 Reply Last reply Reply Quote 1
        • caryptC
          carypt
          last edited by

          @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 ?

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @carypt
            last edited by

            @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
            • caryptC
              carypt
              last edited by carypt

              @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 .

              Alan KilbornA 1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @carypt
                last edited by

                @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
                • caryptC
                  carypt
                  last edited by

                  @Alan-Kilborn ok , meh

                  1 Reply Last reply Reply Quote 0
                  • caryptC
                    carypt
                    last edited by

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

                    1 Reply Last reply Reply Quote 0
                    • Patrik SpacekP
                      Patrik Spacek
                      last edited by

                      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

                      PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @Patrik Spacek
                        last edited by PeterJones

                        @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.

                        Patrik SpacekP 1 Reply Last reply Reply Quote 1
                        • Alan KilbornA
                          Alan Kilborn @Patrik Spacek
                          last edited by Alan Kilborn

                          @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
                          • Patrik SpacekP
                            Patrik Spacek @PeterJones
                            last edited by

                            @PeterJones thanks Peter,

                            nothing is happening…

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

                            PeterJonesP 1 Reply Last reply Reply Quote 0
                            • PeterJonesP
                              PeterJones @Patrik Spacek
                              last edited by

                              @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?

                              Patrik SpacekP 1 Reply Last reply Reply Quote 0
                              • Patrik SpacekP
                                Patrik Spacek @PeterJones
                                last edited by Patrik Spacek

                                @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

                                Alan KilbornA 1 Reply Last reply Reply Quote 0
                                • Alan KilbornA
                                  Alan Kilborn @Patrik Spacek
                                  last edited by

                                  @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) :-)

                                  Patrik SpacekP 1 Reply Last reply Reply Quote 2
                                  • Patrik SpacekP
                                    Patrik Spacek @Alan Kilborn
                                    last edited by

                                    @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

                                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                                    • Alan KilbornA
                                      Alan Kilborn @Patrik Spacek
                                      last edited by

                                      @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
                                      • Patrik SpacekP
                                        Patrik Spacek
                                        last edited by

                                        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)

                                        Alan KilbornA 1 Reply Last reply Reply Quote 0
                                        • Alan KilbornA
                                          Alan Kilborn @Patrik Spacek
                                          last edited by

                                          @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
                                          • Terry RT Terry R referenced this topic on
                                          • guy038G guy038 referenced this topic on
                                          • First post
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors