Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

get frequency of each character in a file

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i have this code which calculate the instance of each character in the file ,I want to calculate the frequency of each character alone and i want to get the maximum frequency between them
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Meran ahmed,

First of all, a warm welcome to CodeRanch!

Meran ahmed wrote:i have this code which calculate the instance of each character in the file ,I want to calculate the frequency of each character alone and i want to get the maximum frequency between them


I can't understand what you try to achieve. Can you give some further explanation? It would even better to provide some sample data and share the output produced with your current code and the output you want to get.

Kind regards,
Roel
 
Meran ahmed
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot .
i want to calculate term frequency and idf.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Meran ahmed wrote:i want to calculate term frequency and idf.


So you are trying to do something like tf–idf? That's not what I got from your initial post, because it seems you wanted to get frequency of characters.
 
Meran ahmed
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i meant tf and idf
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Meran ahmed wrote:sorry i meant tf and idf


To count the frequency of words/terms, the str_word_count function could be useful.
 
Meran ahmed
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roel De Nijs wrote:

Meran ahmed wrote:sorry i meant tf and idf


To count the frequency of words/terms, the str_word_count function could be useful.



say that file1 contains a b c d a , i want to make a code which determines that the frequency of a=2 and b=1 .... then get the max frequency in my document
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Meran ahmed wrote:i want to make a code which determines that the frequency of a=2 and b=1 ....


That's exactly what the str_word_count function will return. But I guess you didn't even bother to look at that link I provided, otherwise you would have known and you could have developed the necessary code yourself. It seems you are looking for a ready-to-use solution. Unfortunately that's not going to happen on CodeRanch: we are NotACodeMill and you should ShowSomeEffort. This is a nice quote which illustrates perfectly what we are trying to do here at CodeRanch: Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime.
 
It runs on an internal combustion engine. This ad does not:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic