Nouns/Verbs related to Adjectives/Adverbs

202 views
Skip to first unread message

koko_2

unread,
Nov 2, 2008, 8:29:30 PM11/2/08
to wn-perl
Is it possible to obtain the nouns/verbs related to adjectives/adverbs
using wordNet ? or any other library ??

fahima hajjej

unread,
Nov 3, 2008, 2:23:43 AM11/3/08
to wn-...@googlegroups.com


The following little QueryData program will show you all the nouns in WordNet!

-------------------

use WordNet::QueryData;
my $wn = WordNet::QueryData->new;

@allnouns = $wn->listAllWords("n");

print "@allnouns";

2008/11/3 koko_2 <a.ba...@gmail.com>

koko_2

unread,
Nov 5, 2008, 9:20:12 AM11/5/08
to wn-perl
That's not exactly what I wanted.
What I was looking for is a tool/way to automatically transform
adjectives/adverbs to their corresponding nouns/verbs.


On Nov 3, 7:23 am, "fahima hajjej" <hajjejfah...@gmail.com> wrote:
> The following little QueryData program will show you all the nouns in
> WordNet!
>
> -------------------
>
> use WordNet::QueryData;
> my $wn = WordNet::QueryData->new;
>
> @allnouns = $wn->listAllWords("n");
>
> print "@allnouns";
> 2008/11/3 koko_2 <a.bawa...@gmail.com>

Jason Rennie

unread,
Nov 5, 2008, 9:48:44 AM11/5/08
to wn-...@googlegroups.com
kick#n represents the noun of kick; kick#v represents the verb form of kick.  You can use querySense to get the list of senses for any word#pos.

Jason
--
Jason Rennie
Head of Machine Learning Technologies, StyleFeeder
http://www.stylefeeder.com/

koko_2

unread,
Nov 5, 2008, 1:19:11 PM11/5/08
to wn-perl
If I had an adjective (say marvellous), and I needed to get its
corresponding noun (marvellousness), how can I do that using
querySense ?
Same for the following adjectives -> nouns:
illegal -> illegality
long -> longness
gusty -> gust
etc.

Also, an automated method for finding the corresponding verbs of
adverbs is needed.

Jason Rennie

unread,
Nov 5, 2008, 1:20:04 PM11/5/08
to wn-...@googlegroups.com
QueryData won't help you with that.  Sorry.

Jason

Ben Haskell

unread,
Nov 5, 2008, 2:47:17 PM11/5/08
to wn-...@googlegroups.com
On Wed, 5 Nov 2008, Jason Rennie wrote:
>
> > On Wed, Nov 5, 2008 at 1:19 PM, koko_2 <a.ba...@gmail.com> wrote:
> >
> > If I had an adjective (say marvellous), and I needed to get its
> > corresponding noun (marvellousness), how can I do that using
> > querySense ?
> > Same for the following adjectives -> nouns:
> > illegal -> illegality
> > long -> longness
> > gusty -> gust
> > etc.
> >
> > Also, an automated method for finding the corresponding verbs of
> > adverbs is needed.
>
> QueryData won't help you with that.  Sorry.
>
> Jason


koko_2,

The derivational links might be what you want. I think you'd be better off
not using WordNet for this task. The derivational links aren't specific,
in that you don't know what type of derivation it is. And they're not very
comprehensive. But, nonetheless, they're something...

