9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: trebol <trebol55555@yahoo.es>
To: 9fans <9fans@9fans.net>
Subject: [9fans] International Ispell in Plan9
Date: Sun, 14 Apr 2013 03:30:41 +0100	[thread overview]
Message-ID: <20130414023041.GA28280@one.invalid.invalid> (raw)

Hello everyone.

This script works very fine.  I will take a look at sources, and learn
the proper way to share this.

There is a lot of dictionaries you can use with ispell:

http://fmg-www.cs.ucla.edu/geoff/ispell-dictionaries.html


I will make a package with ispell and the American and British
dictionaries, and a separate package with the Spanish dictionary.
I'm starting to learn Portuguese, so I will try to make a package for
this language too, but I think it would be great if a native speaker
of each language makes and tests the dictionaries.  The work is easy,
just make a utf8 formatter like that I showed you in the first mail I
send with this subject.

With the dot's address I can fix the output to make it work with
arbitrarily selections.  I'm still looking for some way to get the
dot's address of a window within a rc script, but I think that the
proper way it's going to be keep learning C (just 3th chapter of K&R
for now...) and make a simple C program to make the work and put it in
/acme/bin for future use in scripts, and maybe substitute the script
with a faster program.

Regards,
trebol.

//////////////////////////
//////////////////////////

#!/bin/rc

rm -f /tmp/$pid^'.'aispell

args=()
spellflags=()
for(x){
	switch($x){
	case -d*
		spellflags=($spellflags $x)
	case -p*
		spellflags=($spellflags $x)
	case -T*
		spellflags=($spellflags $x)
	case *
		args = ($args $x)
	}
}

dir = /mnt/wsys
if(! test -f $dir/cons)
	dir = /mnt/term/$dir
id=`{cat $dir/new/ctl}
id=$id(1)

#if(~ $#args 1 && ~ $args /*){
#	adir = `{basename -d $args}
#	args = `{basename $args}
#	echo 'name '^$adir^/-spell > $dir/$id/ctl
#	cd $adir
#}
#if not {
	echo 'name '^`{pwd}^/-spell > $dir/$id/ctl
#}

{
	echo noscroll
	if(~ $#args 0){
		cat > /tmp/$pid^'.'aispell
		args = /tmp/$pid^'.'aispell
		pipe = 1
	}
	for(i in $args){
			name = $i
			if(~ $pipe 1){
				name = `{sed 's/ .*//g' < /mnt/acme/$winid/tag}
				if(~ name '') name = nonamedwindow
			}
		for(j in `{{cat $i; echo} | $home/local/bin/acme/spout | sort -t: -u +2 | sed 's/$/\!/g' | $home/local/bin/ispell -a $spellflags | grep '^[&#]' | sed 's/ /_/g'}){
		# {cat $i; echo} is for spout, needs \n. I want make a list of lines, so j can't have spaces
			miss = `{ echo $j | awk -F_ '{print $2}'}
			sugg = `{ echo $j | sed 's/^.*://g'} # I can't put grep -v '^#' here...
			{cat $i; echo} |
			$home/local/bin/acme/spout |
			grep '.*:'$miss'$' |
			sed 's/$/ '$sugg'/g' | # If I put grep -v '^#' above, this sed cuts output, I don't know why ...
			sed 's/#_.*$//g' |
			sed 's/_/ /g' |  # If I put sed 's/_/ /g' above, variables don't work in sed.  Again, I don't know why...
			sed s',^,'$name',g' > $dir/$id/body
		}

	}
	rm -f /tmp/$pid^'.'aispell
	echo clean
}> $dir/$id/ctl



             reply	other threads:[~2013-04-14  2:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14  2:30 trebol [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-04-13  6:48 trebol
2013-04-11 12:34 trebol
2013-04-10 22:01 trebol
2013-04-11  6:57 ` Mark van Atten
2013-04-11 17:57 ` Nemo
2013-04-12 12:21   ` trebol
2013-04-12 12:39     ` Francisco J Ballesteros
2013-04-12 12:56     ` erik quanstrom
2013-04-13  3:36       ` trebol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130414023041.GA28280@one.invalid.invalid \
    --to=trebol55555@yahoo.es \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).