If we have only console, and we want to quickly see meaning of some word. Then we can use following perl script to get dictionary meaning of a word.
It uses perl, curl and html2text.
The source code of meaning_of.pl is :
The source code of meaning_of.pl is :
#!/usr/bin/perl -w ## Search the dict.org use strict; use warnings; sub print_usage() { print STDERR "USAGE: $0 <query>\n"; } if (@ARGV < 1) { &print_usage(); exit(-1); } my $query = "$ARGV[0]"; $query =~ s/ /\%20/g; my $cmd = "curl -# -A \"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\" -d \"Form=Dict1&Query=${query}&Strategy=*&Database=english\" \"http://www.dict.org/bin/Dict\" | html2text 2>/dev/null"; #system($cmd); #exit($?); open(MOFH, "$cmd | ") or die("$0: cannot execute: $cmd\n"); my $skip_lines = 10; # skip first 10 lines my $line; while ($line = <MOFH>) { --$skip_lines; next if ($skip_lines > 0); chomp($line); print "$line\n"; } close(MOFH); exit(0);Sample run of above perl script :
$ meaning_of.pl happiness
######################################################################## 100.0% =============================================================================== 4 definitions found for happiness From The_Collaborative_International_Dictionary_of_English_v.0.48: Happiness \Hap"pi*ness\, n. [From Happy.] 1. Good luck; good fortune; prosperity. [1913 Webster] All happiness bechance to thee in Milan! --Shak. [1913 Webster] 2. An agreeable feeling or condition of the soul arising from good fortune or propitious happening of any kind; the possession of those circumstances or that state of being which is attended with enjoyment; the state of being happy; contentment; joyful satisfaction; felicity; blessedness. [1913 Webster] 3. Fortuitous elegance; unstudied grace; -- used especially of language. [1913 Webster] Some beauties yet no precepts can declare, For there's a happiness, as well as care. --Pope. Syn: Happiness, Felicity, Blessedness, Bliss. Usage: Happiness is generic, and is applied to almost every kind of enjoyment except that of the animal appetites; felicity is a more formal word, and is used more sparingly in the same general sense, but with elevated associations; blessedness is applied to the most refined enjoyment arising from the purest social, benevolent, and religious affections; bliss denotes still more exalted delight, and is applied more appropriately to the joy anticipated in heaven. [1913 Webster] O happiness! our being's end and aim! --Pope. [1913 Webster] Others in virtue place felicity, But virtue joined with riches and long life; In corporal pleasures he, and careless ease. --Milton. [1913 Webster] His overthrow heaped happiness upon him; For then, and not till then, he felt himself, And found the blessedness of being little. --Shak. [1913 Webster] From WordNet_(r)_3.0_(2006): happiness n 1: state of well-being characterized by emotions ranging from contentment to intense joy [syn: happiness, felicity] [ant: unhappiness] 2: emotions experienced when in a state of well-being [ant: sadness, unhappiness] From Moby_Thesaurus_II_by_Grady_Ward,_1.0: 117 Moby Thesaurus words for "happiness": Easy Street, acceptance, affluence, appropriateness, beatification, beatitude, becomingness, bed of roses, bewitchment, blessedness, bliss, blissfulness, blitheness, blithesomeness, brightness, cheer, cheerfulness, cheeriness, cheery vein, civility, cloud nine, clover, comfort, composure, content, contentedness, contentment, decency, decorousness, decorum, delectation, delight, ease, easy circumstances, ecstasy, ecstatics, elation, enchantment, enjoyment, entire satisfaction, eupeptic mien, euphoria, exaltation, exhilaration, exuberance, felicity, fitness, fittingness, fleshpots, fulfillment, gaiety, geniality, genteelness, gentility, gladness, gladsomeness, glee, good cheer, gracious life, gracious living, heaven, high spirits, hopefulness, intoxication, jollity, joy, joyance, joyfulness, joyousness, jubilation, lap of luxury, life of ease, loaves and fishes, luxury, meetness, optimism, overhappiness, overjoyfulness, paradise, peace of mind, pleasantness, pleasure, properness, propriety, prosperity, prosperousness, radiance, rapture, ravishment, reconcilement, reconciliation, resignation, rightness, rosy expectation, sanguine humor, sanguineness, satisfaction, security, seemliness, seventh heaven, success, suitability, sunniness, sunshine, the affluent life, the good life, thriving condition, transport, unalloyed happiness, upward mobility, urbanity, velvet, weal, wealth, welfare, well-being, winsomeness From The_Devil's_Dictionary_(1881-1906): HAPPINESS, n. An agreeable sensation arising from contemplating the misery of another. =============================================================================== Questions or comments about this site? Contact webmaster@dict.org
No comments:
Post a Comment