Loading ...
Sorry, an error occurred while loading the content.

15959Re: [Clip] Brooding about ^$GetDocMatchAll

Expand Messages
  • jonas_ramus
    Jan 14, 2007
    • 0 Attachment
      Alec,

      Here I'm back with the KWIC-Concordance. Now the user can...

      - search for single word or use a word list
      - search for words as whole words or substrings
      - choose the size of context (up to 99 characters, but more than 40
      normally doesn't make sense)

      On all conditions, the results seem to be OK. Professor Ling surely
      will take his hat off to that clip ;-)

      I would propose to test it with the above mentioned quotation from
      the NT help file again. A word list could be...

      documents
      interface
      Notepad
      templates
      thesaurus
      toolbar

      Please create another word list with substrings like...

      win
      mpl
      eat
      ell

      I didn't remove these TEXT STARTS HERE:/TEXT_ENDS HERE: strings. It
      might be better to see why a context has been shortened in output.
      (Unfortunately, I didn't see where to put that ^$StrFill(".";40)$
      command). -- I hope my homework will survive your critical eye.

      Maybe there are some details left: When using a word list, for
      example, the output is not sorted on the search words. I think,
      however, that's something one can live with.

      Regarding TextStat: I know there are more KWIC-tools available, and I
      tested some of them -- also TextStat. In my view, the smartest tool
      in this field is AntConc (http://www.antlab.sci.waseda.ac.jp/), a
      freeware-program written in Perl (just download and copy it to any
      folder - no installation needed). However, I've also been interested
      in a NoteTab solution. Mainly I'm using NoteTab for editing TXT-files
      that have been exported from free-form text databases to TXT-files.
      So it's easier to do the complete job with NoteTab instead of opening
      those files again in a third application.

      Flo
       

      ; KWIC-Concordance by Alec Burgess 2007-01-12
      ; with some modest details added by Flo
      ^!SetHintInfo Working...
      ^!SetScreenUpdate Off
      ^!ClearVariables
      ^!SetWizardTitle "Keyword in Context"
      ^!Set %Type%=^?{Search...==_Single Word|Wordlist}
      ^!IfSame "^%Type%" "Wordlist" Skip Else Next
      ^!Set %Search%=^?{Search for the following word or substring:}
      ^!Set %Sub%=^?{Search words as...==Substrings|_Whole words}
      ^!SetWizardLabel "Characters preceding and following Search Word:"
      ^!Set %Char%=^?{(M="99;0; ")Enter a digit between 0 and 40:}
      ^!IfSame "^%Type%" "Wordlist" Next Else Make_Concordance
      ^!SetWizardLabel "Choose a List containing Search Words!"
      ^!Set %Listfile%=^?{(T=O)Open file:}
      ; edit Word List
      ^!Open ^%Listfile%
      ^!Jump Text_Start
      (
      ^!replace "\r\n" >> "|" rwsai
      ^!Jump Text_End
      )
      ^!Select All
      ^!Set %Search%=^$GetSelection$
      ^!Close ^%Listfile% Discard

      :Make_Concordance
      ^!set %lead_in%="(?i)"
      ^!set %left_context%="(.{^%Char%})"
      ^!IfSame "^%Sub%" "Substrings" Next Else Skip_2
      ^!set %key_words%="(^%Search%)"
      ^!Goto Skip
      ^!set %key_words%="\b(^%Search%)\b"
      ^!set %right_context%="(.{^%Char%})"
      ; work on a copy of the original
      ^!menu edit/copy all
      ^!toolbar paste new
      ; remove all empty lines and replace tab(s) by a single space
      ^!replace "(\r\n){2,}" >> "\r\n" rwsai
      ^!replace "(\t){1,}" >> "\" rwsai
      ; join entire text into one paragraph
      ^!select ALL
      ^!menu modify/lines/"join lines"
      ^!jump TEXT_START
      TEXT STARTS HERE:
      ^!jump TEXT_END
      TEXT ENDS HERE:
      ^!set %expr%="^%lead_in%^%left_context%^%key_words%^%right_context%"
      ^!set %theConcordance%=^%empty%
      ^!jump TEXT_START

      :LOOP
      ^!find "^%expr%" rsi
      ^!iferror AllDone
      ^!set %theConcordance%=^%theConcordance%^$GetSelection$^P
      ^!jump SELECT_START
      ^!movecursor +1
      ^!goto loop

      :AllDone
      ; replace buffer by concordance
      ^!select ALL
      ^!inserttext ^%theConcordance%
      ;
      ;end of clip
    • Show all 35 messages in this topic