lilli has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm trying to use TreeTagger to find the lemmas of words in a documents. I'm using Alvis::TreeTagger to be able to access TreeTagger from perl. This requires the 'mkfifo' command to be used and I'm running the code on a Windows machine. I tried using the Ppt::util package to get unix commands in Windows, but it doesn't seem to be working. For some reason I can still not run the 'mkfifo' command. Maybe I'm not suppose to use 'util.pm'? Anyone have any ideas or other solutions? I would be very happy for your response. Bests, -lilli.

Replies are listed 'Best First'.
Re: run TreeTagger in Windows
by cdarke (Prior) on Mar 03, 2009 at 12:52 UTC
    Does the supplier claim their package is portable?
    How is it calling mkfifo? If through system you could get an mkfifo from Here (haven't tried that myself). It then depends on how it is using the 'fifo'. On UNIX a fifo is accessed using the ordinary file access commands, opened, read and written just as if it was a regular file (seek won't work though). On Windows there is a client-server model - for the server almost everything is different to UNIX (probably why POSIX::mkfifo is not implemented on Windows). The client can access the pipe as normal - except it actually does a Windows login. On Windows Named pipes are kernel objects - they do not persist after a reboot and they do not exist on a filesystem. On UNIX named pipes have an inode and survive a reboot (not that you ever need to reboot a UNIX machine you understand).

    Some other IPC method needs to be used. Can we see how the fifo is being used?
    Update: Looking at the source for Alvis::TreeTagger it appears to be UNIX specific - it has hard-coded UNIX style path names in. I don't know TreeTagger, but looking at the .pm code it looks like it just redirects stdin and stdout to named pipes. So (unless I'm missing something) you should be able to drive it using ordinary anonymous pipes, see perlipc.
      Hi, thank you for the reply. I'm trying to use the same thing that I found at perlipc.
      if (system('mkfifo',"$FIFO.in")||system('mkfifo',"$FIFO.out") ) { print STDERR "Cannot create pipes $FIFO.in or $FIFO.in\n"; exit(1); }
      This requires that the 'mkfifo' is there somehow. When I try to run the code I get the following error message:
      " 'mkfifo' is not recognized as an internal or external command, operable program or batch file. Cannot create pipes /tmp/treetagger_2216.in or ..." From the perlipc I cannot get any clues for how to solve this. It might be that I just don't understands... Any further ideas?
      bests,
      -lilli.
        Did you download mkfifo from the GNU site? Can you drive it from the Windows command-line?

        I suggest you take a look at the Avis::TreeTagger module code - it does nothing more than run the TreeTagger program attached to named pipes. I would not use it on Windows because it uses UNIX hard-coded path names and fork/exec.

        In theory all you have to do is run the TreeTagger program only use IPC::Open2 instead. You will then have two file handles to anonymous pipes instead of named pipes.
Re: run TreeTagger in Windows
by Anonymous Monk on Mar 03, 2009 at 12:36 UTC
      Download Treetagger for Windows (with GUI) here: http://ifile.it/qsihl0y Implemented with Win32::GUI