ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Clipboard Help+Spell

CHS: New Formatting Dialog

<< < (14/14)

rjbull:

Using MT to change the file in-place..:
--- End quote ---

for this you should have told CHS to read output from input file.  that should work.
-mouser (November 18, 2011, 03:03 PM)
--- End quote ---

I thought I had, but, I was getting in a tangle.  Look at the one that starts "Reading from STDOUT;".  That's the one where I had to kill the process.

mouser:
rj, i could use a little more help in understanding a test i can do to fix this.

your commandline arguements to spellcheck files make it hard for me to figure out.

can you give me a sample text, and a sample mtrw invocation that reads from stdin, writes to stdout, and tell me what i should see.  and that doesnt use any additional files like some spellcheck?

so tell me the original text, and then give me a commandline that when run reads from stdin, writes to stdout, and tell me what it produces.

then i can try to make chs work on it.

rjbull:
rj, i could use a little more help in understanding a test i can do to fix this.

your commandline arguements to spellcheck files make it hard for me to figure out.-mouser (November 28, 2011, 08:28 PM)
--- End quote ---
Figuring out command lines is hard work!

can you give me a sample text, and a sample mtrw invocation that reads from stdin, writes to stdout, and tell me what i should see.  and that doesnt use any additional files like some spellcheck?-mouser (November 28, 2011, 08:28 PM)
--- End quote ---

For anyone wishing to quarry more information out of the Help files, here are some Ministry of Truth resources:

* Andrew B. Pipkin, home page of original author
* Jason Hood's updated version.  Note, I'm using his Win32 port.
* Eric Pement's MiniTrue page, useful supplementary information, though it refers to the original version, not Jason Hood's updated one.
The basic use of MT is:

mtr <OPTIONS> <FILES> - <STRINGS>

i.e., it expects to operate on files in situ.  <STRINGS> is the search-and-replace pairs.  These options are modified by the arguments.

Now for the way I've used it.  I don't claim to fully understand things, but - E&OE - these are the command line arguments I use:


* -q
Quiet mode; don't write to screen unless a match is found
* -n
No prompting; make all replacements automatically.  (MT can be used as a file viewer, and replacements can be made interactively)
* -w
Whole words only
* -o+
Matches and their surrounding context will be written to standard output instead of being displayed in the textviewer.  The "+" causes MT to print both matching and non-matching lines, otherwise it would behave like a grep.
* -b-
Don't make numbered backup files.  May not be relevant if using STDIN/STDOUT.
* -c-
Case sensitive
* -i:SPELC_MT.MT
As stated above, by default MT expects to find its search/replace strings on the command line.  -i says to take them from a file, in this case, SPELC_MT.MT When giving MT its search/replace strings from a file, the format is simple, one line per pair,  SEARCH = REPLACE
My file is as follows, though perhaps I should explain how this came about.  When I was writing current awareness bulletins, I preferred not to use a spell checker as it slowed me down and upset the flow.  Instead, I waited until "going to press time" and tidied everything up at that stage.  I found I frequently made the same typos, so used MT to replace them before using an interactive spelling checker to catch everything else.  SPELC_MT.MT was my typo-repair file:

