Archive
How to ease editing work in MS-Word by automating search/replace operations
- If you frequently have to edit documents according to a large number of editorial rules and regulations
- and if you can partially automate these edit operations (or at least highlight suspicious passages for human review) with Word’s search/replace,
- I can recommend an add-in that can automate even the repeated search/replace operations (like the 57 in the video below)
- and even help you manage your search/replace strings and regular expressions in a spreadsheet which it can load from:
- Greg Maxey’s VBA Find & Replace Word Add-in. See it in action (click for full size):
TwoThree Caveats: :- At this point, I cannot get the add-in to work only in Word 2010. Even if I lower Macro security and allow programmatic access to the VBA project, when trying to launch the add-in from the ribbon, Word 2013 complains: “The macro cannot be found or has been disabled due to your macro security settings”:
.
- The automation is only as good as your underlying search/replace operations. (Hint: “Some people, when confronted with a problem, think ‘I know, I’ll use regular expressions.’ Now they have two problems.”)
- I think I will refrain from search/replace during “Tracking changes” – as in the video – , and rather use “Compare documents” after the replace operations – too many quirks otherwise…
- At this point, I cannot get the add-in to work only in Word 2010. Even if I lower Macro security and allow programmatic access to the VBA project, when trying to launch the add-in from the ribbon, Word 2013 complains: “The macro cannot be found or has been disabled due to your macro security settings”:
Source code samples
How to identify graded participants in Moodle Course Activity Reports using Vlookup
- Having a chart of full names, Moodle id # and usernames would be useful (e.g. for debugging with the Activity Reports that in some cases do not resolve Moodle id# so Excel vlookup has to rescue the day once again…)
- The Moodle “Participants” affords the instructor a convenient list, with paging, sort, filter (by role), and different detail-level views.
- However, the overview does link course and student id #, but not institutional username while the detail view contain the username as part of the email, but is not truly tabular (consists of an array of tables, each containing one user; at least you can avoid the paging).
- Enter grepwin to extract the emails:
- and copy paste them into the Excel created from the tabular overview:
Is there an easier way?
Tools for Search-Replace text with Regular Expression on Windows
Just a quick thumbs up for a free tool:
To examine licensing files, I am looking for a tool that can massage the computer-readable file (no XML) into a friendlier format (that can be imported into Excel).
The regular needed to achieve that I too complex for TextPad or MS-Word.
Other tools I have used have not been updated in a long ime (RegEx Workbench).
Grep for Windows? I have just revitalized my cygwin installation, but would like something a little more user-friendly, with a GUI .
That also rules out PowerShell’s 2.0 Select-String.
PowerGrep, as recommended on stackoverflow, looks nice, but is not free.
inforapid-searchreplacer looks not bad, but I went for grepWin, which got the job done quickly and nicely:
Click Button “Test” to preview results:
Click Button “Search” to file the matching files list:
Limitations of GrepWin: Is there a size limit in the test regex text input field – here is how my test text got truncated:
Using home-brew NLP regular expressions to automate question generation for learning material creation
- The trpQuizGenerator, from which the screenshots below are taken,
- is an attempt to facilitate, speed up, automate question generation for foreign language learning by collecting a regular expressions, reflecting typical patterns that cause difficulties for language learners in a number of L2 – inspired by common 1st and 2nd year textbooks:
- German: differentiation between Dative and Accusative case personal pronouns
- Italian: contraction of article and preposition
- Spanish: demonstrative pronouns.
- Some more rather arbitrary, but easily implemementable examples for ESL:
- Numbers: ―Much/many‖ dichotomy
- which/who‖ relative pronoun dichotomy: Difficult for German students of English which has no such
dichotomy for innate beings/things, but whose (antiquated) relative pronoun ―Welch‖ as a false friend
of which tends to lead to a wrong preference of ―which‖ to ―who‖ by German speakers. - Sub clauses/tenses: if clauses up to period/comma, giving the number of words as hints. Would
require a delegate.
- Regular expressions in .Net have a number of advanced features that makes the platform a good choice for this enterprise:
- The resulting texts can be e.g. easily delivered as formative assessment exercises to students using trpQuiz.dot.
- is an attempt to facilitate, speed up, automate question generation for foreign language learning by collecting a regular expressions, reflecting typical patterns that cause difficulties for language learners in a number of L2 – inspired by common 1st and 2nd year textbooks:
- Update:
- In a much more recent approach to the same automation problem, I am trying to repurpose well-established existing NLP-platforms for question generation.
- However, compared with the above customized approach, to transform the built-in, not SLA-specific NLP recognition I have found so far taking not only much more work for reformatting for delivery, but also more creativity, or willingness to put up with limitations when it comes to homing in on typical learner problems.