The following/attached program demonstrates. (Also at
http://wordnet.princeton.edu/~ben/derived.pl )

Best,
Ben


e.g.

$ perl derived.pl illegal long gusty revolution
illegal => {
illegal
illegality
}
long => {
long
longer
longing
longness
}
gusty => {
gust
gusty
}
revolution => {
revolt
revolution
revolutionary
revolutionise
revolutionism
revolutionist
revolutionize
revolve
}


#### derived.pl ############################

#!/usr/bin/perl
use strict;
use warnings;
use WordNet::QueryData;
my $qd = WordNet::QueryData->new;

# transform word or word#pos into word#pos#sense
sub senses {
while (grep !(2 == tr/#/#/), @_) {
@_ = map $qd->queryWord($_), @_;
}
@_
}

# transform word#pos#sense into word -- change the '.*?' to '.*' to keep #pos
sub word { local $_ = @_ ? shift : $_; /^(.*?)#/ ? $1 : $_ }

# follow derivational links recursively
sub derived {
local $_ = shift;
my $count;
my %words;
my %senses;
$senses{$_}++ for senses $_;
do {
$count = keys %words;
for my $sense (keys %senses) {
for my $rel (qw/deri/) {
$senses{$_}++ for $qd->queryWord($sense, $rel);
}
}
$words{word $_}++ for keys %senses;
} while $count != keys %words; # stop when we've not added any words
sort keys %words;
}

# test it

my @words;
for (reverse 0..$#ARGV) {
unshift @words, splice @ARGV, $_, 1 unless -f $ARGV[$_];
}
my $count = @words;
print "Enter a word (Control-D/Enter to stop)\n" unless @words;
while (1) {
last if $count and not @words;
$_ = @words ? shift @words : <>;
last unless defined;
chomp;
last unless length;
print "$_\n" for "$_ => {", map("\t$_", derived($_)), "}";
}

derived.pl

koko_2

unread,
Nov 5, 2008, 6:34:40 PM11/5/08
to wn-perl
Thanks for the fast response,,
I have been looking for an alternative to wordNet derivation links for
the past few days with no luck so far... If anybody comes across
anything that would achieve this task,, please reply to this thread...



On Nov 5, 7:47 pm, Ben Haskell <b...@clarity.princeton.edu> wrote:
> On Wed, 5 Nov 2008, Jason Rennie wrote:
>
>  derived.pl
> 1KViewDownload

koko_2

unread,
Nov 20, 2008, 1:16:28 PM11/20/08
to wn-perl
Can somebody please explain to me what this code does and what it is
calling ? I am trying to write my own Java function that retrieves the
derivation links and currently using JWSL (and also experimenting now
with this
http://www.androidtech.com/html/wordnet-mysql-20.php)
_______________________________________________
for my $sense (keys %senses) {
for my $rel (qw/deri/) {
$senses{$_}++ for $qd->queryWord($sense, $rel);
}
}
______________________________________________
in particular , what does qw/deriv/ do or call ?

Thanks in advance for your help.



On Nov 5, 11:34 pm, koko_2 <a.bawa...@gmail.com> wrote:
> Thanks for the fast response,,
> I have been looking for an alternative to wordNet derivation links for
> the past few days with no luck so far... If anybody comes across
> anything that would achieve this task,, please reply to this thread...
>
> On Nov 5, 7:47 pm, Ben Haskell <b...@clarity.princeton.edu> wrote:
>
> > On Wed, 5 Nov 2008, Jason Rennie wrote:
>
> > > > On Wed, Nov 5, 2008 at 1:19 PM, koko_2 <a.bawa...@gmail.com> wrote:
>
> > > >       If I had an adjective (say marvellous), and I needed to get its
> > > >       corresponding noun (marvellousness), how can I do that using
> > > >       querySense ?
> > > >       Same for the following adjectives -> nouns:
> > > >       illegal -> illegality
> > > >       long -> longness
> > > >       gusty -> gust
> > > >       etc.
>
> > > >       Also, an automated method for finding the corresponding verbs of
> > > >       adverbs is needed.
>
> > > QueryData won't help you with that.  Sorry.
>
> > > Jason
>
> > koko_2,
>
> > Thederivationallinks might be what you want. I think you'd be better off
> > not using WordNet for this task. Thederivationallinks aren't specific,
> > # followderivationallinks recursively

Saggi Malachi

unread,
Jan 8, 2009, 9:14:18 AM1/8/09
to wn-perl
for my $sense (keys %senses)
---- will run over the keys of the associative array %senses


qw/deri/
---- will create a list which only consists the word 'deri', in case
it was qw/deri foo/ for example then it would have been a list of both
'deri' and 'foo' but in this case $rel is will always be deri
(derived) and this loop will run only once.


$senses{$_}++ for $qd->queryWord($sense,$rel)
---- will use queryWord's result as the key in the %senses associative
array and ++ that element. I guess its using they key and not value
for avoiding duplicates.







On Nov 20 2008, 8:16 pm, koko_2 <a.bawa...@gmail.com> wrote:
> Can somebody please explain to me what this code does and what it is
> calling ? I am trying to write my own Java function that retrieves the
> derivation links and currently using JWSL (and also experimenting now
> with thishttp://www.androidtech.com/html/wordnet-mysql-20.php)
Reply all
Reply to author
Forward
0 new messages