Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

probability of repeated words

Sun Nov 16, 2008 12:29 pm

hello

if any one have or know function or package in java that , it can calculate the probability of repeated words in file

like
(What is cinco cervezas? I really don't know
But this pretty little senorita said it and I liked how it flowed
What is venga mi casa? I really don't know
From the way that she smiled I could tell how the story would go )

if i want probability of repeat (is) in this string

thank in advance :D


Last edited by DrRakha on Sun Nov 16, 2008 3:56 pm, edited 1 time in total.
Reason: title changed

Re: i need this function or this package in java pleas help

Sun Nov 16, 2008 3:56 pm

i made this code for you ,
Code:
  int count=0;
       
        String mm="asgsdgsissdfsadfsisissdfdsfsdf  is";
        int lastindex=0;
        int temp=-1;
        for(int i=0;i<mm.length();i++)
        {
             temp=mm.indexOf("is",lastindex);
          if(temp!=-1)
          {
           lastindex=temp+2;
           count++;   
          }
             
         }



the output is :
count=4

Post a reply
  Related Posts  to : probability of repeated words
 No repeated background image     -  
 sort words in c++     -  
 get number of words in a string     -  
 Breaking the String into Words     -  
 Return words count in a string     -  
 Change the letter spacing of the words     -