Total members 11895 |It is currently Sun Dec 22, 2024 8:45 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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.
title changed


Author:
Newbie
User avatar Posts: 6
Have thanks: 0 time

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

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  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     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com