Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Pseudo code to find co-words in some text

Pseudocode algorithm to find the most co-occurrence pair within


a text. It will have to check for presence or absence at the
sentence level.If it occurs many times in the same sentence it is
count as one.
Input: Text in article.Output: Most frequently occurring words at
the sentence level.
Solution:
Create a variable string to hold data in text fileask user to input
the name of text articleopen fileget input text to the variable of
type string(string text)tolower(text) // convert all text to lowercase
so it is case insensitive countWordpairFreq(text) // print out the
most frequent co-word in the text and its frequency
algorithm tolower(text)Get text from variable text convert to lower
case.
loop through out the text if uppercase found
change it to lower
return textalgorithm countWordpairFreq(text) {
declare a double array that will hold a word an its frequency
declare a double array that will hold the most occurrent co-word
and its frequency
loop to all text to find delimiters in the text and break it to
sentences
{if the character is in the alphabet add to array
if the character is not in the alphabet and if a letter is preceded

the character check for delimiters


increment sentences. increment index on the array
}
//now that we have separated the sentences we move to find co-
words in the sentence level

You might also like