problem when using '|' to pipe command lines.

32 views
Skip to first unread message

Huang Y.J.

unread,
May 31, 2012, 5:33:35 AM5/31/12
to chibolts
Dear Mr./Ms:

Hello, I am using CLAN under Windows7 to do POS grammar pattern search
for a large corpus about 55 texts of 2000,000 words. In order to tag
and all the files with mor at once and then do frequency and
concordance search, I try to simplify the procedure by using pipe bar
‘|’ for multiple command lines.

E.g. In order to change the Language and ID code names systematically
from ‘en’ to ‘eng’ through multi-files, and then following the mor and
post commands for tagging, I tried to combine the commands together to
run them in a batch by using ‘|’ in between each command line.

When the command lines are executed together in a pipe line, some
errors occurred as the below.
" Can't create file *.CHSTR.chstr.cex", perhaps it is opened by
another application "
(But when each command line is executed separately, the result is
smooth and correct.)

I was wondering do you know what the problem is and how I can solve
it? Or is there any other way that I can simplify the tagging and
searching procedure in a batch for multiple files? (expecting to be a
growing corpus of 50~100 files in 4~7 folders.)
Thank you.

Best,
Huang Y.J.

The pipe command lines I used and the result as the following:

textin *.txt | chstring +s"en" "eng" *.cha +w +t@ID -t* | chstring
+s"en" "eng" *.chstr.cex +w +t@Languages -t* | mor *.*chstr.chstr.cex
| post *.*chstr.chstr.mor.cex

The feedback message from CLAN:
textin *.txt
Mon May 28 00:11:56 2012
textin (21-Feb-2012)
****************************************
From file <Test.txt>
Done with file <Test.txtin.cha>
From string "en" to string "eng"
Can't create file "*.chstr.cex", perhaps it is opened by another
application
From string "en" to string "eng"
Can't create file "*.CHSTR.chstr.cex", perhaps it is opened by another
application
Can't create file "*.*CHSTR.CHSTR.mor.cex", perhaps it is opened by
another application

Using file: C:\Program Files\CHILDES\CLAN\lib\English Grammar
(mor)\post.db.

Mon May 28 00:11:56 2012
post (21-Feb-2012) is conducting analyses on:
ALL speaker tiers
****************************************
From pipe input
the file "*.*CHSTR.CHSTR.MOR.pst.cex" cannot be opened or created
>

Brian MacWhinney

unread,
May 31, 2012, 8:19:45 AM5/31/12
to chib...@googlegroups.com
Dear Y. J.,
The piping symbol is intended to be used in a single command within a single line. It passes
data from one program to the next through a "data pipe". It is not relevant to batch file usage.
In your case, you want each of these commands on a separate line. You can put these in a
batch file, but if you use the -re switch properly, my guess is that you could just do this all through
a few commands you type in. You may also want to use the +1 switch to avoid cluttering up your
folders with intermediary files. But make sure you copy the whole corpus first in case the +1 switch
makes an error.

For this type of work, you may also want to use a REGEX editor such as BBEdit that gives you more
power than CHSTRING.

-- Brian MacWhinney
> --
> You received this message because you are subscribed to the Google Groups "chibolts" group.
> To post to this group, send email to chib...@googlegroups.com.
> To unsubscribe from this group, send email to chibolts+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/chibolts?hl=en.
>
>

Leonid Spektor

unread,
May 31, 2012, 9:55:48 AM5/31/12
to chib...@googlegroups.com
Huang,

Pipe combines all the data from all input files into one data stream and outputs that data stream as one file. The result is that information about which file each data came from is lost. We do not recommend using Pipe if you want to keep data from each individual file separately in corresponding output data files.

I have fixed TEXTIN to create language tag "eng" instead of "en" and installed CLAN on childes. Now you do not need to use CHSTRING command. The new commands you need to use are:

textin *.txt
mor *.txtin.cha +1
post *.txtin.cha +1
ren *.txtin.cha *.cha

or you can put them into batch file and run that batch file with this command "bat batch.cut".


If you want to use your older version of CLAN, then here is a simpler list of commands, then you used in your example below,:

textin *.txt
chstring +s"en" "eng" *.txtin.cha +w +t@ID +t@Languages -t*
mor *.txtin.chstr.cex
post *.txtin.chstr.mor.cex
ren *.txtin.chstr.mor.pst.cex *.cha
del *.txtin.cha
del *.cex

You can also put those commands into batch file and run them with command "bat batch-old.cut".

I am attaching both of those batch files here:

batch.cut
batch-old.cut
Reply all
Reply to author
Forward
0 new messages