~ubuntu-branches/ubuntu/trusty/hyperestraier/trusty-proposed

« back to all changes in this revision

Viewing changes to filter/estwnetxpnd

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2006-11-14 05:28:32 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061114052832-0lzqzcefn8mt4yqe
Tags: 1.4.9-1.1
* Non-maintainer upload.
* High-urgency upload for RC bugfix.
* Set HOME=$(CURDIR)/junkhome when building, otherwise the package build
  will incorrectly look for headers there -- and fail when the directory
  exists and is unreadable, as happens sometimes on sudo-using
  autobuilders!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
3
#================================================================
 
4
# estwnetsyno
 
5
# List synonyms of a word using WordNet
 
6
#================================================================
 
7
 
 
8
 
 
9
# set variables
 
10
LANG=C ; export LANG
 
11
LC_ALL=C ; export LC_ALL
 
12
PATH="$PATH:/usr/local/bin:$HOME/bin:/usr/WordNet-*/bin:/usr/local/WordNet-*/bin" ; export PATH
 
13
progname="estwnetsyno"
 
14
word="$1"
 
15
if [ -z "$word" ]
 
16
then
 
17
  word="$ESTWORD"
 
18
fi
 
19
 
 
20
 
 
21
# show help message
 
22
if [ "$1" = "--help" ]
 
23
then
 
24
  printf 'List synonyms of a word using WordNet\n'
 
25
  printf '\n'
 
26
  printf 'Usage:\n'
 
27
  printf '  %s word\n' "$progname"
 
28
  printf '\n'
 
29
  exit 0
 
30
fi
 
31
 
 
32
 
 
33
# limit the resource
 
34
ulimit -v 262144 -t 30 2> "/dev/null"
 
35
 
 
36
 
 
37
# list synonyms
 
38
wn "$word" -o -synsn -synsv -synsa -synsr |
 
39
awk '
 
40
/^{[0-9]*} */ {
 
41
  sub(/^{[0-9]*} */, "")
 
42
  gsub(/\([^)]*\)/, "")
 
43
  split($0, terms, /,/)
 
44
  for(i in terms){
 
45
    term = tolower(terms[i])
 
46
    sub(/^ +/, "", term)
 
47
    sub(/ +$/, "", term)
 
48
    if(length(term) > 0) printf("%s\n", term)
 
49
  }
 
50
}
 
51
' |
 
52
sort | uniq
 
53
 
 
54
 
 
55
# exit normally
 
56
exit 0
 
57
 
 
58
 
 
59
 
 
60
# END OF FILE