--- ---abd = and
abouot = about
accomodate = accommodate
accoring = according
acrulic = acrylic
additon = addition
additoinal = additional
adequaate = adequate
afecting = affecting
alos = also
alterntaive = alternative
amd = and
amke = make
angluar = angular
anounced = announced
annnounced = announced
aplication = application
applicatin = application
applicaton = application
applicatons = applications
applicaiton = application
asurance = assurance
Australina = Australian
availabilty = availability
avaiable = available
avaialable = available
avaialble = available
blck = black
caoted = coated
caoting = coatings
cardinla = cardinal
cartrdige = cartridge
carridge = cartridge
carteridge = cartridge
carrtridge = cartridge
carttridge = cartridge
cartride = cartridge
cartrige = cartridge
catridge = cartridge
chemcial = chemical
chemsitry = chemistry
cleaing = cleaning
cleimed = claimed
coier = copier
coor = colour
coour = colour
coours = colours
cooor = colour
cooour = colour
coolour = colour
coloor = colour
coloour = colour
colouor = colour
colouir = colour
colur = colour
Colur = Colour
comapny = company
comaptible = compatible
compatbile = compatible
compatilbe = compatible
commerical = commercial
Commerical = Commercial
communicaton = communication
communicaton = communication
completly = completely
compnay = company
compsition = composition
consders = considers
consumpton = consumption
containign = containing
continous = continuous
continuos = continuous
containint = containing
converson = conversion
corect = correct
corection = correction
cotaings = coatings
coyright = copyright
curently = currently
deistribution = distribution
demostrated = demonstrated
deisgned = designed
deisnged = designed
desribe = describes
detectin = detecting
detectin = detection
develped = developed
differnet = different
ditigal = digital
divison = division
Divison = Division
dramataically = dramatically
electrophotograpy = electrophotography
emphsaize = emphasize
emulson = emulsions
engien = engine
enginering = engineering
Enginering = Engineering
epxoy = epoxy
equaton = equation
estimaed = estimated
euroepan = european
Europena = European
examinaton = examination
excpet = except
exhbiton = exhibition
Exhbiton = Exhibition
exhibiton = exhibition
feaure = feature
foramt = format
fomrs = forms
formaulation = formulation
functinal = funtional
functon = function
grnding = grinding
grphics = graphics
gropu = group
Helath = Health
helath = health
hihglight = highlight
http:////www = http://www
ilustrated = illustrated
iks = inks
iks. = inks.
imporved = improved
impproved = improved
inaging = imaging
Inaging = Imaging
indistiguishable = indistinguishable
informatin = information
inlcuding = including
inlcude = include
inlcuded = included
inproved = improved
instruciton = instruction
instrucitons = instructions
inteface = interface
Internatonal = International
intorduced = introduced
introduciton = introduction
Japense = Japanese
litle = little
machie = machine
machne = machine
magentic = magnetic
managemtn = managment
Managemtn = Managment
managment = management
Managment = Management
managmetn = managment
Managmetn = Managment
manufactuirng = manufacturing
manufctured = manufactured
marekt = market
materil = material
measurment = measurement
mentoned = mentioned
mesurement = measurement
Milikan = Millikan
modifiaction = modification
modifed = modified
mrket = market
multifuncion = multifunction
natinal = national
newtork = network
novle = novel
Oc‚ = Oce
opprtunity = opportunity
Opprtunity = Opportunity
otical = optical
palstic = plastic
particulalry = particularly
peformed = performed
performacne = performance
pigmetned = pigmented
Pigmetned = Pigmented
pigmetn = pigment
Pigmetn = Pigment
photorecptor = photoreceptor
poolymer = polymer
poymer = polymer
porces = proces
priners = printers
priner = printer
printint = printing
priter = printer
priters = printers
priting = printing
pritn = print
printng = printing
pritning = printing
pritnr = printer
pritns = prints
prniter = printer
pritners = printers
printrs = printers
prnits = prints
produciton = production
proudction = production
prodcut = product
pront = print
ptiner = printer
qulaity = quality
questin = question
ractialc = ractical
radiaton = radiation
raidation = radiation
Raidation = Radiation
reactons = reactions
realted = related
reamnufacturing = remanufacturing
recahrger = recharger
Recahrger = Recharger
recyling = recycling
reistance = resistances
repalce = replace
repalces = replaces
reporducible = reproducible
requre = require
reserach = research
Reserach = Research
resistane = resistance
resoultion = resolution
resoution = resolution
respetively = respectively
rodcution = roduction
rpelace = replace
rpinter = printer
rreleased = released
rpinting = printing
safty = safety
Safty = Safety
saveing = saving
searhc = search
serice = service
Shapr = Sharp
slected = selected
Smasung = Samsung
solvnet = solvent
sophisiticated = sophisticated
soulbe = soluble
soulble = soluble
soultion = solution
snnounced = announced
Statci = Static
suplies = supplies
supllier = supplier
sympton = symptom
sythesis = synthesis
technoogy = technology
tensin = tension
theree = three
thermodyamic = thermodynamic
thje = the
thjere = there
threee = three
tjat = that
tje = the
uisng = using
unchaged = unchanged
unusualy = unusually
upgraes = upgrades
upgrde = upgrade
utiities = utilities
variaton = variation
varnsihe = varnishes
vesion = version
wateer = water
whcih = which
wher = where
whihc = which
wiht = with
wnat = want
wolrdwide = worldwide
xperimetn = xperiment

In order to test it, I tried a few words from that file.  Hence test.txt:
tje wolrdwide catridge

If you open a CMD.EXE console and run this line:
c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT test.txt > mod.txt
you don't see anything on screen - you aren't supposed to - but you find a new file mod.txt that contains
the worldwide cartridge
which is the correct transformation.
type test.txt | c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT > mod.txt
also works, as does
c:\DOS\Utils\mtrw.exe -q -n -w -o+ -b- -c- -i:SPELC_MT.MT < test.txt > mod.txt

Is that enough explanation?  I can't immediately think of anything else to add.

Navigation

[0] Message Index

[*] Previous page

Go to full version