Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi everyone.
My question is the following. I have the following structure:

1 beast-n into transform-v 356.9551 2 beast-n obj kill-v 266.2511 3 beast-n obj see-v 252.3623 4 beast-n prd become-v 250.9534 5 beast-n obj tame-v 224.6948 6 beast-n into turn-v 191.9883 7 beast-n obj call-v 171.4000 8 beast-n sbj_intr devour-v 165.3228 9 beast-n obj hunt-v 155.7637 10 beast-n obj fight-v 150.4370 11 beast-n obj slay-v 150.3982 1 frog-n obj find-v 322.5589 2 frog-n into turn-v 307.3012 3 frog-n sbj_intr jump-v 235.0503 4 frog-n coord-1 toad-n 207.3611 5 frog-n obj see-v 207.2610 6 frog-n obj eat-v 204.1762 7 frog-n obj kill-v 64.6689

Using these data I need to implement a statistical measure to check the relevance of a given semantic relation in regards to the names it occur with.
Apart from the list above, I have two words as input. (sticking to the previous example, let's say they are beast-n and frog-n. If a given feature occurring with the first word also occurs whit the second, I have to compute Precision of the feature in regard to the first word. If I am at rank 1, and I found a feature that occurs also with the second word, my precision is 1, because it's computed as found_relevant_feat/rank_found. In the example above, the only feat that occurs both with beast and frog is kill-v. My precision would then be 1(which is the number of found_rel_feat until that rank)/2 which is the rank in which it occurs.
Also, I have to found the rank in which the given feature has been founded with word2. (in this case 7) When I am done with this I also need to know the total number of occurrence of the first word and the total number of occurrence of the second word. (given the example before, it would be 11 for beast-n and 7 for frog-n).

my ($prop,$rank, $score); my ($prop2,$rank2, $score2); while (my($name1,$aref) = each %matrice ) { my $num=0; foreach my $item (@$aref){ $count_feat_trovate=0; ($prop,$rank, $score) = split(',',$item); my $lastrank=&lastrank2($name2,$prop); while (my($name2,$aref2) = each %matrice) { foreach my $item1 (@$aref2){ ($prop2,$rank2, $score2) = split(',',$item1); if($prop eq $prop2){ $count_feat_trovate++; #number of feat found $rank_trovato_2=$rank2; #Rank of which the feat has been f +ound in regards to the second element } } } $last_rank_2=$rank2; } $last_rank_1=$rank; }

I guess I just made a lot of mess without achieving anything. Any ideas on how to retrieve the needed data?
Thanks
Giulia


In reply to Nested Cycle - Statistic measure by remluvr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-23 06:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found